<rdar://problem/9513180> REGRESSION (r84166): recalcStyle for display:inline to displ...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 12 Jun 2011 18:27:00 +0000 (18:27 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 12 Jun 2011 18:27:00 +0000 (18:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=61557

Reviewed by Darin Adler.

Replaced the fix for bug 58500 with a refined version.

* rendering/RenderText.cpp:
(WebCore::RenderText::clippedOverflowRectForRepaint): Use the containing block unless it is
across a layer boundary.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@88617 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderText.cpp

index 9cf8e51..de7fc56 100644 (file)
@@ -1,3 +1,16 @@
+2011-06-12  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Darin Adler.
+
+        <rdar://problem/9513180> REGRESSION (r84166): recalcStyle for display:inline to display:none transition has complexity N^2 where N is the number of child Text nodes
+        https://bugs.webkit.org/show_bug.cgi?id=61557
+
+        Replaced the fix for bug 58500 with a refined version.
+
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::clippedOverflowRectForRepaint): Use the containing block unless it is
+        across a layer boundary.
+
 2011-06-12  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Andreas Kling.
index 2bbff87..b92fd69 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)