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

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

Issue 264183002: RAL: Eliminate n^2 walk to find repaint containers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix for SVG Created 6 years, 7 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
Index: Source/core/rendering/RenderBox.cpp
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp
index 11d009accb941707f4c32527d61cc32479d105c8..e23ba02c7f40d851efbe28e2c9ca166d0a294af4 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -1546,7 +1546,7 @@ bool RenderBox::repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer
return false;
}
-void RenderBox::repaintTreeAfterLayout()
+void RenderBox::repaintTreeAfterLayout(RenderLayerModelObject& repaintContainer)
{
// FIXME: Currently only using this logic for RenderBox and its ilk. Ideally, RenderBlockFlows with
// inline children should track a dirty rect in local coordinates for dirty lines instead of repainting
@@ -1561,18 +1561,28 @@ void RenderBox::repaintTreeAfterLayout()
if (!shouldCheckForInvalidationAfterLayout())
return;
+ bool establishesNewRepaintContainer = isRepaintContainer();
+ RenderLayerModelObject& newRepaintContainer = *adjustCompositedContainerForSpecialAncestors(establishesNewRepaintContainer ? this : &repaintContainer);
+ // FIXME: This assert should be re-enabled when we move repaint to after compositing update. crbug.com/360286
+ // ASSERT(&newRepaintContainer == containerForRepaint());
+
const LayoutRect oldRepaintRect = previousRepaintRect();
const LayoutPoint oldPositionFromRepaintContainer = previousPositionFromRepaintContainer();
- RenderLayerModelObject* repaintContainer = containerForRepaint();
- setPreviousRepaintRect(clippedOverflowRectForRepaint(repaintContainer));
- setPreviousPositionFromRepaintContainer(positionFromRepaintContainer(repaintContainer));
+ setPreviousRepaintRect(clippedOverflowRectForRepaint(&newRepaintContainer));
+ setPreviousPositionFromRepaintContainer(positionFromRepaintContainer(&newRepaintContainer));
// If we are set to do a full repaint that means the RenderView will be
// invalidated. We can then skip issuing of invalidations for the child
// renderers as they'll be covered by the RenderView.
if (view()->doingFullRepaint() && this != view()) {
- LayoutStateMaintainer statePusher(*this, isTableRow() ? LayoutSize() : locationOffset());
- RenderObject::repaintTreeAfterLayout();
+ // FIXME: LayoutState should be enabled for other repaint containers than the RenderView. crbug.com/363834
+ if (establishesNewRepaintContainer) {
+ LayoutStateDisabler disabler(*this);
+ RenderObject::repaintTreeAfterLayout(newRepaintContainer);
+ } else {
+ LayoutStateMaintainer statePusher(*this, isTableRow() ? LayoutSize() : locationOffset());
+ RenderObject::repaintTreeAfterLayout(newRepaintContainer);
+ }
return;
}
@@ -1585,7 +1595,7 @@ void RenderBox::repaintTreeAfterLayout()
const LayoutRect& newRepaintRect = previousRepaintRect();
const LayoutPoint& newPositionFromRepaintContainer = previousPositionFromRepaintContainer();
- bool didFullRepaint = repaintAfterLayoutIfNeeded(containerForRepaint(),
+ bool didFullRepaint = repaintAfterLayoutIfNeeded(&newRepaintContainer,
shouldDoFullRepaintAfterLayout(), oldRepaintRect, oldPositionFromRepaintContainer, &newRepaintRect, &newPositionFromRepaintContainer);
if (!didFullRepaint)
@@ -1602,11 +1612,17 @@ void RenderBox::repaintTreeAfterLayout()
}
}
- // FIXME: This concept of a tree walking state for fast lookups should be generalized away from
- // just layout.
- // FIXME: Table rows shouldn't be special-cased.
- LayoutStateMaintainer statePusher(*this, isTableRow() ? LayoutSize() : locationOffset());
- RenderObject::repaintTreeAfterLayout();
+ // FIXME: LayoutState should be enabled for other repaint containers than the RenderView. crbug.com/363834
Julien - ping for review 2014/05/07 17:50:03 I choked on this line but Levi pointed out that we
leviw_travelin_and_unemployed 2014/05/07 17:58:48 As we discussed, I have a plan to fix this (which
+ if (establishesNewRepaintContainer) {
+ LayoutStateDisabler disabler(*this);
+ RenderObject::repaintTreeAfterLayout(newRepaintContainer);
+ } else {
+ // FIXME: This concept of a tree walking state for fast lookups should be generalized away from
+ // just layout.
+ // FIXME: Table rows shouldn't be special-cased.
+ LayoutStateMaintainer statePusher(*this, isTableRow() ? LayoutSize() : locationOffset());
+ RenderObject::repaintTreeAfterLayout(newRepaintContainer);
+ }
}
bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumulatedOffset, ContentsClipBehavior contentsClipBehavior)

Powered by Google App Engine
This is Rietveld 408576698