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

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

Issue 145083009: Remove unnecessary repaint from line layout and cleanup logic (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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') | Source/core/rendering/line/LineLayoutState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlockLineLayout.cpp
diff --git a/Source/core/rendering/RenderBlockLineLayout.cpp b/Source/core/rendering/RenderBlockLineLayout.cpp
index 22ff931054e2311b6c02e5e986a49d12769b2540..063baff61b93f136600c3a0f68a53518e741a950 100644
--- a/Source/core/rendering/RenderBlockLineLayout.cpp
+++ b/Source/core/rendering/RenderBlockLineLayout.cpp
@@ -944,7 +944,7 @@ static void deleteLineRange(LineLayoutState& layoutState, RootInlineBox* startLi
}
}
-void RenderBlockFlow::layoutRunsAndFloats(LineLayoutState& layoutState, bool hasInlineChild)
+void RenderBlockFlow::layoutRunsAndFloats(LineLayoutState& layoutState)
{
// We want to skip ahead to the first dirty line
InlineBidiResolver resolver;
@@ -956,28 +956,6 @@ void RenderBlockFlow::layoutRunsAndFloats(LineLayoutState& layoutState, bool has
consecutiveHyphenatedLines++;
}
- // FIXME: This would make more sense outside of this function, but since
- // determineStartPosition can change the fullLayout flag we have to do this here. Failure to call
- // determineStartPosition first will break fast/repaint/line-flow-with-floats-9.html.
- if (layoutState.isFullLayout() && hasInlineChild && !selfNeedsLayout()) {
- // Mark as needing a full layout to force us to repaint. Allow regions
- // to reflow as needed.
- setNeedsLayout(MarkOnlyThis);
-
- if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) {
- setShouldDoFullRepaintAfterLayout(true);
- } else {
- RenderView* v = view();
- if (v && !v->doingFullRepaint() && hasLayer()) {
- // Because we waited until we were already inside layout to discover
- // that the block really needed a full layout, we missed our chance to repaint the layer
- // before layout started. Luckily the layer has cached the repaint rect for its original
- // position and size, and so we can use that to make a repaint happen now.
- repaintUsingContainer(containerForRepaint(), pixelSnappedIntRect(layer()->repainter().repaintRect()));
- }
- }
- }
-
if (containsFloats())
layoutState.setLastFloat(m_floatingObjects->set().last());
@@ -1555,15 +1533,14 @@ void RenderBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& re
// the replaced elements later. In partial layout mode, line boxes are not
// deleted and only dirtied. In that case, we can layout the replaced
// elements at the same time.
- bool hasInlineChild = false;
Vector<RenderBox*> replacedChildren;
for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) {
RenderObject* o = walker.current();
LayoutRectRecorder recorder(*o, !o->isText());
- if (!hasInlineChild && o->isInline())
- hasInlineChild = true;
+ if (!layoutState.hasInlineChild() && o->isInline())
+ layoutState.setHasInlineChild(true);
if (o->isReplaced() || o->isFloating() || o->isOutOfFlowPositioned()) {
RenderBox* box = toRenderBox(o);
@@ -1594,7 +1571,7 @@ void RenderBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& re
for (size_t i = 0; i < replacedChildren.size(); i++)
replacedChildren[i]->layoutIfNeeded();
- layoutRunsAndFloats(layoutState, hasInlineChild);
+ layoutRunsAndFloats(layoutState);
}
// Expand the last line to accommodate Ruby and emphasis marks.
@@ -1698,6 +1675,10 @@ RootInlineBox* RenderBlockFlow::determineStartPosition(LineLayoutState& layoutSt
}
if (layoutState.isFullLayout()) {
+ // If we encountered a new float and have inline children, mark ourself to force us to repaint.
+ if (layoutState.hasInlineChild() && !selfNeedsLayout())
+ setNeedsLayout(MarkOnlyThis);
ojan 2014/01/28 20:55:23 Why do this instead of calling repaint directly? D
leviw_travelin_and_unemployed 2014/01/28 21:42:31 Perhaps this can be further optimized, but this is
+
// FIXME: This should just call deleteLineBoxTree, but that causes
// crashes for fast/repaint tests.
curr = firstRootBox();
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.h ('k') | Source/core/rendering/line/LineLayoutState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698