Changeset 238576 in webkit


Ignore:
Timestamp:
Nov 27, 2018 2:03:19 PM (5 years ago)
Author:
Simon Fraser
Message:

Momentum scrolling ends at the wrong place when a scrolling overflow element has a non-zero border
https://bugs.webkit.org/show_bug.cgi?id=191322

Reviewed by Dean Jackson.
Source/WebCore:

The scrolling momentum logic in ScrollController::handleWheelEvent() which computes whether the scroll is pinned
to the end makes use of ScrollableArea::visibleContentRect(). RenderLayer's implementation of this was incorrect when
the layer's element had borders, causing the momentum scroll to stop early.

Fix by using the correct size (visible size, not layer size).

Test: fast/scrolling/momentum-scroll-with-borders.html

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::visibleContentRectInternal const):

LayoutTests:

  • fast/scrolling/momentum-scroll-with-borders-expected.txt: Added.
  • fast/scrolling/momentum-scroll-with-borders.html: Added.
  • platform/ios/TestExpectations:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r238575 r238576  
     12018-11-27  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Momentum scrolling ends at the wrong place when a scrolling overflow element has a non-zero border
     4        https://bugs.webkit.org/show_bug.cgi?id=191322
     5
     6        Reviewed by Dean Jackson.
     7
     8        * fast/scrolling/momentum-scroll-with-borders-expected.txt: Added.
     9        * fast/scrolling/momentum-scroll-with-borders.html: Added.
     10        * platform/ios/TestExpectations:
     11
    1122018-11-27  Simon Fraser  <simon.fraser@apple.com>
    213
  • trunk/LayoutTests/accessibility/ios-simulator/scroll-in-overflow-div-expected.txt

    r187904 r238576  
    44
    55
    6 AXScrollByPage received: data: AXScroll [position: 0.00 224.00]
     6AXScrollByPage received: data: AXScroll [position: 0.00 220.00]
    77scroll down 0 : success true
    8 AXScrollByPage received: data: AXScroll [position: 0.00 448.00]
     8AXScrollByPage received: data: AXScroll [position: 0.00 440.00]
    99scroll down 1 : success true
    10 AXScrollByPage received: data: AXScroll [position: 0.00 672.00]
     10AXScrollByPage received: data: AXScroll [position: 0.00 660.00]
    1111scroll down 2 : success true
    12 AXScrollByPage received: data: AXScroll [position: 0.00 712.00]
     12AXScrollByPage received: data: AXScroll [position: 0.00 716.00]
    1313scroll down 3 : success true
    1414scroll down 4 : success false
    15 AXScrollByPage received: data: AXScroll [position: 0.00 488.00]
     15AXScrollByPage received: data: AXScroll [position: 0.00 496.00]
    1616scroll up 0 : success true
    17 AXScrollByPage received: data: AXScroll [position: 0.00 264.00]
     17AXScrollByPage received: data: AXScroll [position: 0.00 276.00]
    1818scroll up 1 : success true
    19 AXScrollByPage received: data: AXScroll [position: 0.00 40.00]
     19AXScrollByPage received: data: AXScroll [position: 0.00 56.00]
    2020scroll up 2 : success true
    2121AXScrollByPage received: data: AXScroll [position: 0.00 0.00]
    2222scroll up 3 : success true
    2323scroll up 4 : success false
    24 AXScrollByPage received: data: AXScroll [position: 424.00 0.00]
     24AXScrollByPage received: data: AXScroll [position: 420.00 0.00]
    2525scroll left 0 : success true
    26 AXScrollByPage received: data: AXScroll [position: 848.00 0.00]
     26AXScrollByPage received: data: AXScroll [position: 840.00 0.00]
    2727scroll left 1 : success true
    28 AXScrollByPage received: data: AXScroll [position: 1272.00 0.00]
     28AXScrollByPage received: data: AXScroll [position: 1260.00 0.00]
    2929scroll left 2 : success true
    30 AXScrollByPage received: data: AXScroll [position: 1696.00 0.00]
     30AXScrollByPage received: data: AXScroll [position: 1680.00 0.00]
    3131scroll left 3 : success true
    32 AXScrollByPage received: data: AXScroll [position: 2120.00 0.00]
     32AXScrollByPage received: data: AXScroll [position: 2100.00 0.00]
    3333scroll left 4 : success true
    34 AXScrollByPage received: data: AXScroll [position: 1696.00 0.00]
     34AXScrollByPage received: data: AXScroll [position: 1680.00 0.00]
    3535scroll right 0 : success true
    36 AXScrollByPage received: data: AXScroll [position: 1272.00 0.00]
     36AXScrollByPage received: data: AXScroll [position: 1260.00 0.00]
    3737scroll right 1 : success true
    38 AXScrollByPage received: data: AXScroll [position: 848.00 0.00]
     38AXScrollByPage received: data: AXScroll [position: 840.00 0.00]
    3939scroll right 2 : success true
    40 AXScrollByPage received: data: AXScroll [position: 424.00 0.00]
     40AXScrollByPage received: data: AXScroll [position: 420.00 0.00]
    4141scroll right 3 : success true
    4242AXScrollByPage received: data: AXScroll [position: 0.00 0.00]
  • trunk/LayoutTests/platform/ios/TestExpectations

    r238409 r238576  
    666666fast/scrolling/arrow-key-scroll-in-rtl-document.html [ Skip ]
    667667fast/scrolling/overflow-scroll-past-max.html [ Skip ]
     668fast/scrolling/momentum-scroll-with-borders.html [ Skip ]
    668669fast/scrolling/scroll-animator-basic-events.html [ Skip ]
    669670fast/scrolling/scroll-animator-overlay-scrollbars-clicked.html [ Skip ]
  • trunk/Source/WebCore/ChangeLog

    r238575 r238576  
     12018-11-27  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Momentum scrolling ends at the wrong place when a scrolling overflow element has a non-zero border
     4        https://bugs.webkit.org/show_bug.cgi?id=191322
     5
     6        Reviewed by Dean Jackson.
     7       
     8        The scrolling momentum logic in ScrollController::handleWheelEvent() which computes whether the scroll is pinned
     9        to the end makes use of ScrollableArea::visibleContentRect(). RenderLayer's implementation of this was incorrect when
     10        the layer's element had borders, causing the momentum scroll to stop early.
     11       
     12        Fix by using the correct size (visible size, not layer size).
     13
     14        Test: fast/scrolling/momentum-scroll-with-borders.html
     15
     16        * rendering/RenderLayer.cpp:
     17        (WebCore::RenderLayer::visibleContentRectInternal const):
     18
    1192018-11-27  Simon Fraser  <simon.fraser@apple.com>
    220
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r238523 r238576  
    28052805        scrollbarSpace = scrollbarIntrusion();
    28062806   
    2807     // FIXME: This seems wrong: m_layerSize includes borders. Can we just use the ScrollableArea implementation?
    2808     return IntRect(scrollPosition(), IntSize(std::max(0, m_layerSize.width() - scrollbarSpace.width()), std::max(0, m_layerSize.height() - scrollbarSpace.height())));
     2807    auto visibleSize = this->visibleSize();
     2808    return { scrollPosition(), { std::max(0, visibleSize.width() - scrollbarSpace.width()), std::max(0, visibleSize.height() - scrollbarSpace.height()) } };
    28092809}
    28102810
Note: See TracChangeset for help on using the changeset viewer.