Modified: trunk/Source/WebCore/ChangeLog (143949 => 143950)
--- trunk/Source/WebCore/ChangeLog 2013-02-25 18:56:43 UTC (rev 143949)
+++ trunk/Source/WebCore/ChangeLog 2013-02-25 19:14:40 UTC (rev 143950)
@@ -1,3 +1,27 @@
+2013-02-25 Tony Chang <[email protected]>
+
+ Refactor logic for relaying out children out of RenderBlock::styleDidChange
+ https://bugs.webkit.org/show_bug.cgi?id=110661
+
+ Reviewed by David Hyatt.
+
+ Instead of having styleDidChange need to know which children to mark as needing layout,
+ use a bool to keep track of border and padding width changes so at layout time, we know
+ we need to set relayoutChildren=true.
+
+ We steal a bit from m_lineHeight reducing the possible line height from around 500 million pixels
+ to 250 million pixels.
+
+ No new tests, this should be covered by fast/block/positioning/border-change-relayout-test.html and
+ fast/block/dynamic-padding-border.html.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::RenderBlock): Fix indent and initialize m_hasBorderOrPaddingLogicalWidthChanged.
+ (WebCore::RenderBlock::styleDidChange): Remove logic for setting children as needing layout.
+ (WebCore::RenderBlock::updateLogicalWidthAndColumnWidth): Return true if border or padding width changed.
+ * rendering/RenderBlock.h:
+ (RenderBlock): Steal a bit from m_lineHeight and give it to m_hasBorderOrPaddingLogicalWidthChanged.
+
2013-02-25 Alexis Menard <[email protected]>
transition-property property doesn't accept "all, <IDENT>".
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (143949 => 143950)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2013-02-25 18:56:43 UTC (rev 143949)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2013-02-25 19:14:40 UTC (rev 143950)
@@ -199,10 +199,11 @@
// -------------------------------------------------------------------------------------------------------
RenderBlock::RenderBlock(ContainerNode* node)
- : RenderBox(node)
- , m_lineHeight(-1)
- , m_beingDestroyed(false)
- , m_hasMarkupTruncation(false)
+ : RenderBox(node)
+ , m_lineHeight(-1)
+ , m_beingDestroyed(false)
+ , m_hasMarkupTruncation(false)
+ , m_hasBorderOrPaddingLogicalWidthChanged(false)
{
setChildrenInline(true);
COMPILE_ASSERT(sizeof(RenderBlock::FloatingObject) == sizeof(SameSizeAsFloatingObject), FloatingObject_should_stay_small);
@@ -408,36 +409,8 @@
}
// It's possible for our border/padding to change, but for the overall logical width of the block to
- // end up being the same. When this happens, we won't understand to set |relayoutChildren| to true
- // in layoutBlock. Longer-term, we should be figuring this stuff out over in layoutBlock, since
- // we need to be able to handle the same situation in RenderRegions when we have distinct borders in
- // those regions. For now, though, we just mark the children for relayout right here.
- if (oldStyle && diff == StyleDifferenceLayout && needsLayout() && borderOrPaddingLogicalWidthChanged(oldStyle, newStyle)) {
- // First walk our normal flow objects and see if there is any change.
- if (!childrenInline()) {
- for (RenderBox* childBox = firstChildBox(); childBox; childBox = childBox->nextSiblingBox()) {
- // Positioned objects are checked below, since we only care about those objects for which we
- // are the containing block. We skip floats completely, since this matches the behavior of
- // the |relayoutChildren| boolean in layoutBlock. It is entirely possible there are bugs
- // related to floats here, but for now we'll be consistent with layoutBlock, since those
- // bugs would exist even without border/padding changes.
- if (childBox->isFloatingOrOutOfFlowPositioned())
- continue;
- childBox->setChildNeedsLayout(true, MarkOnlyThis);
- }
- }
-
- // Now walk the positioned objects for which we are the containing block.
- TrackedRendererListHashSet* positionedDescendants = positionedObjects();
- if (positionedDescendants) {
- RenderBox* positionedBox;
- TrackedRendererListHashSet::iterator end = positionedDescendants->end();
- for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(); it != end; ++it) {
- positionedBox = *it;
- positionedBox->setChildNeedsLayout(true, MarkContainingBlockChain);
- }
- }
- }
+ // end up being the same. We keep track of this change so in layoutBlock, we can know to set relayoutChildren=true.
+ m_hasBorderOrPaddingLogicalWidthChanged = oldStyle && diff == StyleDifferenceLayout && needsLayout() && borderOrPaddingLogicalWidthChanged(oldStyle, newStyle);
}
RenderBlock* RenderBlock::continuationBefore(RenderObject* beforeChild)
@@ -1493,7 +1466,10 @@
updateLogicalWidth();
calcColumnWidth();
- return oldWidth != logicalWidth() || oldColumnWidth != desiredColumnWidth();
+ bool hasBorderOrPaddingLogicalWidthChanged = m_hasBorderOrPaddingLogicalWidthChanged;
+ m_hasBorderOrPaddingLogicalWidthChanged = false;
+
+ return oldWidth != logicalWidth() || oldColumnWidth != desiredColumnWidth() || hasBorderOrPaddingLogicalWidthChanged;
}
void RenderBlock::checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight)
Modified: trunk/Source/WebCore/rendering/RenderBlock.h (143949 => 143950)
--- trunk/Source/WebCore/rendering/RenderBlock.h 2013-02-25 18:56:43 UTC (rev 143949)
+++ trunk/Source/WebCore/rendering/RenderBlock.h 2013-02-25 19:14:40 UTC (rev 143950)
@@ -1235,9 +1235,10 @@
RenderObjectChildList m_children;
RenderLineBoxList m_lineBoxes; // All of the root line boxes created for this block flow. For example, <div>Hello<br>world.</div> will have two total lines for the <div>.
- mutable signed m_lineHeight : 30;
+ mutable signed m_lineHeight : 29;
unsigned m_beingDestroyed : 1;
unsigned m_hasMarkupTruncation : 1;
+ unsigned m_hasBorderOrPaddingLogicalWidthChanged : 1;
// RenderRubyBase objects need to be able to split and merge, moving their children around
// (calling moveChildTo, moveAllChildrenTo, and makeChildrenNonInline).