2010-05-13 Simon Fraser <simon.fraser@apple.com>
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 May 2010 23:14:46 +0000 (23:14 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 May 2010 23:14:46 +0000 (23:14 +0000)
        Reviewed by Dave Hyatt.

        Fix scrolling in composited iframes
        https://bugs.webkit.org/show_bug.cgi?id=39088
        <rdar://problem/7980099>

        When propagating compositing out of iframes, we have to update the position of the iframe content
        layers on scrolling.

        Test: compositing/iframes/scrolling-iframe.html

        * page/FrameView.cpp:
        (WebCore::FrameView::scrollPositionChanged): Call updateContentLayerScrollPosition() when scrolling.

        * rendering/RenderLayerBacking.cpp:
        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Renamed setRootPlatformLayerClippingBox() to updateContentLayerOffset().

        * rendering/RenderLayerCompositor.h:
        * rendering/RenderLayerCompositor.cpp: Rename m_clippingLayer to m_clipLayer to go better with m_scrollLayer.
        (WebCore::RenderLayerCompositor::updateContentLayerOffset): Renamed from setRootPlatformLayerClippingBox().
            Set the size of the clipping layer from the FrameView now, so that scrollbars are not clipped out.
            Update the scroll layer position too.
        (WebCore::RenderLayerCompositor::updateContentLayerScrollPosition): Set the position of the scroll layer
            when the ScrollView is scrolled.
        (WebCore::RenderLayerCompositor::rootPlatformLayer): m_clippingLayer rename.
        (WebCore::RenderLayerCompositor::ensureRootPlatformLayer): m_clippingLayer rename. Also create m_scrollLayer at
            the same time as the clip layer, and clean it up as necessary.
        (WebCore::RenderLayerCompositor::destroyRootPlatformLayer): m_clippingLayer rename, and clean up the m_scrollLayer too.
        (WebCore::RenderLayerCompositor::detachRootPlatformLayer): m_clippingLayer rename

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

17 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/iframes/composited-parent-iframe-expected.txt
LayoutTests/compositing/iframes/connect-compositing-iframe-delayed-expected.txt
LayoutTests/compositing/iframes/connect-compositing-iframe-expected.txt
LayoutTests/compositing/iframes/connect-compositing-iframe2-expected.txt
LayoutTests/compositing/iframes/connect-compositing-iframe3-expected.txt
LayoutTests/compositing/iframes/enter-compositing-iframe-expected.txt
LayoutTests/compositing/iframes/iframe-resize-expected.txt
LayoutTests/compositing/iframes/overlapped-iframe-expected.txt
LayoutTests/compositing/iframes/resources/large-composited-subframe.html [new file with mode: 0644]
LayoutTests/compositing/iframes/scrolling-iframe-expected.txt [new file with mode: 0644]
LayoutTests/compositing/iframes/scrolling-iframe.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/page/FrameView.cpp
WebCore/rendering/RenderLayerBacking.cpp
WebCore/rendering/RenderLayerCompositor.cpp
WebCore/rendering/RenderLayerCompositor.h

index 2b07188..4167982 100644 (file)
@@ -1,3 +1,26 @@
+2010-05-13  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        Fix scrolling in composited iframes
+        https://bugs.webkit.org/show_bug.cgi?id=39088
+        <rdar://problem/7980099>
+        
+        Update test results to account for insertion of new scrolling layer, and for
+        the fix to the clipping layer size.
+
+        * compositing/iframes/composited-parent-iframe-expected.txt:
+        * compositing/iframes/connect-compositing-iframe-delayed-expected.txt:
+        * compositing/iframes/connect-compositing-iframe-expected.txt:
+        * compositing/iframes/connect-compositing-iframe2-expected.txt:
+        * compositing/iframes/connect-compositing-iframe3-expected.txt:
+        * compositing/iframes/enter-compositing-iframe-expected.txt:
+        * compositing/iframes/iframe-resize-expected.txt:
+        * compositing/iframes/overlapped-iframe-expected.txt:
+        * compositing/iframes/resources/large-composited-subframe.html: Added.
+        * compositing/iframes/scrolling-iframe-expected.txt: Added.
+        * compositing/iframes/scrolling-iframe.html: Added.
+
 2010-05-13  Martin Robinson  <mrobinson@igalia.com>
 
         No review. Adding baselines for many of the css1 tests. I've checked these manually.
index b343c9e..45cae04 100644 (file)
@@ -40,7 +40,7 @@
             (GraphicsLayer
               (position 35.00 35.00)
               (anchor 0.50 0.50)
-              (bounds 300.00 150.00)
+              (bounds 285.00 150.00)
               (opacity 1.00)
               (usingTiledLayer 0)
               (preserves3D 0)
@@ -53,7 +53,7 @@
                 (GraphicsLayer
                   (position 0.00 0.00)
                   (anchor 0.50 0.50)
-                  (bounds 285.00 230.00)
+                  (bounds 0.00 0.00)
                   (opacity 1.00)
                   (usingTiledLayer 0)
                   (preserves3D 0)
                       (opacity 1.00)
                       (usingTiledLayer 0)
                       (preserves3D 0)
-                      (drawsContent 1)
+                      (drawsContent 0)
                       (backfaceVisibility visible)
                       (backgroundColor none)
                       (transform identity)
                       (childrenTransform identity)
                       (children 1
                         (GraphicsLayer
-                          (position 18.00 10.00)
+                          (position 0.00 0.00)
                           (anchor 0.50 0.50)
-                          (bounds 210.00 210.00)
+                          (bounds 285.00 230.00)
                           (opacity 1.00)
                           (usingTiledLayer 0)
                           (preserves3D 0)
                           (backgroundColor none)
                           (transform identity)
                           (childrenTransform identity)
+                          (children 1
+                            (GraphicsLayer
+                              (position 18.00 10.00)
+                              (anchor 0.50 0.50)
+                              (bounds 210.00 210.00)
+                              (opacity 1.00)
+                              (usingTiledLayer 0)
+                              (preserves3D 0)
+                              (drawsContent 1)
+                              (backfaceVisibility visible)
+                              (backgroundColor none)
+                              (transform identity)
+                              (childrenTransform identity)
+                            )
+                          )
                         )
                       )
                     )
index 028f967..8363fa8 100644 (file)
@@ -42,7 +42,7 @@ When the parent document becomes composited, the layer trees should get connecte
             (GraphicsLayer
               (position 35.00 35.00)
               (anchor 0.50 0.50)
-              (bounds 300.00 150.00)
+              (bounds 285.00 150.00)
               (opacity 1.00)
               (usingTiledLayer 0)
               (preserves3D 0)
@@ -55,7 +55,7 @@ When the parent document becomes composited, the layer trees should get connecte
                 (GraphicsLayer
                   (position 0.00 0.00)
                   (anchor 0.50 0.50)
-                  (bounds 285.00 230.00)
+                  (bounds 0.00 0.00)
                   (opacity 1.00)
                   (usingTiledLayer 0)
                   (preserves3D 0)
@@ -72,16 +72,16 @@ When the parent document becomes composited, the layer trees should get connecte
                       (opacity 1.00)
                       (usingTiledLayer 0)
                       (preserves3D 0)
-                      (drawsContent 1)
+                      (drawsContent 0)
                       (backfaceVisibility visible)
                       (backgroundColor none)
                       (transform identity)
                       (childrenTransform identity)
                       (children 1
                         (GraphicsLayer
-                          (position 18.00 10.00)
+                          (position 0.00 0.00)
                           (anchor 0.50 0.50)
-                          (bounds 210.00 210.00)
+                          (bounds 285.00 230.00)
                           (opacity 1.00)
                           (usingTiledLayer 0)
                           (preserves3D 0)
@@ -90,6 +90,21 @@ When the parent document becomes composited, the layer trees should get connecte
                           (backgroundColor none)
                           (transform identity)
                           (childrenTransform identity)
+                          (children 1
+                            (GraphicsLayer
+                              (position 18.00 10.00)
+                              (anchor 0.50 0.50)
+                              (bounds 210.00 210.00)
+                              (opacity 1.00)
+                              (usingTiledLayer 0)
+                              (preserves3D 0)
+                              (drawsContent 1)
+                              (backfaceVisibility visible)
+                              (backgroundColor none)
+                              (transform identity)
+                              (childrenTransform identity)
+                            )
+                          )
                         )
                       )
                     )
index 1090c9b..0c0ac16 100644 (file)
@@ -40,7 +40,7 @@
             (GraphicsLayer
               (position 35.00 35.00)
               (anchor 0.50 0.50)
-              (bounds 300.00 150.00)
+              (bounds 285.00 150.00)
               (opacity 1.00)
               (usingTiledLayer 0)
               (preserves3D 0)
@@ -53,7 +53,7 @@
                 (GraphicsLayer
                   (position 0.00 0.00)
                   (anchor 0.50 0.50)
-                  (bounds 285.00 230.00)
+                  (bounds 0.00 0.00)
                   (opacity 1.00)
                   (usingTiledLayer 0)
                   (preserves3D 0)
                       (opacity 1.00)
                       (usingTiledLayer 0)
                       (preserves3D 0)
-                      (drawsContent 1)
+                      (drawsContent 0)
                       (backfaceVisibility visible)
                       (backgroundColor none)
                       (transform identity)
                       (childrenTransform identity)
                       (children 1
                         (GraphicsLayer
-                          (position 18.00 10.00)
+                          (position 0.00 0.00)
                           (anchor 0.50 0.50)
-                          (bounds 210.00 210.00)
+                          (bounds 285.00 230.00)
                           (opacity 1.00)
                           (usingTiledLayer 0)
                           (preserves3D 0)
                           (backgroundColor none)
                           (transform identity)
                           (childrenTransform identity)
+                          (children 1
+                            (GraphicsLayer
+                              (position 18.00 10.00)
+                              (anchor 0.50 0.50)
+                              (bounds 210.00 210.00)
+                              (opacity 1.00)
+                              (usingTiledLayer 0)
+                              (preserves3D 0)
+                              (drawsContent 1)
+                              (backfaceVisibility visible)
+                              (backgroundColor none)
+                              (transform identity)
+                              (childrenTransform identity)
+                            )
+                          )
                         )
                       )
                     )
index 1090c9b..0c0ac16 100644 (file)
@@ -40,7 +40,7 @@
             (GraphicsLayer
               (position 35.00 35.00)
               (anchor 0.50 0.50)
-              (bounds 300.00 150.00)
+              (bounds 285.00 150.00)
               (opacity 1.00)
               (usingTiledLayer 0)
               (preserves3D 0)
@@ -53,7 +53,7 @@
                 (GraphicsLayer
                   (position 0.00 0.00)
                   (anchor 0.50 0.50)
-                  (bounds 285.00 230.00)
+                  (bounds 0.00 0.00)
                   (opacity 1.00)
                   (usingTiledLayer 0)
                   (preserves3D 0)
                       (opacity 1.00)
                       (usingTiledLayer 0)
                       (preserves3D 0)
-                      (drawsContent 1)
+                      (drawsContent 0)
                       (backfaceVisibility visible)
                       (backgroundColor none)
                       (transform identity)
                       (childrenTransform identity)
                       (children 1
                         (GraphicsLayer
-                          (position 18.00 10.00)
+                          (position 0.00 0.00)
                           (anchor 0.50 0.50)
-                          (bounds 210.00 210.00)
+                          (bounds 285.00 230.00)
                           (opacity 1.00)
                           (usingTiledLayer 0)
                           (preserves3D 0)
                           (backgroundColor none)
                           (transform identity)
                           (childrenTransform identity)
+                          (children 1
+                            (GraphicsLayer
+                              (position 18.00 10.00)
+                              (anchor 0.50 0.50)
+                              (bounds 210.00 210.00)
+                              (opacity 1.00)
+                              (usingTiledLayer 0)
+                              (preserves3D 0)
+                              (drawsContent 1)
+                              (backfaceVisibility visible)
+                              (backgroundColor none)
+                              (transform identity)
+                              (childrenTransform identity)
+                            )
+                          )
                         )
                       )
                     )
index 42acf41..bb2bd78 100644 (file)
@@ -40,7 +40,7 @@
             (GraphicsLayer
               (position 35.00 35.00)
               (anchor 0.50 0.50)
-              (bounds 300.00 150.00)
+              (bounds 285.00 150.00)
               (opacity 1.00)
               (usingTiledLayer 0)
               (preserves3D 0)
@@ -53,7 +53,7 @@
                 (GraphicsLayer
                   (position 0.00 0.00)
                   (anchor 0.50 0.50)
-                  (bounds 285.00 230.00)
+                  (bounds 0.00 0.00)
                   (opacity 1.00)
                   (usingTiledLayer 0)
                   (preserves3D 0)
                       (opacity 1.00)
                       (usingTiledLayer 0)
                       (preserves3D 0)
-                      (drawsContent 1)
+                      (drawsContent 0)
                       (backfaceVisibility visible)
                       (backgroundColor none)
                       (transform identity)
                       (childrenTransform identity)
                       (children 1
                         (GraphicsLayer
-                          (position 18.00 10.00)
+                          (position 0.00 0.00)
                           (anchor 0.50 0.50)
-                          (bounds 210.00 210.00)
+                          (bounds 285.00 230.00)
                           (opacity 1.00)
                           (usingTiledLayer 0)
                           (preserves3D 0)
                           (backgroundColor none)
                           (transform identity)
                           (childrenTransform identity)
+                          (children 1
+                            (GraphicsLayer
+                              (position 18.00 10.00)
+                              (anchor 0.50 0.50)
+                              (bounds 210.00 210.00)
+                              (opacity 1.00)
+                              (usingTiledLayer 0)
+                              (preserves3D 0)
+                              (drawsContent 1)
+                              (backfaceVisibility visible)
+                              (backgroundColor none)
+                              (transform identity)
+                              (childrenTransform identity)
+                            )
+                          )
                         )
                       )
                     )
index 1090c9b..0c0ac16 100644 (file)
@@ -40,7 +40,7 @@
             (GraphicsLayer
               (position 35.00 35.00)
               (anchor 0.50 0.50)
-              (bounds 300.00 150.00)
+              (bounds 285.00 150.00)
               (opacity 1.00)
               (usingTiledLayer 0)
               (preserves3D 0)
@@ -53,7 +53,7 @@
                 (GraphicsLayer
                   (position 0.00 0.00)
                   (anchor 0.50 0.50)
-                  (bounds 285.00 230.00)
+                  (bounds 0.00 0.00)
                   (opacity 1.00)
                   (usingTiledLayer 0)
                   (preserves3D 0)
                       (opacity 1.00)
                       (usingTiledLayer 0)
                       (preserves3D 0)
-                      (drawsContent 1)
+                      (drawsContent 0)
                       (backfaceVisibility visible)
                       (backgroundColor none)
                       (transform identity)
                       (childrenTransform identity)
                       (children 1
                         (GraphicsLayer
-                          (position 18.00 10.00)
+                          (position 0.00 0.00)
                           (anchor 0.50 0.50)
-                          (bounds 210.00 210.00)
+                          (bounds 285.00 230.00)
                           (opacity 1.00)
                           (usingTiledLayer 0)
                           (preserves3D 0)
                           (backgroundColor none)
                           (transform identity)
                           (childrenTransform identity)
+                          (children 1
+                            (GraphicsLayer
+                              (position 18.00 10.00)
+                              (anchor 0.50 0.50)
+                              (bounds 210.00 210.00)
+                              (opacity 1.00)
+                              (usingTiledLayer 0)
+                              (preserves3D 0)
+                              (drawsContent 1)
+                              (backfaceVisibility visible)
+                              (backgroundColor none)
+                              (transform identity)
+                              (childrenTransform identity)
+                            )
+                          )
                         )
                       )
                     )
index 1090c9b..0c0ac16 100644 (file)
@@ -40,7 +40,7 @@
             (GraphicsLayer
               (position 35.00 35.00)
               (anchor 0.50 0.50)
-              (bounds 300.00 150.00)
+              (bounds 285.00 150.00)
               (opacity 1.00)
               (usingTiledLayer 0)
               (preserves3D 0)
@@ -53,7 +53,7 @@
                 (GraphicsLayer
                   (position 0.00 0.00)
                   (anchor 0.50 0.50)
-                  (bounds 285.00 230.00)
+                  (bounds 0.00 0.00)
                   (opacity 1.00)
                   (usingTiledLayer 0)
                   (preserves3D 0)
                       (opacity 1.00)
                       (usingTiledLayer 0)
                       (preserves3D 0)
-                      (drawsContent 1)
+                      (drawsContent 0)
                       (backfaceVisibility visible)
                       (backgroundColor none)
                       (transform identity)
                       (childrenTransform identity)
                       (children 1
                         (GraphicsLayer
-                          (position 18.00 10.00)
+                          (position 0.00 0.00)
                           (anchor 0.50 0.50)
-                          (bounds 210.00 210.00)
+                          (bounds 285.00 230.00)
                           (opacity 1.00)
                           (usingTiledLayer 0)
                           (preserves3D 0)
                           (backgroundColor none)
                           (transform identity)
                           (childrenTransform identity)
+                          (children 1
+                            (GraphicsLayer
+                              (position 18.00 10.00)
+                              (anchor 0.50 0.50)
+                              (bounds 210.00 210.00)
+                              (opacity 1.00)
+                              (usingTiledLayer 0)
+                              (preserves3D 0)
+                              (drawsContent 1)
+                              (backfaceVisibility visible)
+                              (backgroundColor none)
+                              (transform identity)
+                              (childrenTransform identity)
+                            )
+                          )
                         )
                       )
                     )
index 1090c9b..0c0ac16 100644 (file)
@@ -40,7 +40,7 @@
             (GraphicsLayer
               (position 35.00 35.00)
               (anchor 0.50 0.50)
-              (bounds 300.00 150.00)
+              (bounds 285.00 150.00)
               (opacity 1.00)
               (usingTiledLayer 0)
               (preserves3D 0)
@@ -53,7 +53,7 @@
                 (GraphicsLayer
                   (position 0.00 0.00)
                   (anchor 0.50 0.50)
-                  (bounds 285.00 230.00)
+                  (bounds 0.00 0.00)
                   (opacity 1.00)
                   (usingTiledLayer 0)
                   (preserves3D 0)
                       (opacity 1.00)
                       (usingTiledLayer 0)
                       (preserves3D 0)
-                      (drawsContent 1)
+                      (drawsContent 0)
                       (backfaceVisibility visible)
                       (backgroundColor none)
                       (transform identity)
                       (childrenTransform identity)
                       (children 1
                         (GraphicsLayer
-                          (position 18.00 10.00)
+                          (position 0.00 0.00)
                           (anchor 0.50 0.50)
-                          (bounds 210.00 210.00)
+                          (bounds 285.00 230.00)
                           (opacity 1.00)
                           (usingTiledLayer 0)
                           (preserves3D 0)
                           (backgroundColor none)
                           (transform identity)
                           (childrenTransform identity)
+                          (children 1
+                            (GraphicsLayer
+                              (position 18.00 10.00)
+                              (anchor 0.50 0.50)
+                              (bounds 210.00 210.00)
+                              (opacity 1.00)
+                              (usingTiledLayer 0)
+                              (preserves3D 0)
+                              (drawsContent 1)
+                              (backfaceVisibility visible)
+                              (backgroundColor none)
+                              (transform identity)
+                              (childrenTransform identity)
+                            )
+                          )
                         )
                       )
                     )
diff --git a/LayoutTests/compositing/iframes/resources/large-composited-subframe.html b/LayoutTests/compositing/iframes/resources/large-composited-subframe.html
new file mode 100644 (file)
index 0000000..489890b
--- /dev/null
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style type="text/css" media="screen">
+    body {
+      height: 500px;
+      width: 500px;
+      background-color: silver;
+    }
+    
+    .box {
+      height: 200px;
+      width: 200px;
+      margin: 100px;
+      background-color: blue;
+      -webkit-transform: translateZ(0);
+    }
+    .box:hover {
+      -webkit-transform: none;
+    }
+  </style>
+</head>
+<body>
+
+    <div id="iframe-content" class="box">
+    </div>
+
+</body>
+</html>
diff --git a/LayoutTests/compositing/iframes/scrolling-iframe-expected.txt b/LayoutTests/compositing/iframes/scrolling-iframe-expected.txt
new file mode 100644 (file)
index 0000000..cc33a6a
--- /dev/null
@@ -0,0 +1,132 @@
+
+(GraphicsLayer
+  (position 0.00 0.00)
+  (anchor 0.50 0.50)
+  (bounds 800.00 600.00)
+  (opacity 1.00)
+  (usingTiledLayer 0)
+  (preserves3D 0)
+  (drawsContent 0)
+  (backfaceVisibility visible)
+  (backgroundColor none)
+  (transform identity)
+  (children 1
+    (GraphicsLayer
+      (position 0.00 0.00)
+      (anchor 0.50 0.50)
+      (bounds 800.00 600.00)
+      (opacity 1.00)
+      (usingTiledLayer 0)
+      (preserves3D 0)
+      (drawsContent 0)
+      (backfaceVisibility visible)
+      (backgroundColor none)
+      (transform identity)
+      (childrenTransform identity)
+      (children 2
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (anchor 0.50 0.50)
+          (bounds 370.00 220.00)
+          (opacity 1.00)
+          (usingTiledLayer 0)
+          (preserves3D 0)
+          (drawsContent 1)
+          (backfaceVisibility visible)
+          (backgroundColor none)
+          (transform identity)
+          (childrenTransform identity)
+          (children 1
+            (GraphicsLayer
+              (position 35.00 35.00)
+              (anchor 0.50 0.50)
+              (bounds 285.00 135.00)
+              (opacity 1.00)
+              (usingTiledLayer 0)
+              (preserves3D 0)
+              (drawsContent 0)
+              (backfaceVisibility visible)
+              (backgroundColor none)
+              (transform identity)
+              (childrenTransform identity)
+              (children 1
+                (GraphicsLayer
+                  (position -80.00 -80.00)
+                  (anchor 0.50 0.50)
+                  (bounds 0.00 0.00)
+                  (opacity 1.00)
+                  (usingTiledLayer 0)
+                  (preserves3D 0)
+                  (drawsContent 0)
+                  (backfaceVisibility visible)
+                  (backgroundColor none)
+                  (transform identity)
+                  (childrenTransform identity)
+                  (children 1
+                    (GraphicsLayer
+                      (position 0.00 0.00)
+                      (anchor 0.50 0.50)
+                      (bounds 508.00 608.00)
+                      (opacity 1.00)
+                      (usingTiledLayer 0)
+                      (preserves3D 0)
+                      (drawsContent 0)
+                      (backfaceVisibility visible)
+                      (backgroundColor none)
+                      (transform identity)
+                      (childrenTransform identity)
+                      (children 1
+                        (GraphicsLayer
+                          (position 0.00 0.00)
+                          (anchor 0.50 0.50)
+                          (bounds 508.00 608.00)
+                          (opacity 1.00)
+                          (usingTiledLayer 0)
+                          (preserves3D 0)
+                          (drawsContent 1)
+                          (backfaceVisibility visible)
+                          (backgroundColor none)
+                          (transform identity)
+                          (childrenTransform identity)
+                          (children 1
+                            (GraphicsLayer
+                              (position 108.00 100.00)
+                              (anchor 0.50 0.50)
+                              (bounds 200.00 200.00)
+                              (opacity 1.00)
+                              (usingTiledLayer 0)
+                              (preserves3D 0)
+                              (drawsContent 1)
+                              (backfaceVisibility visible)
+                              (backgroundColor none)
+                              (transform identity)
+                              (childrenTransform identity)
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 5.00 5.00)
+          (anchor 0.50 0.50)
+          (bounds 50.00 50.00)
+          (opacity 1.00)
+          (usingTiledLayer 0)
+          (preserves3D 0)
+          (drawsContent 1)
+          (backfaceVisibility visible)
+          (backgroundColor none)
+          (transform identity)
+          (childrenTransform identity)
+        )
+      )
+    )
+  )
+)
+
diff --git a/LayoutTests/compositing/iframes/scrolling-iframe.html b/LayoutTests/compositing/iframes/scrolling-iframe.html
new file mode 100644 (file)
index 0000000..a36e8e7
--- /dev/null
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style type="text/css" media="screen">
+    iframe {
+        border: 10px solid black;
+        padding: 5px;
+        margin: 20px;
+        height: 150px;
+        width: 300px;
+        -webkit-box-shadow: 0 0 20px black;
+    }
+    
+    .overlay {
+      position: absolute;
+      width: 50px;
+      height: 50px;
+      top: 5px;
+      left: 5px;
+      background-color: rgba(0, 0, 0, 0.2);
+    }
+    
+  </style>
+  <script type="text/javascript" charset="utf-8">
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+
+    var loadedCount = 0;
+    
+    function frameLoaded()
+    {
+      if (++loadedCount == 2)
+        doTest();
+    }
+
+    function pageLoaded()
+    {
+      if (++loadedCount == 2)
+        doTest();
+    }
+    
+    function doTest()
+    {
+        // Need to wait for compositing layers to be updated.
+        window.setTimeout(function() {
+            document.getElementById('parent-iframe').contentWindow.scrollTo(80, 80);
+            if (window.layoutTestController) {
+                document.getElementById('layers').innerHTML = layoutTestController.layerTreeAsText();
+                layoutTestController.notifyDone();
+            }
+        }, 10);
+    }
+    
+    window.addEventListener('load', pageLoaded, false);
+  </script>
+</head>
+<body>
+
+    <!-- Test scrolling in the iframe -->
+    <iframe id="parent-iframe" src="resources/large-composited-subframe.html" onload="frameLoaded()"></iframe>
+    
+    <div class="overlay">
+    </div>
+
+    <pre id="layers">Layer tree appears here in DRT.</pre>
+</body>
+</html>
index eb8bbf8..4f840e8 100644 (file)
@@ -1,3 +1,35 @@
+2010-05-13  Simon Fraser  <simon.fraser@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        Fix scrolling in composited iframes
+        https://bugs.webkit.org/show_bug.cgi?id=39088
+        <rdar://problem/7980099>
+        
+        When propagating compositing out of iframes, we have to update the position of the iframe content
+        layers on scrolling.
+
+        Test: compositing/iframes/scrolling-iframe.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scrollPositionChanged): Call updateContentLayerScrollPosition() when scrolling.
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Renamed setRootPlatformLayerClippingBox() to updateContentLayerOffset().
+
+        * rendering/RenderLayerCompositor.h:
+        * rendering/RenderLayerCompositor.cpp: Rename m_clippingLayer to m_clipLayer to go better with m_scrollLayer.
+        (WebCore::RenderLayerCompositor::updateContentLayerOffset): Renamed from setRootPlatformLayerClippingBox().
+            Set the size of the clipping layer from the FrameView now, so that scrollbars are not clipped out.
+            Update the scroll layer position too.
+        (WebCore::RenderLayerCompositor::updateContentLayerScrollPosition): Set the position of the scroll layer
+            when the ScrollView is scrolled.
+        (WebCore::RenderLayerCompositor::rootPlatformLayer): m_clippingLayer rename.
+        (WebCore::RenderLayerCompositor::ensureRootPlatformLayer): m_clippingLayer rename. Also create m_scrollLayer at
+            the same time as the clip layer, and clean it up as necessary.
+        (WebCore::RenderLayerCompositor::destroyRootPlatformLayer): m_clippingLayer rename, and clean up the m_scrollLayer too.
+        (WebCore::RenderLayerCompositor::detachRootPlatformLayer): m_clippingLayer rename
+
 2010-05-13  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Anders Carlsson.
index b1c5865..6d49d06 100644 (file)
@@ -1047,6 +1047,13 @@ void FrameView::scrollPositionChanged()
 #endif
         }
     }
+
+#if USE(ACCELERATED_COMPOSITING)
+    if (RenderView* root = m_frame->contentRenderer()) {
+        if (root->usesCompositing())
+            root->compositor()->updateContentLayerScrollPosition(scrollPosition());
+    }
+#endif
 }
 
 HostWindow* FrameView::hostWindow() const
index 310a9c2..4957265 100644 (file)
@@ -393,7 +393,7 @@ void RenderLayerBacking::updateGraphicsLayerGeometry()
     // If this is an iframe parent, update the iframe content's box
     if (renderer()->isRenderIFrame()) {
         if (RenderLayerCompositor* innerCompositor = RenderLayerCompositor::iframeContentsCompositor(toRenderIFrame(renderer())))
-            innerCompositor->setRootPlatformLayerClippingBox(contentsBox());
+            innerCompositor->updateContentLayerOffset(contentsBox().location());
     }
 }
 
index 10bf375..40bfd7b 100644 (file)
@@ -774,14 +774,24 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, cons
     }
 }
 
-void RenderLayerCompositor::setRootPlatformLayerClippingBox(const IntRect& contentsBox)
+void RenderLayerCompositor::updateContentLayerOffset(const IntPoint& contentsOffset)
 {
-    if (m_clippingLayer) {
-        m_clippingLayer->setPosition(FloatPoint(contentsBox.x(), contentsBox.y()));
-        m_clippingLayer->setSize(FloatSize(contentsBox.width(), contentsBox.height()));
+    if (m_clipLayer) {
+        FrameView* frameView = m_renderView->frameView();
+        m_clipLayer->setPosition(contentsOffset);
+        m_clipLayer->setSize(FloatSize(frameView->layoutWidth(), frameView->layoutHeight()));
+
+        IntPoint scrollPosition = frameView->scrollPosition();
+        m_scrollLayer->setPosition(FloatPoint(-scrollPosition.x(), -scrollPosition.y()));
     }
 }
 
+void RenderLayerCompositor::updateContentLayerScrollPosition(const IntPoint& scrollPosition)
+{
+    if (m_scrollLayer)
+        m_scrollLayer->setPosition(FloatPoint(-scrollPosition.x(), -scrollPosition.y()));
+}
+
 RenderLayerCompositor* RenderLayerCompositor::iframeContentsCompositor(RenderIFrame* renderer)
 {
     HTMLIFrameElement* element = static_cast<HTMLIFrameElement*>(renderer->node());
@@ -965,7 +975,7 @@ RenderLayer* RenderLayerCompositor::rootRenderLayer() const
 
 GraphicsLayer* RenderLayerCompositor::rootPlatformLayer() const
 {
-    return m_clippingLayer ? m_clippingLayer.get() : m_rootPlatformLayer.get();
+    return m_clipLayer ? m_clipLayer.get() : m_rootPlatformLayer.get();
 }
 
 void RenderLayerCompositor::didMoveOnscreen()
@@ -1237,19 +1247,32 @@ void RenderLayerCompositor::ensureRootPlatformLayer()
     m_rootPlatformLayer->setGeometryOrientation(expectedAttachment == RootLayerAttachedViaEnclosingIframe ? GraphicsLayer::CompositingCoordinatesTopDown : GraphicsLayer::compositingCoordinatesOrientation());
     
     if (expectedAttachment == RootLayerAttachedViaEnclosingIframe) {
-        if (!m_clippingLayer) {
+        if (!m_clipLayer) {
+            ASSERT(!m_scrollLayer);
             // Create a clipping layer if this is an iframe
-            m_clippingLayer = GraphicsLayer::create(0);
+            m_clipLayer = GraphicsLayer::create(0);
+#ifndef NDEBUG
+            m_clipLayer->setName("iframe Clipping");
+#endif
+            m_clipLayer->setMasksToBounds(true);
+            
+            m_scrollLayer = GraphicsLayer::create(0);
 #ifndef NDEBUG
-            m_clippingLayer->setName("iframe Clipping");
+            m_scrollLayer->setName("iframe scrolling");
 #endif
-            m_clippingLayer->setMasksToBounds(true);
-            m_clippingLayer->addChild(m_rootPlatformLayer.get());
+            // Hook them up
+            m_clipLayer->addChild(m_scrollLayer.get());
+            m_scrollLayer->addChild(m_rootPlatformLayer.get());
+            
+            updateContentLayerScrollPosition(m_renderView->frameView()->scrollPosition());
         }
-    } else if (m_clippingLayer) {
-        m_clippingLayer->removeAllChildren();
-        m_clippingLayer->removeFromParent();
-        m_clippingLayer = 0;
+    } else if (m_clipLayer) {
+        m_clipLayer->removeAllChildren();
+        m_clipLayer->removeFromParent();
+        m_clipLayer = 0;
+        
+        m_scrollLayer->removeAllChildren();
+        m_scrollLayer = 0;
     }
 
     // Check to see if we have to change the attachment
@@ -1265,10 +1288,14 @@ void RenderLayerCompositor::destroyRootPlatformLayer()
         return;
 
     detachRootPlatformLayer();
-    if (m_clippingLayer) {
-        m_clippingLayer->removeAllChildren();
-        m_clippingLayer = 0;
+    if (m_clipLayer) {
+        m_clipLayer->removeAllChildren();
+        m_clipLayer = 0;
+        
+        m_scrollLayer->removeAllChildren();
+        m_scrollLayer = 0;
     }
+    ASSERT(!m_scrollLayer);
     m_rootPlatformLayer = 0;
 }
 
@@ -1311,8 +1338,8 @@ void RenderLayerCompositor::detachRootPlatformLayer()
         case RootLayerAttachedViaEnclosingIframe: {
             // The layer will get unhooked up via RenderLayerBacking::updateGraphicsLayerConfiguration()
             // for the iframe's renderer in the parent document.
-            if (m_clippingLayer)
-                m_clippingLayer->removeFromParent();
+            if (m_clipLayer)
+                m_clipLayer->removeFromParent();
             else
                 m_rootPlatformLayer->removeFromParent();
 
index 12a6264..e9e4b3c 100644 (file)
@@ -156,7 +156,9 @@ public:
     // Return true if the layers changed.
     static bool parentIFrameContentLayers(RenderIFrame*);
 
-    void setRootPlatformLayerClippingBox(const IntRect& contentsBox);
+    // Update the geometry of the layers used for clipping and scrolling in frames.
+    void updateContentLayerOffset(const IntPoint& contentsOffset);
+    void updateContentLayerScrollPosition(const IntPoint&);
 
 private:
     // Whether the given RL needs a compositing layer.
@@ -223,7 +225,8 @@ private:
     RootLayerAttachment m_rootLayerAttachment;
 
     // Enclosing clipping layer for iframe content
-    OwnPtr<GraphicsLayer> m_clippingLayer;
+    OwnPtr<GraphicsLayer> m_clipLayer;
+    OwnPtr<GraphicsLayer> m_scrollLayer;
     
 #if PROFILE_LAYER_REBUILD
     int m_rootLayerUpdateCount;