Index: Source/core/rendering/RenderText.cpp |
diff --git a/Source/core/rendering/RenderText.cpp b/Source/core/rendering/RenderText.cpp |
index 1170cddfc7c91f7dbcc921b0c483092966cd6e6f..e00e1c3d279305a62a35779cc7b3a8856686abc1 100644 |
--- a/Source/core/rendering/RenderText.cpp |
+++ b/Source/core/rendering/RenderText.cpp |
@@ -1576,18 +1576,31 @@ LayoutRect RenderText::linesVisualOverflowBoundingBox() const |
LayoutRect RenderText::clippedOverflowRectForPaintInvalidation(const RenderLayerModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState) const |
{ |
- RenderObject* rendererToIssuePaintInvalidations = containingBlock(); |
+ const RenderObject* rendererToIssuePaintInvalidations = containingObjectForPaintInvalidation(); |
+ return rendererToIssuePaintInvalidations->clippedOverflowRectForPaintInvalidation(paintInvalidationContainer, paintInvalidationState); |
+} |
- // Do not cross self-painting layer boundaries. |
- RenderObject* enclosingLayerRenderer = enclosingLayer()->renderer(); |
- if (enclosingLayerRenderer != rendererToIssuePaintInvalidations && !rendererToIssuePaintInvalidations->isDescendantOf(enclosingLayerRenderer)) |
- rendererToIssuePaintInvalidations = enclosingLayerRenderer; |
+const RenderLayerModelObject* RenderText::containingObjectForPaintInvalidation() const |
+{ |
+ RenderLayerModelObject* rendererToIssuePaintInvalidations = containingBlock(); |
- // The renderer we chose to issue paint invalidations may be an ancestor of paintInvalidationContainer, but we need to do a paintInvalidationContainer-relative paint invalidation. |
- if (paintInvalidationContainer && paintInvalidationContainer != rendererToIssuePaintInvalidations && !rendererToIssuePaintInvalidations->isDescendantOf(paintInvalidationContainer)) |
- return paintInvalidationContainer->clippedOverflowRectForPaintInvalidation(paintInvalidationContainer, paintInvalidationState); |
+ // Do not cross self-painting layer boundaries. |
+ RenderLayer* layer = enclosingLayer(); |
+ if (layer) { |
+ RenderLayerModelObject* enclosingLayerRenderer = layer->renderer(); |
+ if (enclosingLayerRenderer != rendererToIssuePaintInvalidations && !rendererToIssuePaintInvalidations->isDescendantOf(enclosingLayerRenderer)) |
+ rendererToIssuePaintInvalidations = enclosingLayerRenderer; |
+ } |
+ return rendererToIssuePaintInvalidations; |
+} |
- return rendererToIssuePaintInvalidations->clippedOverflowRectForPaintInvalidation(paintInvalidationContainer, paintInvalidationState); |
+const RenderLayerModelObject* RenderText::containerForPaintInvalidation() const |
+{ |
+ const RenderObject* rendererToIssuePaintInvalidations = containingObjectForPaintInvalidation(); |
+ if (rendererToIssuePaintInvalidations) |
+ return rendererToIssuePaintInvalidations->containerForPaintInvalidation(); |
+ // This can happen for detached render subtrees. |
+ return 0; |
} |
LayoutRect RenderText::selectionRectForPaintInvalidation(const RenderLayerModelObject* paintInvalidationContainer, bool clipToVisibleContent) |