[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
hyatt at apple.com
hyatt at apple.com
Wed Dec 22 13:54:16 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit ef4fd6e4a728d0bbb0ca7ff6060b4a3cb64f5e83
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Sep 29 05:38:14 2010 +0000
https://bugs.webkit.org/show_bug.cgi?id=46780
Reviewed by Sam Weinig.
Rename the pos/neg/collapsed margin methods. Rename all the members of the RenderBlockRareData struct.
No logical changes. Just renames.
* editing/TextIterator.cpp:
(WebCore::shouldEmitExtraNewlineForNode):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::MarginInfo::MarginInfo):
(WebCore::RenderBlock::layoutBlock):
(WebCore::RenderBlock::collapseMargins):
(WebCore::RenderBlock::clearFloatsIfNeeded):
(WebCore::RenderBlock::estimateVerticalPosition):
(WebCore::RenderBlock::setCollapsedBottomMargin):
(WebCore::RenderBlock::layoutBlockChild):
(WebCore::RenderBlock::paintChildren):
(WebCore::RenderBlock::lowestPosition):
(WebCore::RenderBlock::setMaxMarginBeforeValues):
(WebCore::RenderBlock::setMaxMarginAfterValues):
(WebCore::RenderBlock::absoluteRects):
(WebCore::RenderBlock::absoluteQuads):
(WebCore::RenderBlock::rectWithOutlineForRepaint):
(WebCore::RenderBlock::addFocusRingRects):
* rendering/RenderBlock.h:
(WebCore::RenderBlock::maxPosMarginBefore):
(WebCore::RenderBlock::maxNegMarginBefore):
(WebCore::RenderBlock::maxPosMarginAfter):
(WebCore::RenderBlock::maxNegMarginAfter):
(WebCore::RenderBlock::initMaxMarginValues):
(WebCore::RenderBlock::maxMarginBefore):
(WebCore::RenderBlock::maxMarginAfter):
(WebCore::RenderBlock::RenderBlockRareData::RenderBlockRareData):
(WebCore::RenderBlock::RenderBlockRareData::beforePosDefault):
(WebCore::RenderBlock::RenderBlockRareData::beforeNegDefault):
(WebCore::RenderBlock::RenderBlockRareData::afterPosDefault):
(WebCore::RenderBlock::RenderBlockRareData::afterNegDefault):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalHeight):
* rendering/RenderBox.h:
(WebCore::RenderBox::collapsedMarginBefore):
(WebCore::RenderBox::collapsedMarginAfter):
(WebCore::RenderBox::maxMarginBefore):
(WebCore::RenderBox::maxMarginAfter):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68626 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 5b81b16..ac66d2a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,53 @@
+2010-09-28 David Hyatt <hyatt at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ https://bugs.webkit.org/show_bug.cgi?id=46780
+
+ Rename the pos/neg/collapsed margin methods. Rename all the members of the RenderBlockRareData struct.
+ No logical changes. Just renames.
+
+ * editing/TextIterator.cpp:
+ (WebCore::shouldEmitExtraNewlineForNode):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::MarginInfo::MarginInfo):
+ (WebCore::RenderBlock::layoutBlock):
+ (WebCore::RenderBlock::collapseMargins):
+ (WebCore::RenderBlock::clearFloatsIfNeeded):
+ (WebCore::RenderBlock::estimateVerticalPosition):
+ (WebCore::RenderBlock::setCollapsedBottomMargin):
+ (WebCore::RenderBlock::layoutBlockChild):
+ (WebCore::RenderBlock::paintChildren):
+ (WebCore::RenderBlock::lowestPosition):
+ (WebCore::RenderBlock::setMaxMarginBeforeValues):
+ (WebCore::RenderBlock::setMaxMarginAfterValues):
+ (WebCore::RenderBlock::absoluteRects):
+ (WebCore::RenderBlock::absoluteQuads):
+ (WebCore::RenderBlock::rectWithOutlineForRepaint):
+ (WebCore::RenderBlock::addFocusRingRects):
+ * rendering/RenderBlock.h:
+ (WebCore::RenderBlock::maxPosMarginBefore):
+ (WebCore::RenderBlock::maxNegMarginBefore):
+ (WebCore::RenderBlock::maxPosMarginAfter):
+ (WebCore::RenderBlock::maxNegMarginAfter):
+ (WebCore::RenderBlock::initMaxMarginValues):
+ (WebCore::RenderBlock::maxMarginBefore):
+ (WebCore::RenderBlock::maxMarginAfter):
+ (WebCore::RenderBlock::RenderBlockRareData::RenderBlockRareData):
+ (WebCore::RenderBlock::RenderBlockRareData::beforePosDefault):
+ (WebCore::RenderBlock::RenderBlockRareData::beforeNegDefault):
+ (WebCore::RenderBlock::RenderBlockRareData::afterPosDefault):
+ (WebCore::RenderBlock::RenderBlockRareData::afterNegDefault):
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::computeLogicalHeight):
+ * rendering/RenderBox.h:
+ (WebCore::RenderBox::collapsedMarginBefore):
+ (WebCore::RenderBox::collapsedMarginAfter):
+ (WebCore::RenderBox::maxMarginBefore):
+ (WebCore::RenderBox::maxMarginAfter):
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::layoutBlock):
+
2010-09-28 Kevin Ollivier <kevino at theolliviers.com>
[wx] wxMSW build fix. Don't use multiple inheritance in PopupMenuWx to avoid debug build
diff --git a/WebCore/editing/TextIterator.cpp b/WebCore/editing/TextIterator.cpp
index e5452b0..0612986 100644
--- a/WebCore/editing/TextIterator.cpp
+++ b/WebCore/editing/TextIterator.cpp
@@ -782,7 +782,7 @@ static bool shouldEmitExtraNewlineForNode(Node* node)
|| node->hasTagName(pTag)) {
RenderStyle* style = r->style();
if (style) {
- int bottomMargin = toRenderBox(r)->collapsedMarginBottom();
+ int bottomMargin = toRenderBox(r)->collapsedMarginAfter();
int fontSize = style->fontDescription().computedPixelSize();
if (bottomMargin * 2 >= fontSize)
return true;
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index 7fa6e3c..cbef15e 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -104,8 +104,8 @@ RenderBlock::MarginInfo::MarginInfo(RenderBlock* block, int beforeBorderPadding,
m_quirkContainer = block->isTableCell() || block->isBody() || block->style()->marginBeforeCollapse() == MDISCARD ||
block->style()->marginAfterCollapse() == MDISCARD;
- m_posMargin = m_canCollapseMarginBeforeWithChildren ? block->maxTopMargin(true) : 0;
- m_negMargin = m_canCollapseMarginBeforeWithChildren ? block->maxTopMargin(false) : 0;
+ m_posMargin = m_canCollapseMarginBeforeWithChildren ? block->maxMarginBefore(RenderBox::PositiveMargin) : 0;
+ m_negMargin = m_canCollapseMarginBeforeWithChildren ? block->maxMarginBefore(RenderBox::NegativeMargin) : 0;
}
// -------------------------------------------------------------------------------------------------------
@@ -1182,7 +1182,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren, int pageHeight)
if (n && n->hasTagName(formTag) && static_cast<HTMLFormElement*>(n)->isMalformed()) {
// See if this form is malformed (i.e., unclosed). If so, don't give the form
// a bottom margin.
- setMaxBottomMargins(0, 0);
+ setMaxMarginAfterValues(0, 0);
}
setPaginationStrut(0);
@@ -1467,14 +1467,14 @@ bool RenderBlock::handleRunInChild(RenderBox* child)
int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo)
{
// Get our max pos and neg top margins.
- int posTop = child->maxTopMargin(true);
- int negTop = child->maxTopMargin(false);
+ int posTop = child->maxMarginBefore(PositiveMargin);
+ int negTop = child->maxMarginBefore(NegativeMargin);
// For self-collapsing blocks, collapse our bottom margins into our
// top to get new posTop and negTop values.
if (child->isSelfCollapsingBlock()) {
- posTop = max(posTop, child->maxBottomMargin(true));
- negTop = max(negTop, child->maxBottomMargin(false));
+ posTop = max(posTop, child->maxMarginAfter(PositiveMargin));
+ negTop = max(negTop, child->maxMarginAfter(NegativeMargin));
}
// See if the top margin is quirky. We only care if this child has
@@ -1486,7 +1486,7 @@ int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo)
// block. If it has larger margin values, then we need to update
// our own maximal values.
if (!document()->inQuirksMode() || !marginInfo.quirkContainer() || !topQuirk)
- setMaxTopMargins(max(posTop, maxTopPosMargin()), max(negTop, maxTopNegMargin()));
+ setMaxMarginBeforeValues(max(posTop, maxPosMarginBefore()), max(negTop, maxNegMarginBefore()));
// The minute any of the margins involved isn't a quirk, don't
// collapse it away, even if the margin is smaller (www.webreference.com
@@ -1515,14 +1515,14 @@ int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo)
// This child has no height. We need to compute our
// position before we collapse the child's margins together,
// so that we can get an accurate position for the zero-height block.
- int collapsedTopPos = max(marginInfo.posMargin(), child->maxTopMargin(true));
- int collapsedTopNeg = max(marginInfo.negMargin(), child->maxTopMargin(false));
+ int collapsedTopPos = max(marginInfo.posMargin(), child->maxMarginBefore(PositiveMargin));
+ int collapsedTopNeg = max(marginInfo.negMargin(), child->maxMarginBefore(NegativeMargin));
marginInfo.setMargin(collapsedTopPos, collapsedTopNeg);
// Now collapse the child's margins together, which means examining our
// bottom margin values as well.
- marginInfo.setPosMarginIfLarger(child->maxBottomMargin(true));
- marginInfo.setNegMarginIfLarger(child->maxBottomMargin(false));
+ marginInfo.setPosMarginIfLarger(child->maxMarginAfter(PositiveMargin));
+ marginInfo.setNegMarginIfLarger(child->maxMarginAfter(NegativeMargin));
if (!marginInfo.canCollapseWithMarginBefore())
// We need to make sure that the position of the self-collapsing block
@@ -1545,8 +1545,8 @@ int RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo)
ypos = height();
}
- marginInfo.setPosMargin(child->maxBottomMargin(true));
- marginInfo.setNegMargin(child->maxBottomMargin(false));
+ marginInfo.setPosMargin(child->maxMarginAfter(PositiveMargin));
+ marginInfo.setNegMargin(child->maxMarginAfter(NegativeMargin));
if (marginInfo.margin())
marginInfo.setMarginAfterQuirk(child->isBottomMarginQuirk() || style()->marginAfterCollapse() == MDISCARD);
@@ -1583,11 +1583,11 @@ int RenderBlock::clearFloatsIfNeeded(RenderBox* child, MarginInfo& marginInfo, i
atBottomOfBlock = false;
}
if (atBottomOfBlock) {
- marginInfo.setPosMargin(child->maxBottomMargin(true));
- marginInfo.setNegMargin(child->maxBottomMargin(false));
+ marginInfo.setPosMargin(child->maxMarginAfter(PositiveMargin));
+ marginInfo.setNegMargin(child->maxMarginAfter(NegativeMargin));
} else {
- marginInfo.setPosMargin(max(child->maxTopMargin(true), child->maxBottomMargin(true)));
- marginInfo.setNegMargin(max(child->maxTopMargin(false), child->maxBottomMargin(false)));
+ marginInfo.setPosMargin(max(child->maxMarginBefore(PositiveMargin), child->maxMarginAfter(PositiveMargin)));
+ marginInfo.setNegMargin(max(child->maxMarginBefore(NegativeMargin), child->maxMarginAfter(NegativeMargin)));
}
// Adjust our height such that we are ready to be collapsed with subsequent siblings (or the bottom
@@ -1603,7 +1603,7 @@ int RenderBlock::clearFloatsIfNeeded(RenderBox* child, MarginInfo& marginInfo, i
// FIXME: This isn't quite correct. Need clarification for what to do
// if the height the cleared block is offset by is smaller than the
// margins involved.
- setMaxTopMargins(oldTopPosMargin, oldTopNegMargin);
+ setMaxMarginBeforeValues(oldTopPosMargin, oldTopNegMargin);
marginInfo.setAtBeforeSideOfBlock(false);
}
@@ -1616,7 +1616,7 @@ int RenderBlock::estimateVerticalPosition(RenderBox* child, const MarginInfo& ma
// relayout if there are intruding floats.
int yPosEstimate = height();
if (!marginInfo.canCollapseWithMarginBefore()) {
- int childMarginTop = child->selfNeedsLayout() ? child->marginTop() : child->collapsedMarginTop();
+ int childMarginTop = child->selfNeedsLayout() ? child->marginTop() : child->collapsedMarginBefore();
yPosEstimate += max(marginInfo.margin(), childMarginTop);
}
@@ -1700,7 +1700,7 @@ void RenderBlock::setCollapsedBottomMargin(const MarginInfo& marginInfo)
if (marginInfo.canCollapseWithMarginAfter() && !marginInfo.canCollapseWithMarginBefore()) {
// Update our max pos/neg bottom margins, since we collapsed our bottom margins
// with our children.
- setMaxBottomMargins(max(maxBottomPosMargin(), marginInfo.posMargin()), max(maxBottomNegMargin(), marginInfo.negMargin()));
+ setMaxMarginAfterValues(max(maxPosMarginAfter(), marginInfo.posMargin()), max(maxNegMarginAfter(), marginInfo.negMargin()));
if (!marginInfo.marginAfterQuirk())
setBottomMarginQuirk(false);
@@ -1803,8 +1803,8 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, int& maxFloatBottom
void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int& previousFloatBottom, int& maxFloatBottom)
{
- int oldTopPosMargin = maxTopPosMargin();
- int oldTopNegMargin = maxTopNegMargin();
+ int oldTopPosMargin = maxPosMarginBefore();
+ int oldTopNegMargin = maxNegMarginBefore();
// The child is a normal flow object. Compute its vertical margins now.
child->computeBlockDirectionMargins(this);
@@ -2252,7 +2252,7 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty)
if (checkAfterAlways
&& (ty + child->y() + child->height()) > paintInfo.rect.y()
&& (ty + child->y() + child->height()) < paintInfo.rect.bottom()) {
- view()->setBestTruncatedAt(ty + child->y() + child->height() + max(0, child->collapsedMarginBottom()), this, true);
+ view()->setBestTruncatedAt(ty + child->y() + child->height() + max(0, child->collapsedMarginAfter()), this, true);
return;
}
}
@@ -3393,7 +3393,7 @@ int RenderBlock::lowestPosition(bool includeOverflowInterior, bool includeSelf)
while (currBox && currBox->isFloatingOrPositioned())
currBox = currBox->previousSiblingBox();
if (currBox) {
- int childBottomEdge = currBox->y() + currBox->height() + currBox->collapsedMarginBottom();
+ int childBottomEdge = currBox->y() + currBox->height() + currBox->collapsedMarginAfter(); // FIXME: "after" is wrong here for lowestPosition.
bottom = max(bottom, childBottomEdge + paddingBottom() + relativeOffset);
}
}
@@ -5587,26 +5587,26 @@ void RenderBlock::clearTruncation()
}
}
-void RenderBlock::setMaxTopMargins(int pos, int neg)
+void RenderBlock::setMaxMarginBeforeValues(int pos, int neg)
{
if (!m_rareData) {
- if (pos == RenderBlockRareData::topPosDefault(this) && neg == RenderBlockRareData::topNegDefault(this))
+ if (pos == RenderBlockRareData::beforePosDefault(this) && neg == RenderBlockRareData::beforeNegDefault(this))
return;
m_rareData = new RenderBlockRareData(this);
}
- m_rareData->m_topPos = pos;
- m_rareData->m_topNeg = neg;
+ m_rareData->m_beforePos = pos;
+ m_rareData->m_beforeNeg = neg;
}
-void RenderBlock::setMaxBottomMargins(int pos, int neg)
+void RenderBlock::setMaxMarginAfterValues(int pos, int neg)
{
if (!m_rareData) {
- if (pos == RenderBlockRareData::bottomPosDefault(this) && neg == RenderBlockRareData::bottomNegDefault(this))
+ if (pos == RenderBlockRareData::afterPosDefault(this) && neg == RenderBlockRareData::afterNegDefault(this))
return;
m_rareData = new RenderBlockRareData(this);
}
- m_rareData->m_bottomPos = pos;
- m_rareData->m_bottomNeg = neg;
+ m_rareData->m_afterPos = pos;
+ m_rareData->m_afterNeg = neg;
}
void RenderBlock::setPaginationStrut(int strut)
@@ -5635,8 +5635,10 @@ void RenderBlock::absoluteRects(Vector<IntRect>& rects, int tx, int ty)
// inline boxes above and below us (thus getting merged with them to form a single irregular
// shape).
if (isAnonymousBlockContinuation()) {
- rects.append(IntRect(tx, ty - collapsedMarginTop(),
- width(), height() + collapsedMarginTop() + collapsedMarginBottom()));
+ // FIXME: This is wrong for block-flows that are horizontal.
+ // https://bugs.webkit.org/show_bug.cgi?id=46781
+ rects.append(IntRect(tx, ty - collapsedMarginBefore(),
+ width(), height() + collapsedMarginBefore() + collapsedMarginAfter()));
continuation()->absoluteRects(rects,
tx - x() + inlineElementContinuation()->containingBlock()->x(),
ty - y() + inlineElementContinuation()->containingBlock()->y());
@@ -5650,8 +5652,10 @@ void RenderBlock::absoluteQuads(Vector<FloatQuad>& quads)
// inline boxes above and below us (thus getting merged with them to form a single irregular
// shape).
if (isAnonymousBlockContinuation()) {
- FloatRect localRect(0, -collapsedMarginTop(),
- width(), height() + collapsedMarginTop() + collapsedMarginBottom());
+ // FIXME: This is wrong for block-flows that are horizontal.
+ // https://bugs.webkit.org/show_bug.cgi?id=46781
+ FloatRect localRect(0, -collapsedMarginBefore(),
+ width(), height() + collapsedMarginBefore() + collapsedMarginAfter());
quads.append(localToAbsoluteQuad(localRect));
continuation()->absoluteQuads(quads);
} else
@@ -5662,7 +5666,7 @@ IntRect RenderBlock::rectWithOutlineForRepaint(RenderBoxModelObject* repaintCont
{
IntRect r(RenderBox::rectWithOutlineForRepaint(repaintContainer, outlineWidth));
if (isAnonymousBlockContinuation())
- r.inflateY(collapsedMarginTop());
+ r.inflateY(collapsedMarginBefore()); // FIXME: This is wrong for block-flows that are horizontal.
return r;
}
@@ -5798,9 +5802,11 @@ void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, int tx, int ty)
// FIXME: This check really isn't accurate.
bool nextInlineHasLineBox = inlineElementContinuation()->firstLineBox();
// FIXME: This is wrong. The principal renderer may not be the continuation preceding this block.
+ // FIXME: This is wrong for block-flows that are horizontal.
+ // https://bugs.webkit.org/show_bug.cgi?id=46781
bool prevInlineHasLineBox = toRenderInline(inlineElementContinuation()->node()->renderer())->firstLineBox();
- int topMargin = prevInlineHasLineBox ? collapsedMarginTop() : 0;
- int bottomMargin = nextInlineHasLineBox ? collapsedMarginBottom() : 0;
+ int topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : 0;
+ int bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : 0;
IntRect rect(tx, ty - topMargin, width(), height() + topMargin + bottomMargin);
if (!rect.isEmpty())
rects.append(rect);
diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h
index 032beb7..0682039 100644
--- a/WebCore/rendering/RenderBlock.h
+++ b/WebCore/rendering/RenderBlock.h
@@ -194,21 +194,21 @@ protected:
}
void moveChildrenTo(RenderBlock* to, RenderObject* startChild, RenderObject* endChild, RenderObject* beforeChild, bool fullRemoveInsert = false);
- int maxTopPosMargin() const { return m_rareData ? m_rareData->m_topPos : RenderBlockRareData::topPosDefault(this); }
- int maxTopNegMargin() const { return m_rareData ? m_rareData->m_topNeg : RenderBlockRareData::topNegDefault(this); }
- int maxBottomPosMargin() const { return m_rareData ? m_rareData->m_bottomPos : RenderBlockRareData::bottomPosDefault(this); }
- int maxBottomNegMargin() const { return m_rareData ? m_rareData->m_bottomNeg : RenderBlockRareData::bottomNegDefault(this); }
+ int maxPosMarginBefore() const { return m_rareData ? m_rareData->m_beforePos : RenderBlockRareData::beforePosDefault(this); }
+ int maxNegMarginBefore() const { return m_rareData ? m_rareData->m_beforeNeg : RenderBlockRareData::beforeNegDefault(this); }
+ int maxPosMarginAfter() const { return m_rareData ? m_rareData->m_afterPos : RenderBlockRareData::afterPosDefault(this); }
+ int maxNegMarginAfter() const { return m_rareData ? m_rareData->m_afterNeg : RenderBlockRareData::afterNegDefault(this); }
- void setMaxTopMargins(int pos, int neg);
- void setMaxBottomMargins(int pos, int neg);
+ void setMaxMarginBeforeValues(int pos, int neg);
+ void setMaxMarginAfterValues(int pos, int neg);
void initMaxMarginValues()
{
if (m_rareData) {
- m_rareData->m_topPos = RenderBlockRareData::topPosDefault(this);
- m_rareData->m_topNeg = RenderBlockRareData::topNegDefault(this);
- m_rareData->m_bottomPos = RenderBlockRareData::bottomPosDefault(this);
- m_rareData->m_bottomNeg = RenderBlockRareData::bottomNegDefault(this);
+ m_rareData->m_beforePos = RenderBlockRareData::beforePosDefault(this);
+ m_rareData->m_beforeNeg = RenderBlockRareData::beforeNegDefault(this);
+ m_rareData->m_afterPos = RenderBlockRareData::afterPosDefault(this);
+ m_rareData->m_afterNeg = RenderBlockRareData::afterNegDefault(this);
m_rareData->m_paginationStrut = 0;
}
}
@@ -284,8 +284,14 @@ private:
virtual bool isSelfCollapsingBlock() const;
- virtual int maxTopMargin(bool positive) const { return positive ? maxTopPosMargin() : maxTopNegMargin(); }
- virtual int maxBottomMargin(bool positive) const { return positive ? maxBottomPosMargin() : maxBottomNegMargin(); }
+ virtual int maxMarginBefore(MarginSign sign) const
+ {
+ return (sign == PositiveMargin) ? maxPosMarginBefore() : maxNegMarginBefore();
+ }
+ virtual int maxMarginAfter(MarginSign sign) const
+ {
+ return (sign == PositiveMargin) ? maxPosMarginAfter() : maxNegMarginAfter();
+ }
virtual void repaintOverhangingFloats(bool paintAllDescendants);
@@ -586,25 +592,38 @@ private:
// Allocated only when some of these fields have non-default values
struct RenderBlockRareData : Noncopyable {
- RenderBlockRareData(const RenderBlock* o)
- : m_topPos(topPosDefault(o))
- , m_topNeg(topNegDefault(o))
- , m_bottomPos(bottomPosDefault(o))
- , m_bottomNeg(bottomNegDefault(o))
+ RenderBlockRareData(const RenderBlock* block)
+ : m_beforePos(beforePosDefault(block))
+ , m_beforeNeg(beforeNegDefault(block))
+ , m_afterPos(afterPosDefault(block))
+ , m_afterNeg(afterNegDefault(block))
, m_paginationStrut(0)
, m_pageY(0)
{
}
- static int topPosDefault(const RenderBlock* o) { return o->marginTop() > 0 ? o->marginTop() : 0; }
- static int topNegDefault(const RenderBlock* o) { return o->marginTop() < 0 ? -o->marginTop() : 0; }
- static int bottomPosDefault(const RenderBlock* o) { return o->marginBottom() > 0 ? o->marginBottom() : 0; }
- static int bottomNegDefault(const RenderBlock* o) { return o->marginBottom() < 0 ? -o->marginBottom() : 0; }
+ static int beforePosDefault(const RenderBlock* block)
+ {
+ return std::max(block->marginBefore(), 0);
+ }
+
+ static int beforeNegDefault(const RenderBlock* block)
+ {
+ return std::max(-block->marginBefore(), 0);
+ }
+ static int afterPosDefault(const RenderBlock* block)
+ {
+ return std::max(block->marginAfter(), 0);
+ }
+ static int afterNegDefault(const RenderBlock* block)
+ {
+ return std::max(-block->marginAfter(), 0);
+ }
- int m_topPos;
- int m_topNeg;
- int m_bottomPos;
- int m_bottomNeg;
+ int m_beforePos;
+ int m_beforeNeg;
+ int m_afterPos;
+ int m_afterNeg;
int m_paginationStrut;
int m_pageY;
};
diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp
index b7d0856..93a305c 100644
--- a/WebCore/rendering/RenderBox.cpp
+++ b/WebCore/rendering/RenderBox.cpp
@@ -1729,7 +1729,7 @@ void RenderBox::computeLogicalHeight()
if (stretchesToViewHeight() || paginatedContentNeedsBaseHeight) {
// FIXME: Finish accounting for block flow here.
// https://bugs.webkit.org/show_bug.cgi?id=46603
- int margins = collapsedMarginTop() + collapsedMarginBottom();
+ int margins = collapsedMarginBefore() + collapsedMarginAfter();
int visHeight;
if (document()->printing())
visHeight = static_cast<int>(view()->pageHeight());
diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h
index 54c4b87..df8a8de 100644
--- a/WebCore/rendering/RenderBox.h
+++ b/WebCore/rendering/RenderBox.h
@@ -189,18 +189,33 @@ public:
void setMarginEnd(int);
void setMarginBefore(int);
void setMarginAfter(int);
-
+
// The following five functions are used to implement collapsing margins.
// All objects know their maximal positive and negative margins. The
// formula for computing a collapsed margin is |maxPosMargin| - |maxNegmargin|.
// For a non-collapsing box, such as a leaf element, this formula will simply return
- // the margin of the element. Blocks override the maxTopMargin and maxBottomMargin
+ // the margin of the element. Blocks override the maxMarginBefore and maxMarginAfter
// methods.
+ enum MarginSign { PositiveMargin, NegativeMargin };
virtual bool isSelfCollapsingBlock() const { return false; }
- int collapsedMarginTop() const { return maxTopMargin(true) - maxTopMargin(false); }
- int collapsedMarginBottom() const { return maxBottomMargin(true) - maxBottomMargin(false); }
- virtual int maxTopMargin(bool positive) const { return positive ? std::max(0, marginTop()) : -std::min(0, marginTop()); }
- virtual int maxBottomMargin(bool positive) const { return positive ? std::max(0, marginBottom()) : -std::min(0, marginBottom()); }
+ int collapsedMarginBefore() const
+ {
+ return maxMarginBefore(PositiveMargin) - maxMarginBefore(NegativeMargin);
+ }
+ int collapsedMarginAfter() const
+ {
+ return maxMarginAfter(PositiveMargin) - maxMarginAfter(NegativeMargin);
+}
+ virtual int maxMarginBefore(MarginSign sign) const
+ {
+ int beforeMargin = marginBefore();
+ return (sign == PositiveMargin) ? std::max(0, beforeMargin) : -std::min(0, beforeMargin);
+ }
+ virtual int maxMarginAfter(MarginSign sign) const
+ {
+ int afterMargin = marginAfter();
+ return (sign == PositiveMargin) ? std::max(0, afterMargin) : -std::min(0, afterMargin);
+ }
virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
virtual void absoluteQuads(Vector<FloatQuad>&);
diff --git a/WebCore/rendering/RenderFlexibleBox.cpp b/WebCore/rendering/RenderFlexibleBox.cpp
index e7d3fb8..18f2f36 100644
--- a/WebCore/rendering/RenderFlexibleBox.cpp
+++ b/WebCore/rendering/RenderFlexibleBox.cpp
@@ -258,14 +258,14 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXM
// bottom margin max values to 0. This way we don't factor in the values
// twice when we collapse with our previous vertically adjacent and
// following vertically adjacent blocks.
- int pos = maxTopPosMargin();
- int neg = maxTopNegMargin();
- if (maxBottomPosMargin() > pos)
- pos = maxBottomPosMargin();
- if (maxBottomNegMargin() > neg)
- neg = maxBottomNegMargin();
- setMaxTopMargins(pos, neg);
- setMaxBottomMargins(0, 0);
+ int pos = maxPosMarginBefore();
+ int neg = maxNegMarginBefore();
+ if (maxPosMarginAfter() > pos)
+ pos = maxPosMarginAfter();
+ if (maxNegMarginAfter() > neg)
+ neg = maxNegMarginAfter();
+ setMaxMarginBeforeValues(pos, neg);
+ setMaxMarginAfterValues(0, 0);
}
// Add in the overflow from children.
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list