Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5583)

Unified Diff: Source/core/rendering/RenderBlockFlow.cpp

Issue 228663014: Iterate Through Fewer Children When Seeking Overhanging Floats (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlockFlow.cpp
diff --git a/Source/core/rendering/RenderBlockFlow.cpp b/Source/core/rendering/RenderBlockFlow.cpp
index b5994d08990b45aa1ce3e574ec06079b2622e745..5d7a47b8a5c040eb278d374d3e19402d31023d5a 100644
--- a/Source/core/rendering/RenderBlockFlow.cpp
+++ b/Source/core/rendering/RenderBlockFlow.cpp
@@ -379,7 +379,6 @@ inline bool RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, LayoutUnit &
m_repaintLogicalTop = 0;
m_repaintLogicalBottom = 0;
- LayoutUnit maxFloatLogicalBottom = 0;
if (!firstChild() && !isAnonymousBlock())
setChildrenInline(true);
@@ -388,7 +387,7 @@ inline bool RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, LayoutUnit &
if (childrenInline())
layoutInlineChildren(relayoutChildren, m_repaintLogicalTop, m_repaintLogicalBottom, afterEdge);
else
- layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom, layoutScope, beforeEdge, afterEdge);
+ layoutBlockChildren(relayoutChildren, layoutScope, beforeEdge, afterEdge);
// Expand our intrinsic height to encompass floats.
if (lowestFloatLogicalBottom() > (logicalHeight() - afterEdge) && createsBlockFormattingContext())
@@ -430,15 +429,14 @@ inline bool RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, LayoutUnit &
updateLogicalHeight();
LayoutUnit newHeight = logicalHeight();
- if (oldHeight != newHeight) {
- if (oldHeight > newHeight && maxFloatLogicalBottom > newHeight && !childrenInline()) {
- // One of our children's floats may have become an overhanging float for us. We need to look for it.
- for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (child->isRenderBlockFlow() && !child->isFloatingOrOutOfFlowPositioned()) {
- RenderBlockFlow* block = toRenderBlockFlow(child);
- if (block->lowestFloatLogicalBottom() + block->logicalTop() > newHeight)
- addOverhangingFloats(block, false);
- }
+ if (oldHeight > newHeight && !childrenInline()) {
+ // One of our children's floats may have become an overhanging float for us.
+ for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
+ if (child->isRenderBlockFlow() && !child->isFloatingOrOutOfFlowPositioned()) {
+ RenderBlockFlow* block = toRenderBlockFlow(child);
+ if (block->lowestFloatLogicalBottom() + block->logicalTop() <= newHeight)
+ break;
+ addOverhangingFloats(block, false);
}
}
}
@@ -502,7 +500,7 @@ void RenderBlockFlow::setLogicalTopForChild(RenderBox* child, LayoutUnit logical
}
}
-void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, LayoutUnit& previousFloatLogicalBottom, LayoutUnit& maxFloatLogicalBottom)
+void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, LayoutUnit& previousFloatLogicalBottom)
{
LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore();
LayoutUnit oldNegMarginBefore = maxNegativeMarginBefore();
@@ -629,8 +627,8 @@ void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo,
}
// If the child has overhanging floats that intrude into following siblings (or possibly out
// of this block), then the parent gets notified of the floats now.
- if (childRenderBlockFlow && childRenderBlockFlow->containsFloats())
- maxFloatLogicalBottom = max(maxFloatLogicalBottom, addOverhangingFloats(childRenderBlockFlow, !childNeededLayout));
+ if (childRenderBlockFlow)
leviw_travelin_and_unemployed 2014/04/15 20:27:30 You're taking out the check because we already che
+ addOverhangingFloats(childRenderBlockFlow, !childNeededLayout);
if (childOffset.width() || childOffset.height()) {
if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled())
@@ -887,7 +885,7 @@ void RenderBlockFlow::rebuildFloatsFromIntruding()
}
}
-void RenderBlockFlow::layoutBlockChildren(bool relayoutChildren, LayoutUnit& maxFloatLogicalBottom, SubtreeLayoutScope& layoutScope, LayoutUnit beforeEdge, LayoutUnit afterEdge)
+void RenderBlockFlow::layoutBlockChildren(bool relayoutChildren, SubtreeLayoutScope& layoutScope, LayoutUnit beforeEdge, LayoutUnit afterEdge)
{
dirtyForLayoutFromPercentageHeightDescendants(layoutScope);
@@ -900,7 +898,6 @@ void RenderBlockFlow::layoutBlockChildren(bool relayoutChildren, LayoutUnit& max
RenderObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren, layoutScope);
LayoutUnit previousFloatLogicalBottom = 0;
- maxFloatLogicalBottom = 0;
RenderBox* next = firstChildBox();
RenderBox* lastNormalFlowChild = 0;
@@ -929,7 +926,7 @@ void RenderBlockFlow::layoutBlockChildren(bool relayoutChildren, LayoutUnit& max
}
// Lay out the child.
- layoutBlockChild(child, marginInfo, previousFloatLogicalBottom, maxFloatLogicalBottom);
+ layoutBlockChild(child, marginInfo, previousFloatLogicalBottom);
lastNormalFlowChild = child;
}
@@ -1178,7 +1175,7 @@ LayoutUnit RenderBlockFlow::collapseMargins(RenderBox* child, MarginInfo& margin
// any floats from the parent will now overhang.
LayoutUnit oldLogicalHeight = logicalHeight();
setLogicalHeight(logicalTop);
- if (previousBlockFlow->containsFloats() && !previousBlockFlow->avoidsFloats() && (previousBlockFlow->logicalTop() + previousBlockFlow->lowestFloatLogicalBottom()) > logicalTop)
+ if (!previousBlockFlow->avoidsFloats() && (previousBlockFlow->logicalTop() + previousBlockFlow->lowestFloatLogicalBottom()) > logicalTop)
addOverhangingFloats(previousBlockFlow, false);
setLogicalHeight(oldLogicalHeight);
@@ -2444,15 +2441,14 @@ void RenderBlockFlow::addIntrudingFloats(RenderBlockFlow* prev, LayoutUnit logic
}
}
-LayoutUnit RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool makeChildPaintOtherFloats)
+void RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool makeChildPaintOtherFloats)
{
// Prevent floats from being added to the canvas by the root element, e.g., <html>.
if (child->hasOverflowClip() || !child->containsFloats() || child->isDocumentElement() || child->hasColumns() || child->isWritingModeRoot())
- return 0;
+ return;
LayoutUnit childLogicalTop = child->logicalTop();
LayoutUnit childLogicalLeft = child->logicalLeft();
- LayoutUnit lowestFloatLogicalBottom = 0;
// Floats that will remain the child's responsibility to paint should factor into its
// overflow.
@@ -2461,7 +2457,6 @@ LayoutUnit RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool ma
FloatingObject* floatingObject = *childIt;
LayoutUnit logicalBottomForFloat = min(this->logicalBottomForFloat(floatingObject), LayoutUnit::max() - childLogicalTop);
LayoutUnit logicalBottom = childLogicalTop + logicalBottomForFloat;
- lowestFloatLogicalBottom = max(lowestFloatLogicalBottom, logicalBottom);
if (logicalBottom > logicalHeight()) {
// If the object is not in the list, we add it now.
@@ -2500,7 +2495,6 @@ LayoutUnit RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool ma
child->addOverflowFromChild(floatingObject->renderer(), LayoutSize(xPositionForFloatIncludingMargin(floatingObject), yPositionForFloatIncludingMargin(floatingObject)));
}
}
- return lowestFloatLogicalBottom;
}
LayoutUnit RenderBlockFlow::lowestFloatLogicalBottom(FloatingObject::Type floatType) const
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698