Changeset 269622 in webkit


Ignore:
Timestamp:
Nov 10, 2020 1:28:40 AM (21 months ago)
Author:
commit-queue@webkit.org
Message:

Scroll-snap on the root aligns to the body margin edge, not the viewport edge
https://bugs.webkit.org/show_bug.cgi?id=210476
<rdar://problem/61755103>

Patch by Martin Robinson <mrobinson@igalia.com> on 2020-11-10
Reviewed by Simon Fraser.

Source/WebCore:

When passing the frame viewport to updateSnapOffsetsForScrollableArea, be sure to put it
into the coordinate system of the root element padding box. This means offsetting it by the
margins of the root element.

Tests: tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-margin.html

tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-margin.html

  • page/FrameView.cpp:

(WebCore::FrameView::updateSnapOffsets): Offset viewport by top and left margins of the
root element.

LayoutTests:

Added tests for new behavior.

  • tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-margin-expected.txt: Added.
  • tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-margin.html: Added.
  • tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-margin-expected.txt: Added.
  • tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-margin.html: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r269612 r269622  
     12020-11-10  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Scroll-snap on the root aligns to the body margin edge, not the viewport edge
     4        https://bugs.webkit.org/show_bug.cgi?id=210476
     5        <rdar://problem/61755103>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Added tests for new behavior.
     10
     11        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-margin-expected.txt: Added.
     12        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-margin.html: Added.
     13        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-margin-expected.txt: Added.
     14        * tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-margin.html: Added.
     15
    1162020-11-09  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/Source/WebCore/ChangeLog

    r269616 r269622  
     12020-11-10  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Scroll-snap on the root aligns to the body margin edge, not the viewport edge
     4        https://bugs.webkit.org/show_bug.cgi?id=210476
     5        <rdar://problem/61755103>
     6
     7        Reviewed by Simon Fraser.
     8
     9        When passing the frame viewport to updateSnapOffsetsForScrollableArea, be sure to put it
     10        into the coordinate system of the root element padding box. This means offsetting it by the
     11        margins of the root element.
     12
     13        Tests: tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-horizontal-with-margin.html
     14               tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-vertical-with-margin.html
     15
     16        * page/FrameView.cpp:
     17        (WebCore::FrameView::updateSnapOffsets): Offset viewport by top and left margins of the
     18        root element.
     19
    1202020-11-09  Tim Horton  <timothy_horton@apple.com>
    221
  • trunk/Source/WebCore/page/FrameView.cpp

    r269506 r269622  
    942942    }
    943943
     944    // updateSnapOffsetsForScrollableArea calculates scroll offsets with all rectangles having their origin at the
     945    // padding box rectangle of the scrollable element. Unlike for overflow:scroll, the FrameView viewport includes
     946    // the root element margins. This means that we need to offset the viewport rectangle to make it relative to
     947    // the padding box of the root element.
    944948    LayoutRect viewport = LayoutRect(IntPoint(), baseLayoutViewportSize());
     949    viewport.move(-rootRenderer->marginLeft(), -rootRenderer->marginTop());
     950
    945951    updateSnapOffsetsForScrollableArea(*this, *rootRenderer, *styleToUse, viewport);
    946952}
Note: See TracChangeset for help on using the changeset viewer.