<rdar://problem/9513180> REGRESSION (r84166): recalcStyle for display:inline to displ...
[WebKit-https.git] / Source / WebCore / rendering / RenderText.cpp
index 2bbff875cacbdce47c25ef19cda1ccf992475ca2..b92fd6937c4c38ef7beca70c8829bdcac4acb724 100644 (file)
@@ -1367,13 +1367,18 @@ IntRect RenderText::linesVisualOverflowBoundingBox() const
 
 IntRect RenderText::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer)
 {
-    bool repaintContainerSkipped;
-    RenderObject* container = this->container(repaintContainer, &repaintContainerSkipped);
-    // The container may be an ancestor of repaintContainer, but we need to do a repaintContainer-relative repaint.
-    if (repaintContainerSkipped)
+    RenderObject* rendererToRepaint = containingBlock();
+
+    // Do not cross self-painting layer boundaries.
+    RenderObject* enclosingLayerRenderer = enclosingLayer()->renderer();
+    if (enclosingLayerRenderer != rendererToRepaint && !rendererToRepaint->isDescendantOf(enclosingLayerRenderer))
+        rendererToRepaint = enclosingLayerRenderer;
+
+    // The renderer we chose to repaint may be an ancestor of repaintContainer, but we need to do a repaintContainer-relative repaint.
+    if (repaintContainer && repaintContainer != rendererToRepaint && !rendererToRepaint->isDescendantOf(repaintContainer))
         return repaintContainer->clippedOverflowRectForRepaint(repaintContainer);
 
-    return container->clippedOverflowRectForRepaint(repaintContainer);
+    return rendererToRepaint->clippedOverflowRectForRepaint(repaintContainer);
 }
 
 IntRect RenderText::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent)