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

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: With less asserts :( 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 c1e5be5dd91567fc3f2fe9a50c3f3e0474d08727..6f9ef4df2dbed6a9b2c5c46a04a5bc49038f6d76 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(const 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,22 @@ void RenderBox::repaintTreeAfterLayout()
if (!shouldCheckForInvalidationAfterLayout())
return;
+ bool establishesNewRepaintContainer = isRepaintContainer();
+ const 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();
- const 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();
+ RenderObject::repaintTreeAfterLayout(newRepaintContainer);
return;
}
@@ -1585,7 +1589,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 +1606,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
+ 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