Index: Source/core/rendering/RenderBox.cpp |
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp |
index 26c3c3cea75232b49f43bcffdc13ab1ea3f3959f..189368916d3d9085424c6fef1543b4cc79388ea2 100644 |
--- a/Source/core/rendering/RenderBox.cpp |
+++ b/Source/core/rendering/RenderBox.cpp |
@@ -1550,7 +1550,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 |
@@ -1564,21 +1564,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; |
} |
@@ -1603,17 +1603,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) |
@@ -1794,20 +1785,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; |
@@ -1852,9 +1840,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) { |
@@ -1972,17 +1957,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 |
@@ -1993,24 +1978,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()) |
@@ -2079,7 +2060,7 @@ void RenderBox::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* |
return; |
} |
- o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, fixed); |
+ o->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, fixed, invalidationTreeWalkState); |
} |
void RenderBox::invalidatePaintForOverhangingFloats(bool) |