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

Changeset 245742 in webkit


Ignore:
Timestamp:
May 23, 2019, 8:25:27 PM (7 years ago)
Author:
Simon Fraser
Message:

With async overflow scrolling, programmatic scroll to a negative offset fails to clamp the scroll offset
https://bugs.webkit.org/show_bug.cgi?id=198208
<rdar://problem/49720087>

Reviewed by Zalan Bujtas.

Source/WebCore:

RenderLayer::scrollToOffset() needs to pass the clamped offset to scrollingCoordinator->requestScrollPositionUpdate(),
otherwise the scrolling tree will round-trip a negative value and scrollLeft will end up negative.

Test: fast/scrolling/programmatic-scroll-to-negative-offset.html

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::scrollToOffset):

LayoutTests:

  • fast/scrolling/programmatic-scroll-to-negative-offset-expected.txt: Added.
  • fast/scrolling/programmatic-scroll-to-negative-offset.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r245733 r245742  
     12019-05-23  Simon Fraser  <simon.fraser@apple.com>
     2
     3        With async overflow scrolling, programmatic scroll to a negative offset fails to clamp the scroll offset
     4        https://bugs.webkit.org/show_bug.cgi?id=198208
     5        <rdar://problem/49720087>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        * fast/scrolling/programmatic-scroll-to-negative-offset-expected.txt: Added.
     10        * fast/scrolling/programmatic-scroll-to-negative-offset.html: Added.
     11
    1122019-05-23  Fujii Hironori  <Hironori.Fujii@sony.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r245730 r245742  
     12019-05-23  Simon Fraser  <simon.fraser@apple.com>
     2
     3        With async overflow scrolling, programmatic scroll to a negative offset fails to clamp the scroll offset
     4        https://bugs.webkit.org/show_bug.cgi?id=198208
     5        <rdar://problem/49720087>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        RenderLayer::scrollToOffset() needs to pass the clamped offset to scrollingCoordinator->requestScrollPositionUpdate(),
     10        otherwise the scrolling tree will round-trip a negative value and scrollLeft will end up negative.
     11
     12        Test: fast/scrolling/programmatic-scroll-to-negative-offset.html
     13
     14        * rendering/RenderLayer.cpp:
     15        (WebCore::RenderLayer::scrollToOffset):
     16
    1172019-05-23  Devin Rousso  <drousso@apple.com>
    218
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r245490 r245742  
    24362436void RenderLayer::scrollToOffset(const ScrollOffset& scrollOffset, ScrollType scrollType, ScrollClamping clamping)
    24372437{
    2438     ScrollOffset newScrollOffset = clamping == ScrollClamping::Clamped ? clampScrollOffset(scrollOffset) : scrollOffset;
    2439     if (newScrollOffset == this->scrollOffset())
     2438    ScrollOffset clampedScrollOffset = clamping == ScrollClamping::Clamped ? clampScrollOffset(scrollOffset) : scrollOffset;
     2439    if (clampedScrollOffset == this->scrollOffset())
    24402440        return;
    24412441
     
    24462446#if ENABLE(ASYNC_SCROLLING)
    24472447    if (ScrollingCoordinator* scrollingCoordinator = page().scrollingCoordinator())
    2448         handled = scrollingCoordinator->requestScrollPositionUpdate(*this, scrollPositionFromOffset(scrollOffset));
     2448        handled = scrollingCoordinator->requestScrollPositionUpdate(*this, scrollPositionFromOffset(clampedScrollOffset));
    24492449#endif
    24502450
    24512451    if (!handled)
    2452         scrollToOffsetWithoutAnimation(newScrollOffset, clamping);
     2452        scrollToOffsetWithoutAnimation(clampedScrollOffset, clamping);
    24532453
    24542454    setCurrentScrollType(previousScrollType);
Note: See TracChangeset for help on using the changeset viewer.