⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 249581 in webkit


Ignore:
Timestamp:
Sep 6, 2019, 11:05:51 AM (7 years ago)
Author:
Simon Fraser
Message:

REGRESSION (iOS 13): If an overflow:hidden with a non-zero scroll position is toggled to overflow:scroll, some other scroll causes its scroll position to get reset
https://bugs.webkit.org/show_bug.cgi?id=201528
rdar://problem/55044885

Reviewed by Frédéric Wang.
Source/WebCore:

If, when an overflow scrolling node is created, the scroller has non-zero scroll
position (for example, via toggling to overflow:hidden, setting scrollTop, then toggling
to overflow:scroll), then on the next update its scroll position will reset back to zero.

The bug was that newly created ScrollingTreeScrollingNodes didn't set m_currentScrollPosition
to the scroll position coming from the state node, so a subsequent update could cause
the 0,0 currentScrollPosition to get applied. If we're making a new node, and there's no
requestedScrollPosition, then initialize m_currentScrollPosition.

Test: scrollingcoordinator/ios/scroller-initial-scroll-position.html

  • page/scrolling/ScrollingTreeScrollingNode.cpp:

(WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
(WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren):

  • page/scrolling/ScrollingTreeScrollingNode.h:

LayoutTests:

  • scrollingcoordinator/ios/scroller-initial-scroll-position-expected.html: Added.
  • scrollingcoordinator/ios/scroller-initial-scroll-position.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r249579 r249581  
    631631        * platform/mac/TestExpectations:
    632632
     6332019-09-06  Simon Fraser  <simon.fraser@apple.com>
     634
     635        REGRESSION (iOS 13): If an overflow:hidden with a non-zero scroll position is toggled to overflow:scroll, some other scroll causes its scroll position to get reset
     636        https://bugs.webkit.org/show_bug.cgi?id=201528
     637        rdar://problem/55044885
     638
     639        Reviewed by Frédéric Wang.
     640
     641        * scrollingcoordinator/ios/scroller-initial-scroll-position-expected.html: Added.
     642        * scrollingcoordinator/ios/scroller-initial-scroll-position.html: Added.
     643
    6336442019-09-04  Yusuke Suzuki  <ysuzuki@apple.com>
    634645
  • trunk/Source/WebCore/ChangeLog

    r249575 r249581  
    511511
    512512        * loader/EmptyFrameLoaderClient.h:
     513
     5142019-09-06  Simon Fraser  <simon.fraser@apple.com>
     515
     516        REGRESSION (iOS 13): If an overflow:hidden with a non-zero scroll position is toggled to overflow:scroll, some other scroll causes its scroll position to get reset
     517        https://bugs.webkit.org/show_bug.cgi?id=201528
     518        rdar://problem/55044885
     519
     520        Reviewed by Frédéric Wang.
     521       
     522        If, when an overflow scrolling node is created, the scroller has non-zero scroll
     523        position (for example, via toggling to overflow:hidden, setting scrollTop, then toggling
     524        to overflow:scroll), then on the next update its scroll position will reset back to zero.
     525
     526        The bug was that newly created ScrollingTreeScrollingNodes didn't set m_currentScrollPosition
     527        to the scroll position coming from the state node, so a subsequent update could cause
     528        the 0,0 currentScrollPosition to get applied. If we're making a new node, and there's no
     529        requestedScrollPosition, then initialize m_currentScrollPosition.
     530
     531        Test: scrollingcoordinator/ios/scroller-initial-scroll-position.html
     532
     533        * page/scrolling/ScrollingTreeScrollingNode.cpp:
     534        (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
     535        (WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren):
     536        * page/scrolling/ScrollingTreeScrollingNode.h:
    513537
    5145382019-09-04  Yusuke Suzuki  <ysuzuki@apple.com>
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp

    r247013 r249581  
    6363        m_reachableContentsSize = state.reachableContentsSize();
    6464
    65     if (state.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition))
     65    if (state.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition)) {
    6666        m_lastCommittedScrollPosition = state.scrollPosition();
     67        if (m_isFirstCommit && !state.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition))
     68            m_currentScrollPosition = m_lastCommittedScrollPosition;
     69    }
    6770
    6871    if (state.hasChangedProperty(ScrollingStateScrollingNode::ParentRelativeScrollableRect))
     
    112115    if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition))
    113116        scrollingTree().scrollingTreeNodeRequestsScroll(scrollingNodeID(), scrollingStateNode.requestedScrollPosition(), scrollingStateNode.requestedScrollPositionRepresentsProgrammaticScroll());
     117
     118    m_isFirstCommit = false;
    114119}
    115120
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h

    r247013 r249581  
    152152    ScrollableAreaParameters m_scrollableAreaParameters;
    153153    bool m_expectsWheelEventTestTrigger { false };
     154    bool m_isFirstCommit { true };
    154155
    155156#if PLATFORM(COCOA)
Note: See TracChangeset for help on using the changeset viewer.