Changeset 261874 in webkit


Ignore:
Timestamp:
May 19, 2020 11:23:57 AM (4 years ago)
Author:
Simon Fraser
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.
Location:
trunk
Files:
2 added
3 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r261873 r261874  
     12020-05-19  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS] Programmaic scroll of "scrolling=no" iframe fails
     4        https://bugs.webkit.org/show_bug.cgi?id=212063
     5        <rdar://problem/57049514>
     6
     7        Reviewed by Antti Koivisto.
     8       
     9        New passing results for some WPT tests (iOS-specific results are removed).
     10
     11        fast/frames/flattening/scrolling-in-object.html relies on mouse events, so skip on iOS. It happened
     12        to pass because both test and reference showed the red square.
     13
     14        fast/loader/scroll-position-restored-on-back.html needs to wait for the UI process to restore the scroll position.
     15
     16        * fast/loader/scroll-position-restored-on-back.html:
     17        * fast/scrolling/progammatic-scroll-scrolling-no-frame-expected.txt: Added.
     18        * fast/scrolling/progammatic-scroll-scrolling-no-frame.html: Added.
     19        * platform/ios-wk2/fast/overflow/scrollRevealButton-expected.txt:
     20        * platform/ios-wk2/imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-expected.txt:
     21        * platform/ios/TestExpectations:
     22        * platform/ios/fast/visual-viewport/viewport-dimensions-iframe-expected.txt: Removed.
     23        * 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:
     24        * platform/ios/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location_hash-expected.txt:
     25        * platform/ios/imported/w3c/web-platform-tests/intersection-observer/cross-origin-iframe.sub-expected.txt: Removed.
     26        * platform/ios/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-expected.txt: Removed.
     27        * platform/ios/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root-with-wrapping-scroller-expected.txt: Removed.
     28        * platform/ios/imported/w3c/web-platform-tests/intersection-observer/nested-cross-origin-iframe.sub-expected.txt: Removed.
     29        * platform/ios/imported/w3c/web-platform-tests/visual-viewport/viewport-unscaled-scroll-iframe-expected.txt: Removed.
     30
    1312020-05-19  Andy Estes  <aestes@apple.com>
    232
  • trunk/LayoutTests/fast/loader/scroll-position-restored-on-back.html

    r251220 r261874  
    22<html>
    33<head>
     4    <script src="../../resources/ui-helper.js"></script>
     5   
    46<script>
    5 function navigate()
     7async function navigate()
    68{
    79    if (location.hash == "") {
     
    1719    }
    1820
    19     setTimeout(function () {
    20         var scrollPosition = document.scrollingElement.scrollTop;
    21         var result = document.getElementById("result");
    22         if (scrollPosition == 100)
    23             result.innerHTML = "Success! The scroll position was restored after navigation."
    24         if (window.testRunner)
    25             testRunner.notifyDone();
    26     }, 0);
     21    await UIHelper.ensureStablePresentationUpdate();
     22
     23    var scrollPosition = document.scrollingElement.scrollTop;
     24    var result = document.getElementById("result");
     25    if (scrollPosition == 100)
     26        result.innerHTML = "Success! The scroll position was restored after navigation."
     27    if (window.testRunner)
     28        testRunner.notifyDone();
    2729}
    2830
  • trunk/LayoutTests/platform/ios-wk2/fast/overflow/scrollRevealButton-expected.txt

    r252598 r261874  
    3939        RenderText {#text} at (0,0) size 0x0
    4040      RenderBlock {DIV} at (0,674) size 784x500
     41frame 'fr' scrolled to 0,18
  • trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/interaction/focus/processing-model/preventScroll-expected.txt

    r249886 r261874  
    11
    22
    3 FAIL Sanity test assert_true: after elm.scrollIntoView() expected true got false
     3PASS Sanity test
    44FAIL elm.focus() without arguments assert_true: expected true got false
    55FAIL elm.focus(undefined) assert_true: expected true got false
  • trunk/LayoutTests/platform/ios/TestExpectations

    r261859 r261874  
    10541054fast/forms/range/disabled-while-dragging.html [ Skip ]
    10551055fast/forms/range/range-drag-when-toggled-disabled.html [ Skip ]
     1056fast/frames/flattening/scrolling-in-object.html [ Skip ]
    10561057fast/media/video-element-in-details-collapse.html [ Skip ]
    10571058fast/frames/user-gesture-timestamp-propagation.html [ Failure ]
  • 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

    r204844 r261874  
    11
    22
    3 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
     3PASS Navigating to new page should reset to "auto" and navigating back should restore and respect scroll restoration mode
    44
  • trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location_hash-expected.txt

    r249886 r261874  
    11
    22PASS location hash
    3 FAIL Setting location.hash on srcdoc iframe assert_true: Should have scrolled by more than one viewport height expected true got false
     3PASS Setting location.hash on srcdoc iframe
    44PASS Setting hash should automatically include hash character
    55FAIL Setting hash should encode incompatible characters assert_equals: expected "#not%20encoded" but got "#not encoded"
  • trunk/Source/WebCore/ChangeLog

    r261873 r261874  
     12020-05-19  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS] Programmaic scroll of "scrolling=no" iframe fails
     4        https://bugs.webkit.org/show_bug.cgi?id=212063
     5        <rdar://problem/57049514>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        ScrollView::setScrollPosition() calls requestScrollPositionUpdate(), and if this returns
     10        false it relies on the confusingly-named updateScrollbars() to actually do the scroll.
     11        This code path is hit for "scrolling=no" frames, which are not scroll-coordinated.
     12
     13        ScrollView::updateScrollbars() fails to set the scroll position on iOS, where managesScrollbars()
     14        returns false, so fix that.
     15
     16        Test: fast/scrolling/progammatic-scroll-scrolling-no-frame.html
     17
     18        * platform/ScrollView.cpp:
     19        (WebCore::ScrollView::updateScrollbars):
     20
    1212020-05-19  Andy Estes  <aestes@apple.com>
    222
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r259846 r261874  
    592592        return;
    593593   
    594     if (!managesScrollbars()) {
    595         if (scrollOriginChanged()) {
    596             ScrollableArea::scrollToOffsetWithoutAnimation(scrollOffsetFromPosition(desiredPosition));
     594    auto scrollToPosition = [&](ScrollPosition desiredPosition) {
     595        auto adjustedScrollPosition = desiredPosition;
     596        if (!isRubberBandInProgress())
     597            adjustedScrollPosition = adjustScrollPositionWithinRange(adjustedScrollPosition);
     598
     599        if (adjustedScrollPosition != scrollPosition() || scrollOriginChanged()) {
     600            ScrollableArea::scrollToOffsetWithoutAnimation(scrollOffsetFromPosition(adjustedScrollPosition));
    597601            resetScrollOriginChanged();
    598602        }
     603    };
     604
     605    if (!managesScrollbars()) {
     606        scrollToPosition(desiredPosition);
    599607        return;
    600608    }
     
    773781    }
    774782
    775     IntPoint adjustedScrollPosition = desiredPosition;
    776     if (!isRubberBandInProgress())
    777         adjustedScrollPosition = adjustScrollPositionWithinRange(adjustedScrollPosition);
    778 
    779     if (adjustedScrollPosition != scrollPosition() || scrollOriginChanged()) {
    780         ScrollableArea::scrollToOffsetWithoutAnimation(scrollOffsetFromPosition(adjustedScrollPosition));
    781         resetScrollOriginChanged();
    782     }
     783    scrollToPosition(desiredPosition);
    783784
    784785    // Make sure the scrollbar offsets are up to date.
Note: See TracChangeset for help on using the changeset viewer.