WebCore:
authormitz <mitz@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Nov 2007 15:30:23 +0000 (15:30 +0000)
committermitz <mitz@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Nov 2007 15:30:23 +0000 (15:30 +0000)
        Reviewed by Dave Hyatt.

        - fix http://bugs.webkit.org/show_bug.cgi?id=15015
          <rdar://problem/5420308> Most of www.aol.com redraws unnecessarily when headline/photo section changes

        Test: fast/repaint/overflow-clip-subtree-layout.html

        This patch does not address the bigger issue of doing a full relayout
        of inline flows containing floats, but it addresses the problem on
        aol.com, where the changes that trigger layout are confined to an
        overflow area inside the float.

        * page/FrameView.cpp:
        (WebCore::FrameView::scheduleRelayoutOfSubtree): If the new and old
        layout roots are different but one descends from the other, make (or
        keep) the ancestor as the layout root.
        * rendering/RenderObject.cpp:
        (WebCore::objectIsRelayoutBoundary): Made boxes with overflow
        clipping and non-auto width and height relayout boundaries.

LayoutTests:

        Reviewed by Dave Hyatt.

        - repaint test for http://bugs.webkit.org/show_bug.cgi?id=15015
          <rdar://problem/5420308> Most of www.aol.com redraws unnecessarily when headline/photo section changes

        * fast/repaint/overflow-clip-subtree-layout.html: Added.
        * platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.checksum: Added.
        * platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.png: Added.
        * platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/repaint/overflow-clip-subtree-layout.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/page/FrameView.cpp
WebCore/rendering/RenderObject.cpp

index d65b89d1dabc9943bb5c396e1aab07ef2d4887d6..30dac9d0a73a7b0ab03896929300ba9a02a37419 100644 (file)
@@ -1,3 +1,15 @@
+2007-11-01  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        - repaint test for http://bugs.webkit.org/show_bug.cgi?id=15015
+          <rdar://problem/5420308> Most of www.aol.com redraws unnecessarily when headline/photo section changes
+
+        * fast/repaint/overflow-clip-subtree-layout.html: Added.
+        * platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.checksum: Added.
+        * platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.png: Added.
+        * platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.txt: Added.
+
 2007-10-31  Adam Roben  <aroben@apple.com>
 
         Add Windows-specific results for window-properties
diff --git a/LayoutTests/fast/repaint/overflow-clip-subtree-layout.html b/LayoutTests/fast/repaint/overflow-clip-subtree-layout.html
new file mode 100644 (file)
index 0000000..1492f20
--- /dev/null
@@ -0,0 +1,16 @@
+<head>
+    <title>Test for http://bugs.webkit.org/show_bug.cgi?id=15015 rdar://problem/5420308</title>
+    <script src="repaint.js" type="text/javascript"></script>
+    <script>
+        function repaintTest()
+        {
+            document.getElementById("float").appendChild(document.createElement("div"));
+        }
+    </script>
+</head>
+<body onload="runRepaintTest()">
+    <div style="width: 400px; height: 400px; border: solid;">
+        <div id="float" style="float: left; width: 200px; height: 200px; overflow: hidden;">
+        </div>
+    </div>
+</body>
diff --git a/LayoutTests/platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.checksum b/LayoutTests/platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.checksum
new file mode 100644 (file)
index 0000000..b7b1289
--- /dev/null
@@ -0,0 +1 @@
+b280ce644c6513f31f6db01aecc0e0ce
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.png b/LayoutTests/platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.png
new file mode 100644 (file)
index 0000000..dafea81
Binary files /dev/null and b/LayoutTests/platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.txt b/LayoutTests/platform/mac/fast/repaint/overflow-clip-subtree-layout-expected.txt
new file mode 100644 (file)
index 0000000..38be3b7
--- /dev/null
@@ -0,0 +1,9 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 406x406 [border: (3px solid #000000)]
+layer at (11,11) size 200x200
+  RenderBlock (floating) {DIV} at (3,3) size 200x200
+    RenderBlock {DIV} at (0,0) size 200x0
index 569fef31fa23763fe9dd004d16da2f1df9f099d4..6d0f0c58f3d499903495f7ec4297d66109d5a237 100644 (file)
@@ -1,3 +1,25 @@
+2007-11-01  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        - fix http://bugs.webkit.org/show_bug.cgi?id=15015
+          <rdar://problem/5420308> Most of www.aol.com redraws unnecessarily when headline/photo section changes
+
+        Test: fast/repaint/overflow-clip-subtree-layout.html
+
+        This patch does not address the bigger issue of doing a full relayout
+        of inline flows containing floats, but it addresses the problem on
+        aol.com, where the changes that trigger layout are confined to an
+        overflow area inside the float.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scheduleRelayoutOfSubtree): If the new and old
+        layout roots are different but one descends from the other, make (or
+        keep) the ancestor as the layout root.
+        * rendering/RenderObject.cpp:
+        (WebCore::objectIsRelayoutBoundary): Made boxes with overflow
+        clipping and non-auto width and height relayout boundaries.
+
 2007-11-01  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Mark Rowe.
index bafc0a331b097b76115eaf5994d5f447f093790b..5cb86c24c09351096a6d8904d8c5dd3e631038f1 100644 (file)
@@ -729,12 +729,23 @@ void FrameView::scheduleRelayoutOfSubtree(Node* n)
 
     if (layoutPending()) {
         if (d->layoutRoot != n) {
-            // Just do a full relayout
-            if (d->layoutRoot && d->layoutRoot->renderer())
-                d->layoutRoot->renderer()->markContainingBlocksForLayout(false);
-            d->layoutRoot = 0;
-            if (n->renderer())
-                n->renderer()->markContainingBlocksForLayout(false);
+            if (n->isDescendantOf(d->layoutRoot.get())) {
+                // Keep the current root
+                if (n->renderer())
+                    n->renderer()->markContainingBlocksForLayout(false);
+            } else if (d->layoutRoot && d->layoutRoot->isDescendantOf(n)) {
+                // Re-root at n
+                if (d->layoutRoot->renderer())
+                    d->layoutRoot->renderer()->markContainingBlocksForLayout(false);
+                d->layoutRoot = n;
+            } else {
+                // Just do a full relayout
+                if (d->layoutRoot && d->layoutRoot->renderer())
+                    d->layoutRoot->renderer()->markContainingBlocksForLayout(false);
+                d->layoutRoot = 0;
+                if (n->renderer())
+                    n->renderer()->markContainingBlocksForLayout(false);
+            }
         }
     } else {
         int delay = m_frame->document()->minimumLayoutDelay();
index be89ff7e953a7f810e2c23c2b8cde755c93c086c..5ff36ce6e59519174eb1d817cf19ef30b836214a 100644 (file)
@@ -710,6 +710,7 @@ static inline bool objectIsRelayoutBoundary(const RenderObject *obj)
 {
     // FIXME: In future it may be possible to broaden this condition in order to improve performance 
     return obj->isTextField() || obj->isTextArea()
+        || obj->hasOverflowClip() && !obj->style()->width().isIntrinsicOrAuto() && !obj->style()->height().isIntrinsicOrAuto()
 #if ENABLE(SVG)
            || obj->isSVGRoot()
 #endif