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

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

Issue 544743003: Clean up paint invalidation container logic for RenderText. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed Created 6 years, 3 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
« no previous file with comments | « Source/core/rendering/RenderText.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « Source/core/rendering/RenderText.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698