Title: [171250] trunk
Revision
171250
Author
[email protected]
Date
2014-07-18 17:00:52 -0700 (Fri, 18 Jul 2014)

Log Message

[iOS WK2] position:fixed in iframes with programmatic scroll could end up in the wrong place
https://bugs.webkit.org/show_bug.cgi?id=135078

Source/WebCore:
<rdar://problem/17401823>

Reviewed by Tim Horton.

When the UI-side scrolling tree receives a requested scroll position update, it scrolls
the node (e.g. a frame) then traverses child nodes to update them, e.g. for fixed position.
However, we would always use a viewport rect for the main document (from the scrolling tree),
which is not appropriate for subframes. Subframes should just use their own visible
rect to position fixed children.

Test: platform/mac-wk2/tiled-drawing/scrolling/frames/fixed-inside-frame.html

* page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
(WebCore::ScrollingTreeFrameScrollingNodeIOS::updateChildNodesAfterScroll):

Source/WebKit2:
<rdar://problem/17401823>

Reviewed by Tim Horton.

Fix the logging of requested scroll position and frame scale factor.

* Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
(WebKit::RemoteScrollingTreeTextStream::dump):

LayoutTests:

Reviewed by Tim Horton.

Test with position:fixed inside an iframe that scrolls programmatically.

* platform/mac-wk2/tiled-drawing/scrolling/frames/fixed-inside-frame-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/scrolling/frames/fixed-inside-frame.html: Added.
* platform/mac-wk2/tiled-drawing/scrolling/frames/resources/autoscrolling-frame-with-fixed.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (171249 => 171250)


--- trunk/LayoutTests/ChangeLog	2014-07-18 23:57:40 UTC (rev 171249)
+++ trunk/LayoutTests/ChangeLog	2014-07-19 00:00:52 UTC (rev 171250)
@@ -1,3 +1,16 @@
+2014-07-18  Simon Fraser  <[email protected]>
+
+        [iOS WK2] position:fixed in iframes with programmatic scroll could end up in the wrong place
+        https://bugs.webkit.org/show_bug.cgi?id=135078
+
+        Reviewed by Tim Horton.
+        
+        Test with position:fixed inside an iframe that scrolls programmatically.
+
+        * platform/mac-wk2/tiled-drawing/scrolling/frames/fixed-inside-frame-expected.txt: Added.
+        * platform/mac-wk2/tiled-drawing/scrolling/frames/fixed-inside-frame.html: Added.
+        * platform/mac-wk2/tiled-drawing/scrolling/frames/resources/autoscrolling-frame-with-fixed.html: Added.
+
 2014-07-18  Alexey Proskuryakov  <[email protected]>
 
         media/video-seek-with-negative-playback.html is flaky on Mac

Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/fixed-inside-frame-expected.txt (0 => 171250)


--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/fixed-inside-frame-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/fixed-inside-frame-expected.txt	2014-07-19 00:00:52 UTC (rev 171250)
@@ -0,0 +1,75 @@
+
+(Frame scrolling node
+  (scrollable area size 785 600)
+  (contents size 785 657)
+  (non-fast-scrollable region
+    at (110,110) size 462x400)
+  (children 1
+    (Frame scrolling node
+      (scrollable area size 446 400)
+      (contents size 446 1016)
+      (requested scroll position 0 120)
+      (children 1
+        (Fixed node
+          (anchor edges: AnchorEdgeLeft AnchorEdgeTop)
+          (viewport rect at last layout: 0.00 120.00 446.00 400.00)
+          (layer position at last layout 10.00 130.00)
+        )
+      )
+    )
+  )
+)
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 785.00 657.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 657.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 80.00 80.00)
+          (bounds 522.00 460.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 30.00 30.00)
+              (children 1
+                (GraphicsLayer
+                  (anchor 0.00 0.00)
+                  (bounds 446.00 400.00)
+                  (children 1
+                    (GraphicsLayer
+                      (position 0.00 -120.00)
+                      (children 1
+                        (GraphicsLayer
+                          (anchor 0.00 0.00)
+                          (bounds 446.00 1016.00)
+                          (children 1
+                            (GraphicsLayer
+                              (bounds 446.00 1016.00)
+                              (drawsContent 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (position 10.00 130.00)
+                                  (bounds 436.00 100.00)
+                                  (contentsOpaque 1)
+                                  (drawsContent 1)
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/fixed-inside-frame.html (0 => 171250)


--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/fixed-inside-frame.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/fixed-inside-frame.html	2014-07-19 00:00:52 UTC (rev 171250)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        iframe {
+            height: 400px;
+            width: 60%;
+            margin: 100px;
+            box-shadow: 0 0 20px black;
+        }
+        
+    </style>
+    <script>
+        if (window.testRunner) {
+            testRunner.waitUntilDone();
+            testRunner.dumpAsText();
+            window.internals.settings.setScrollingTreeIncludesFrames(true);
+        }
+
+        function frameDidChange()
+        {
+            window.setTimeout(function() {
+                if (window.testRunner) {
+                    var scrollingTree = internals.scrollingStateTreeAsText();
+                    var layerTree = internals.layerTreeAsText(document);
+                    
+                    var resultElement = document.getElementById('result');
+                    resultElement.textContent = scrollingTree + layerTree;
+                    
+                    testRunner.notifyDone();
+                }
+            }, 0);
+        }
+    </script>
+</head>
+<body>
+    <iframe src="" height="300" scrolling="yes"></iframe>
+<pre id="result">Results</pre>
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/autoscrolling-frame-with-fixed.html (0 => 171250)


--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/autoscrolling-frame-with-fixed.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/autoscrolling-frame-with-fixed.html	2014-07-19 00:00:52 UTC (rev 171250)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            height: 1000px;
+            background-image: repeating-linear-gradient(to bottom, silver, white 100px);
+        }
+
+        .fixed {
+            position: fixed;
+            left: 10px;
+            width: 600px;
+            top: 10px;
+            height: 100px;
+            background-color: gray;
+        }
+    </style>
+    <script>
+        function doScroll()
+        {
+            window.setTimeout(function() {
+                document.body.scrollTop = 120;
+                window.parent.frameDidChange();
+            }, 0);
+        }
+        window.addEventListener('load', doScroll, false);
+    </script>
+</head>
+<body>
+
+<div class="fixed">
+    Top bar
+</div>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (171249 => 171250)


--- trunk/Source/WebCore/ChangeLog	2014-07-18 23:57:40 UTC (rev 171249)
+++ trunk/Source/WebCore/ChangeLog	2014-07-19 00:00:52 UTC (rev 171250)
@@ -1,3 +1,22 @@
+2014-07-18  Simon Fraser  <[email protected]>
+
+        [iOS WK2] position:fixed in iframes with programmatic scroll could end up in the wrong place
+        https://bugs.webkit.org/show_bug.cgi?id=135078
+        <rdar://problem/17401823>
+
+        Reviewed by Tim Horton.
+        
+        When the UI-side scrolling tree receives a requested scroll position update, it scrolls
+        the node (e.g. a frame) then traverses child nodes to update them, e.g. for fixed position.
+        However, we would always use a viewport rect for the main document (from the scrolling tree),
+        which is not appropriate for subframes. Subframes should just use their own visible
+        rect to position fixed children.
+
+        Test: platform/mac-wk2/tiled-drawing/scrolling/frames/fixed-inside-frame.html
+
+        * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
+        (WebCore::ScrollingTreeFrameScrollingNodeIOS::updateChildNodesAfterScroll):
+
 2014-07-18  Beth Dakin  <[email protected]>
 
         Fixed position elements are misplaced when a WK1 view has contentInsets set

Modified: trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm (171249 => 171250)


--- trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm	2014-07-18 23:57:40 UTC (rev 171249)
+++ trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm	2014-07-19 00:00:52 UTC (rev 171250)
@@ -170,8 +170,13 @@
     if (!m_children)
         return;
 
-    FloatRect fixedPositionRect = scrollingTree().fixedPositionRect();
-    
+
+    FloatRect fixedPositionRect;
+    if (!parent())
+        fixedPositionRect = scrollingTree().fixedPositionRect();
+    else
+        fixedPositionRect = FloatRect(scrollOffset, scrollableAreaSize());
+
     for (auto& child : *m_children)
         child->updateLayersAfterAncestorChange(*this, fixedPositionRect, FloatSize());
 }

Modified: trunk/Source/WebKit2/ChangeLog (171249 => 171250)


--- trunk/Source/WebKit2/ChangeLog	2014-07-18 23:57:40 UTC (rev 171249)
+++ trunk/Source/WebKit2/ChangeLog	2014-07-19 00:00:52 UTC (rev 171250)
@@ -1,3 +1,16 @@
+2014-07-18  Simon Fraser  <[email protected]>
+
+        [iOS WK2] position:fixed in iframes with programmatic scroll could end up in the wrong place
+        https://bugs.webkit.org/show_bug.cgi?id=135078
+        <rdar://problem/17401823>
+
+        Reviewed by Tim Horton.
+        
+        Fix the logging of requested scroll position and frame scale factor.
+
+        * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
+        (WebKit::RemoteScrollingTreeTextStream::dump):
+
 2014-07-18  Joseph Pecoraro  <[email protected]>
 
         [Cocoa] Use RetainPtr in _WKRemoteObjectInterface

Modified: trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp (171249 => 171250)


--- trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp	2014-07-18 23:57:40 UTC (rev 171249)
+++ trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp	2014-07-19 00:00:52 UTC (rev 171250)
@@ -581,7 +581,6 @@
     if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrollOrigin))
         dumpProperty(ts, "scroll-origin", node.scrollOrigin());
 
-    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateFrameScrollingNode::FrameScaleFactor))
     if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) {
         dumpProperty(ts, "requested-scroll-position", node.requestedScrollPosition());
         dumpProperty(ts, "requested-scroll-position-is-programatic", node.requestedScrollPositionRepresentsProgrammaticScroll());
@@ -627,6 +626,9 @@
     if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateFrameScrollingNode::TopContentInset))
         dumpProperty(ts, "top-content-inset", node.topContentInset());
 
+    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateFrameScrollingNode::FrameScaleFactor))
+        dumpProperty(ts, "frame-scale-factor", node.frameScaleFactor());
+
     if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateFrameScrollingNode::ScrolledContentsLayer))
         dumpProperty(ts, "scrolled-contents-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.scrolledContentsLayer()));
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to