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

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

Issue 360833002: Divorce PaintInvalidationState from LayoutState (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ToT-Ed again :) Created 6 years, 6 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 ad1a31ceef9916a6655be919812bd271853e51b1..71deeb01561e1316d95f0c3a667b29add419e701 100644
--- a/Source/core/rendering/RenderBox.cpp
+++ b/Source/core/rendering/RenderBox.cpp
@@ -1545,7 +1545,7 @@ bool RenderBox::repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer
return false;
}
-void RenderBox::invalidateTreeAfterLayout(const RenderLayerModelObject& paintInvalidationContainer)
+void RenderBox::invalidateTreeAfterLayout(const InvalidationTreeWalkState& invalidationTreeWalkState)
{
// 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 invalidating
@@ -1559,21 +1559,21 @@ void RenderBox::invalidateTreeAfterLayout(const RenderLayerModelObject& paintInv
return;
bool establishesNewPaintInvalidationContainer = isPaintInvalidationContainer();
- const RenderLayerModelObject& newPaintInvalidationContainer = *adjustCompositedContainerForSpecialAncestors(establishesNewPaintInvalidationContainer ? this : &paintInvalidationContainer);
+ const RenderLayerModelObject& newPaintInvalidationContainer = *adjustCompositedContainerForSpecialAncestors(establishesNewPaintInvalidationContainer ? this : &invalidationTreeWalkState.paintInvalidationContainer());
// FIXME: This assert should be re-enabled when we move paint invalidation to after compositing update. crbug.com/360286
// ASSERT(&newPaintInvalidationContainer == containerForPaintInvalidation());
const LayoutRect oldPaintInvalidationRect = previousPaintInvalidationRect();
const LayoutPoint oldPositionFromPaintInvalidationContainer = previousPositionFromPaintInvalidationContainer();
- setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(&newPaintInvalidationContainer));
- setPreviousPositionFromPaintInvalidationContainer(RenderLayer::positionFromPaintInvalidationContainer(this, &newPaintInvalidationContainer));
+ setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(&newPaintInvalidationContainer, &invalidationTreeWalkState));
+ setPreviousPositionFromPaintInvalidationContainer(RenderLayer::positionFromPaintInvalidationContainer(this, &newPaintInvalidationContainer, &invalidationTreeWalkState));
// If we are set to do a full paint invalidation that means the RenderView will be
// issue paint invalidations. We can then skip issuing of paint invalidations for the child
// renderers as they'll be covered by the RenderView.
if (view()->doingFullRepaint()) {
- LayoutState state(*this, isTableRow() ? LayoutSize() : locationOffset());
- RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer);
+ InvalidationTreeWalkState childTreeWalkState(invalidationTreeWalkState, *this, newPaintInvalidationContainer);
+ RenderObject::invalidateTreeAfterLayout(childTreeWalkState);
return;
}
@@ -1598,17 +1598,8 @@ void RenderBox::invalidateTreeAfterLayout(const RenderLayerModelObject& paintInv
}
}
- // FIXME: LayoutState should be enabled for other paint invalidation containers than the RenderView. crbug.com/363834
- if (establishesNewPaintInvalidationContainer && !isRenderView()) {
- ForceHorriblySlowRectMapping slowRectMapping(*this);
- RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer);
- } 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.
- LayoutState state(*this, isTableRow() ? LayoutSize() : locationOffset());
- RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer);
- }
+ InvalidationTreeWalkState childTreeWalkState(invalidationTreeWalkState, *this, newPaintInvalidationContainer);
+ RenderObject::invalidateTreeAfterLayout(childTreeWalkState);
}
bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumulatedOffset, ContentsClipBehavior contentsClipBehavior)
@@ -1789,20 +1780,17 @@ LayoutUnit RenderBox::perpendicularContainingBlockLogicalHeight() const
return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.value());
}
-void RenderBox::mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const
+void RenderBox::mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const InvalidationTreeWalkState* invalidationTreeWalkState) const
{
if (repaintContainer == this)
return;
- if (RenderView* v = view()) {
- if (v->canMapUsingLayoutStateForContainer(repaintContainer)) {
- LayoutState* layoutState = v->layoutState();
- LayoutSize offset = layoutState->paintOffset() + locationOffset();
- if (style()->hasInFlowPosition() && layer())
- offset += layer()->offsetForInFlowPosition();
- transformState.move(offset);
- return;
- }
+ if (invalidationTreeWalkState && invalidationTreeWalkState->canMapToContainer(repaintContainer)) {
+ LayoutSize offset = invalidationTreeWalkState->paintOffset() + locationOffset();
+ if (style()->hasInFlowPosition() && layer())
+ offset += layer()->offsetForInFlowPosition();
+ transformState.move(offset);
+ return;
}
bool containerSkipped;
@@ -1847,9 +1835,6 @@ void RenderBox::mapLocalToContainer(const RenderLayerModelObject* repaintContain
void RenderBox::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState& transformState) const
{
- // We don't expect to be called during layout.
- ASSERT(!view() || !view()->layoutStateCachedOffsetsEnabled());
-
bool isFixedPos = style()->position() == FixedPosition;
bool hasTransform = hasLayer() && layer()->transform();
if (hasTransform && !isFixedPos) {
@@ -1967,17 +1952,17 @@ void RenderBox::deleteLineBoxWrapper()
}
}
-LayoutRect RenderBox::clippedOverflowRectForPaintInvalidation(const RenderLayerModelObject* paintInvalidationContainer) const
+LayoutRect RenderBox::clippedOverflowRectForPaintInvalidation(const RenderLayerModelObject* paintInvalidationContainer, const InvalidationTreeWalkState* invalidationTreeWalkState) const
{
if (style()->visibility() != VISIBLE && enclosingLayer()->subtreeIsInvisible())
return LayoutRect();
LayoutRect r = visualOverflowRect();
- mapRectToPaintInvalidationBacking(paintInvalidationContainer, r);
+ mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, invalidationTreeWalkState);
return r;
}
-void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, bool fixed) const
+void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, bool fixed, const InvalidationTreeWalkState* invalidationTreeWalkState) const
{
// The rect we compute at each step is shifted by our x/y offset in the parent container's coordinate space.
// Only when we cross a writing mode boundary will we have to possibly flipForWritingMode (to convert into a more appropriate
@@ -1988,24 +1973,20 @@ void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
// physical when we hit a paintInvalidationContainer boundary. Therefore the final rect returned is always in the
// physical coordinate space of the paintInvalidationContainer.
RenderStyle* styleToUse = style();
- if (RenderView* v = view()) {
- // LayoutState is only valid for root-relative, non-fixed position repainting
- if (v->canMapUsingLayoutStateForContainer(paintInvalidationContainer) && styleToUse->position() != FixedPosition) {
- LayoutState* layoutState = v->layoutState();
-
- if (layer() && layer()->transform())
- rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect));
-
- // We can't trust the bits on RenderObject, because this might be called while re-resolving style.
- if (styleToUse->hasInFlowPosition() && layer())
- rect.move(layer()->offsetForInFlowPosition());
-
- rect.moveBy(location());
- rect.move(layoutState->paintOffset());
- if (layoutState->isClipped())
- rect.intersect(layoutState->clipRect());
- return;
- }
+
+ if (invalidationTreeWalkState && invalidationTreeWalkState->canMapToContainer(paintInvalidationContainer) && styleToUse->position() != FixedPosition) {
+ if (layer() && layer()->transform())
+ rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect));
+
+ // We can't trust the bits on RenderObject, because this might be called while re-resolving style.
+ if (styleToUse->hasInFlowPosition() && layer())
+ rect.move(layer()->offsetForInFlowPosition());
+
+ rect.moveBy(location());
+ rect.move(invalidationTreeWalkState->paintOffset());
+ if (invalidationTreeWalkState->isClipped())
+ rect.intersect(invalidationTreeWalkState->clipRect());
+ return;
}
if (hasReflection())
@@ -2074,7 +2055,7 @@ void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
return;
}
- o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, fixed);
+ o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, fixed, invalidationTreeWalkState);
}
void RenderBox::invalidatePaintForOverhangingFloats(bool)

Powered by Google App Engine
This is Rietveld 408576698