Title: [261874] trunk
Revision
261874
Author
simon.fra...@apple.com
Date
2020-05-19 11:23:57 -0700 (Tue, 19 May 2020)

Log Message

[iOS] Programmaic scroll of "scrolling=no" iframe fails
https://bugs.webkit.org/show_bug.cgi?id=212063
<rdar://problem/57049514>

Reviewed by Antti Koivisto.
Source/WebCore:

ScrollView::setScrollPosition() calls requestScrollPositionUpdate(), and if this returns
false it relies on the confusingly-named updateScrollbars() to actually do the scroll.
This code path is hit for "scrolling=no" frames, which are not scroll-coordinated.

ScrollView::updateScrollbars() fails to set the scroll position on iOS, where managesScrollbars()
returns false, so fix that.

Test: fast/scrolling/progammatic-scroll-scrolling-no-frame.html

* platform/ScrollView.cpp:
(WebCore::ScrollView::updateScrollbars):

LayoutTests:

New passing results for some WPT tests (iOS-specific results are removed).

fast/frames/flattening/scrolling-in-object.html relies on mouse events, so skip on iOS. It happened
to pass because both test and reference showed the red square.

fast/loader/scroll-position-restored-on-back.html needs to wait for the UI process to restore the scroll position.

* fast/loader/scroll-position-restored-on-back.html:
* fast/scrolling/progammatic-scroll-scrolling-no-frame-expected.txt: Added.
* fast/scrolling/progammatic-scroll-scrolling-no-frame.html: Added.
* platform/ios-wk2/fast/overflow/scrollRevealButton-expected.txt:
* platform/ios-wk2/imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-expected.txt:
* platform/ios/TestExpectations:
* platform/ios/fast/visual-viewport/viewport-dimensions-iframe-expected.txt: Removed.
* platform/ios/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-cross-origin-expected.txt:
* platform/ios/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location_hash-expected.txt:
* platform/ios/imported/w3c/web-platform-tests/intersection-observer/cross-origin-iframe.sub-expected.txt: Removed.
* platform/ios/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-expected.txt: Removed.
* platform/ios/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-with-wrapping-scroller-expected.txt: Removed.
* platform/ios/imported/w3c/web-platform-tests/intersection-observer/nested-cross-origin-iframe.sub-expected.txt: Removed.
* platform/ios/imported/w3c/web-platform-tests/visual-viewport/viewport-unscaled-scroll-iframe-expected.txt: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (261873 => 261874)


--- trunk/LayoutTests/ChangeLog	2020-05-19 18:19:24 UTC (rev 261873)
+++ trunk/LayoutTests/ChangeLog	2020-05-19 18:23:57 UTC (rev 261874)
@@ -1,3 +1,33 @@
+2020-05-19  Simon Fraser  <simon.fra...@apple.com>
+
+        [iOS] Programmaic scroll of "scrolling=no" iframe fails
+        https://bugs.webkit.org/show_bug.cgi?id=212063
+        <rdar://problem/57049514>
+
+        Reviewed by Antti Koivisto.
+        
+        New passing results for some WPT tests (iOS-specific results are removed).
+
+        fast/frames/flattening/scrolling-in-object.html relies on mouse events, so skip on iOS. It happened
+        to pass because both test and reference showed the red square.
+
+        fast/loader/scroll-position-restored-on-back.html needs to wait for the UI process to restore the scroll position.
+
+        * fast/loader/scroll-position-restored-on-back.html:
+        * fast/scrolling/progammatic-scroll-scrolling-no-frame-expected.txt: Added.
+        * fast/scrolling/progammatic-scroll-scrolling-no-frame.html: Added.
+        * platform/ios-wk2/fast/overflow/scrollRevealButton-expected.txt:
+        * platform/ios-wk2/imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-expected.txt:
+        * platform/ios/TestExpectations:
+        * platform/ios/fast/visual-viewport/viewport-dimensions-iframe-expected.txt: Removed.
+        * platform/ios/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-cross-origin-expected.txt:
+        * platform/ios/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location_hash-expected.txt:
+        * platform/ios/imported/w3c/web-platform-tests/intersection-observer/cross-origin-iframe.sub-expected.txt: Removed.
+        * platform/ios/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-expected.txt: Removed.
+        * platform/ios/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-with-wrapping-scroller-expected.txt: Removed.
+        * platform/ios/imported/w3c/web-platform-tests/intersection-observer/nested-cross-origin-iframe.sub-expected.txt: Removed.
+        * platform/ios/imported/w3c/web-platform-tests/visual-viewport/viewport-unscaled-scroll-iframe-expected.txt: Removed.
+
 2020-05-19  Andy Estes  <aes...@apple.com>
 
         [Apple Pay] Add testing and logging for ApplePaySetup

Modified: trunk/LayoutTests/fast/loader/scroll-position-restored-on-back.html (261873 => 261874)


--- trunk/LayoutTests/fast/loader/scroll-position-restored-on-back.html	2020-05-19 18:19:24 UTC (rev 261873)
+++ trunk/LayoutTests/fast/loader/scroll-position-restored-on-back.html	2020-05-19 18:23:57 UTC (rev 261874)
@@ -1,8 +1,10 @@
 <!-- webkit-test-runner [ enableBackForwardCache=true ] -->
 <html>
 <head>
+    <script src=""
+    
 <script>
-function navigate()
+async function navigate()
 {
     if (location.hash == "") {
         if (window.testRunner) {
@@ -16,14 +18,14 @@
         return;
     }
 
-    setTimeout(function () { 
-        var scrollPosition = document.scrollingElement.scrollTop;
-        var result = document.getElementById("result");
-        if (scrollPosition == 100)
-            result.innerHTML = "Success! The scroll position was restored after navigation."
-        if (window.testRunner)
-            testRunner.notifyDone();
-    }, 0);
+    await UIHelper.ensureStablePresentationUpdate();
+
+    var scrollPosition = document.scrollingElement.scrollTop;
+    var result = document.getElementById("result");
+    if (scrollPosition == 100)
+        result.innerHTML = "Success! The scroll position was restored after navigation."
+    if (window.testRunner)
+        testRunner.notifyDone();
 }
 
 </script>

Added: trunk/LayoutTests/fast/scrolling/progammatic-scroll-scrolling-no-frame-expected.txt (0 => 261874)


--- trunk/LayoutTests/fast/scrolling/progammatic-scroll-scrolling-no-frame-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/progammatic-scroll-scrolling-no-frame-expected.txt	2020-05-19 18:23:57 UTC (rev 261874)
@@ -0,0 +1,7 @@
+
+PASS iframe.contentWindow.scrollY is 0
+PASS iframe.contentWindow.scrollY is 400
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/scrolling/progammatic-scroll-scrolling-no-frame.html (0 => 261874)


--- trunk/LayoutTests/fast/scrolling/progammatic-scroll-scrolling-no-frame.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/progammatic-scroll-scrolling-no-frame.html	2020-05-19 18:23:57 UTC (rev 261874)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<script src=""
+    <script>
+        jsTestIsAsync = true;
+        var iframe;
+        window.addEventListener('load', () => {
+            iframe = document.getElementsByTagName('iframe')[0];
+            shouldBe('iframe.contentWindow.scrollY', '0');
+            iframe.contentWindow.scrollTo(0, 400);
+            shouldBe('iframe.contentWindow.scrollY', '400');
+            finishJSTest();
+        }, false);
+    </script>
+</head>
+<body>
+    <iframe scrolling="no" srcdoc="
+    <style>
+        body {
+            height: 2000px;
+        }
+    </style>
+    text here
+    "></iframe>
+<div id="console"></div>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (261873 => 261874)


--- trunk/LayoutTests/platform/ios/TestExpectations	2020-05-19 18:19:24 UTC (rev 261873)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2020-05-19 18:23:57 UTC (rev 261874)
@@ -1053,6 +1053,7 @@
 fast/css/user-drag-none.html [ Skip ]
 fast/forms/range/disabled-while-dragging.html [ Skip ]
 fast/forms/range/range-drag-when-toggled-disabled.html [ Skip ]
+fast/frames/flattening/scrolling-in-object.html [ Skip ]
 fast/media/video-element-in-details-collapse.html [ Skip ]
 fast/frames/user-gesture-timestamp-propagation.html [ Failure ]
 fast/events/mouse-click-different-mouseDown-mouseUp-nodes.html [ Skip ]

Deleted: trunk/LayoutTests/platform/ios/fast/visual-viewport/viewport-dimensions-iframe-expected.txt (261873 => 261874)


--- trunk/LayoutTests/platform/ios/fast/visual-viewport/viewport-dimensions-iframe-expected.txt	2020-05-19 18:19:24 UTC (rev 261873)
+++ trunk/LayoutTests/platform/ios/fast/visual-viewport/viewport-dimensions-iframe-expected.txt	2020-05-19 18:23:57 UTC (rev 261874)
@@ -1,4 +0,0 @@
-
-
-FAIL Verify viewport dimensions for iframe. assert_equals: pageLeft expected 10 but got 0
-

Modified: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-cross-origin-expected.txt (261873 => 261874)


--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-cross-origin-expected.txt	2020-05-19 18:19:24 UTC (rev 261873)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-cross-origin-expected.txt	2020-05-19 18:23:57 UTC (rev 261874)
@@ -1,4 +1,4 @@
 
 
-FAIL Navigating to new page should reset to "auto" and navigating back should restore and respect scroll restoration mode assert_equals: scripted scrolling should take effect expected 500 but got 0
+PASS Navigating to new page should reset to "auto" and navigating back should restore and respect scroll restoration mode 
 

Modified: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location_hash-expected.txt (261873 => 261874)


--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location_hash-expected.txt	2020-05-19 18:19:24 UTC (rev 261873)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location_hash-expected.txt	2020-05-19 18:23:57 UTC (rev 261874)
@@ -1,6 +1,6 @@
 
 PASS location hash 
-FAIL Setting location.hash on srcdoc iframe assert_true: Should have scrolled by more than one viewport height expected true got false
+PASS Setting location.hash on srcdoc iframe 
 PASS Setting hash should automatically include hash character 
 FAIL Setting hash should encode incompatible characters assert_equals: expected "#not%20encoded" but got "#not encoded"
 PASS Setting hash to an already encoded value should not double encode it 

Deleted: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/visual-viewport/viewport-unscaled-scroll-iframe-expected.txt (261873 => 261874)


--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/visual-viewport/viewport-unscaled-scroll-iframe-expected.txt	2020-05-19 18:19:24 UTC (rev 261873)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/visual-viewport/viewport-unscaled-scroll-iframe-expected.txt	2020-05-19 18:23:57 UTC (rev 261874)
@@ -1,15 +0,0 @@
-Viewport: Scroll in iframe - no page scale
-
-Test Description: This test checks that window.visualViewport returns correct offset and scroll values without any pinch-zoom page scale applied.
-
-
-frames[0].window.visualViewport's offsetLeft and offsetTop is (0, 0).
-
-frames[0].window.visualViewport's pageLeft and pageTop is (0, 0).
-
-
-PASS offsetLeft must be 0. 
-PASS offsetTop must be 0. 
-FAIL pageLeft must reflect location of viewport in document. assert_equals: expected 1000 but got 0
-FAIL pageTop must reflect location of viewport in document. assert_equals: expected 1200 but got 0
-

Modified: trunk/LayoutTests/platform/ios-wk2/fast/overflow/scrollRevealButton-expected.txt (261873 => 261874)


--- trunk/LayoutTests/platform/ios-wk2/fast/overflow/scrollRevealButton-expected.txt	2020-05-19 18:19:24 UTC (rev 261873)
+++ trunk/LayoutTests/platform/ios-wk2/fast/overflow/scrollRevealButton-expected.txt	2020-05-19 18:23:57 UTC (rev 261874)
@@ -38,3 +38,4 @@
               RenderBlock {DIV} at (0,564) size 135x300
         RenderText {#text} at (0,0) size 0x0
       RenderBlock {DIV} at (0,674) size 784x500
+frame 'fr' scrolled to 0,18

Modified: trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-expected.txt (261873 => 261874)


--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-expected.txt	2020-05-19 18:19:24 UTC (rev 261873)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-expected.txt	2020-05-19 18:23:57 UTC (rev 261874)
@@ -1,6 +1,6 @@
 
 
-FAIL Sanity test assert_true: after elm.scrollIntoView() expected true got false
+PASS Sanity test 
 FAIL elm.focus() without arguments assert_true: expected true got false
 FAIL elm.focus(undefined) assert_true: expected true got false
 FAIL elm.focus(null) assert_true: expected true got false

Modified: trunk/Source/WebCore/ChangeLog (261873 => 261874)


--- trunk/Source/WebCore/ChangeLog	2020-05-19 18:19:24 UTC (rev 261873)
+++ trunk/Source/WebCore/ChangeLog	2020-05-19 18:23:57 UTC (rev 261874)
@@ -1,3 +1,23 @@
+2020-05-19  Simon Fraser  <simon.fra...@apple.com>
+
+        [iOS] Programmaic scroll of "scrolling=no" iframe fails
+        https://bugs.webkit.org/show_bug.cgi?id=212063
+        <rdar://problem/57049514>
+
+        Reviewed by Antti Koivisto.
+
+        ScrollView::setScrollPosition() calls requestScrollPositionUpdate(), and if this returns
+        false it relies on the confusingly-named updateScrollbars() to actually do the scroll.
+        This code path is hit for "scrolling=no" frames, which are not scroll-coordinated.
+
+        ScrollView::updateScrollbars() fails to set the scroll position on iOS, where managesScrollbars()
+        returns false, so fix that.
+
+        Test: fast/scrolling/progammatic-scroll-scrolling-no-frame.html
+
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::updateScrollbars):
+
 2020-05-19  Andy Estes  <aes...@apple.com>
 
         [Apple Pay] Add testing and logging for ApplePaySetup

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (261873 => 261874)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2020-05-19 18:19:24 UTC (rev 261873)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2020-05-19 18:23:57 UTC (rev 261874)
@@ -591,11 +591,19 @@
     if (m_inUpdateScrollbars || prohibitsScrolling() || platformWidget())
         return;
     
-    if (!managesScrollbars()) {
-        if (scrollOriginChanged()) {
-            ScrollableArea::scrollToOffsetWithoutAnimation(scrollOffsetFromPosition(desiredPosition));
+    auto scrollToPosition = [&](ScrollPosition desiredPosition) {
+        auto adjustedScrollPosition = desiredPosition;
+        if (!isRubberBandInProgress())
+            adjustedScrollPosition = adjustScrollPositionWithinRange(adjustedScrollPosition);
+
+        if (adjustedScrollPosition != scrollPosition() || scrollOriginChanged()) {
+            ScrollableArea::scrollToOffsetWithoutAnimation(scrollOffsetFromPosition(adjustedScrollPosition));
             resetScrollOriginChanged();
         }
+    };
+
+    if (!managesScrollbars()) {
+        scrollToPosition(desiredPosition);
         return;
     }
 
@@ -772,15 +780,8 @@
             invalidateScrollCornerRect(oldScrollCornerRect);
     }
 
-    IntPoint adjustedScrollPosition = desiredPosition;
-    if (!isRubberBandInProgress())
-        adjustedScrollPosition = adjustScrollPositionWithinRange(adjustedScrollPosition);
+    scrollToPosition(desiredPosition);
 
-    if (adjustedScrollPosition != scrollPosition() || scrollOriginChanged()) {
-        ScrollableArea::scrollToOffsetWithoutAnimation(scrollOffsetFromPosition(adjustedScrollPosition));
-        resetScrollOriginChanged();
-    }
-
     // Make sure the scrollbar offsets are up to date.
     if (m_horizontalScrollbar)
         m_horizontalScrollbar->offsetDidChange();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to