Changeset 278868 in webkit


Ignore:
Timestamp:
Jun 15, 2021 4:09:34 AM (13 months ago)
Author:
commit-queue@webkit.org
Message:

[css-scroll-snap] Scroll snap offsets are interpreted as scroll positions in ScrollableArea
https://bugs.webkit.org/show_bug.cgi?id=226572

Patch by Martin Robinson <mrobinson@igalia.com> on 2021-06-15
Reviewed by Simon Fraser.

Source/WebCore:

Test: css3/scroll-snap/scroll-snap-right-to-left-initial-snapping.html

This is also covered by existing WPT tests, but these tests are composite reference
tests where there are still some failing elements.

  • platform/ScrollableArea.cpp:

(WebCore::ScrollableArea::nearestActiveSnapPoint): Use scroll offsets instead of positions.
(WebCore::ScrollableArea::updateScrollSnapState): Ditto.

LayoutTests:

  • TestExpectations: Mark test as newly passing.
  • css3/scroll-snap/scroll-snap-right-to-left-initial-snapping-expected.txt: Added.
  • css3/scroll-snap/scroll-snap-right-to-left-initial-snapping.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r278866 r278868  
     12021-06-15  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [css-scroll-snap] Scroll snap offsets are interpreted as scroll positions in ScrollableArea
     4        https://bugs.webkit.org/show_bug.cgi?id=226572
     5
     6        Reviewed by Simon Fraser.
     7
     8        * TestExpectations: Mark test as newly passing.
     9        * css3/scroll-snap/scroll-snap-right-to-left-initial-snapping-expected.txt: Added.
     10        * css3/scroll-snap/scroll-snap-right-to-left-initial-snapping.html: Added.
     11
    1122021-06-15  Enrique Ocaña González  <eocanha@igalia.com>
    213
  • trunk/LayoutTests/TestExpectations

    r278862 r278868  
    45544554imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-snap-001.html [ ImageOnlyFailure ]
    45554555imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-snap-002.html [ ImageOnlyFailure ]
    4556 imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/direction-rtl.html [ ImageOnlyFailure ]
    45574556imported/w3c/web-platform-tests/css/css-scroll-snap/snap-after-initial-layout/scroll-snap-writing-mode-000.html [ ImageOnlyFailure ]
    45584557webkit.org/b/218325 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-001.html [ Pass ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r278865 r278868  
     12021-06-15  Martin Robinson  <mrobinson@igalia.com>
     2
     3        [css-scroll-snap] Scroll snap offsets are interpreted as scroll positions in ScrollableArea
     4        https://bugs.webkit.org/show_bug.cgi?id=226572
     5
     6        Reviewed by Simon Fraser.
     7
     8        Test: css3/scroll-snap/scroll-snap-right-to-left-initial-snapping.html
     9
     10        This is also covered by existing WPT tests, but these tests are composite reference
     11        tests where there are still some failing elements.
     12
     13        * platform/ScrollableArea.cpp:
     14        (WebCore::ScrollableArea::nearestActiveSnapPoint): Use scroll offsets instead of positions.
     15        (WebCore::ScrollableArea::updateScrollSnapState): Ditto.
     16
    1172021-05-31  Sergio Villar Senin  <svillar@igalia.com>
    218
  • trunk/Source/WebCore/platform/ScrollableArea.cpp

    r278862 r278868  
    529529        return;
    530530
    531     IntPoint currentPosition = scrollPosition();
    532     IntPoint correctedPosition = currentPosition;
     531    auto currentOffset = scrollOffset();
     532    auto correctedOffset = currentOffset;
    533533    const auto& horizontal = info->horizontalSnapOffsets;
    534534    auto activeHorizontalIndex = currentHorizontalSnapPointIndex();
    535535    if (activeHorizontalIndex < horizontal.size())
    536         correctedPosition.setX(horizontal[activeHorizontalIndex].offset.toInt());
     536        correctedOffset.setX(horizontal[activeHorizontalIndex].offset.toInt());
    537537
    538538    const auto& vertical = info->verticalSnapOffsets;
    539539    auto activeVerticalIndex = currentVerticalSnapPointIndex();
    540540    if (activeVerticalIndex < vertical.size())
    541         correctedPosition.setY(vertical[activeVerticalIndex].offset.toInt());
    542 
    543     if (correctedPosition != currentPosition) {
    544         LOG_WITH_STREAM(ScrollSnap, stream << " adjusting position from " << currentPosition << " to " << correctedPosition);
    545         scrollToPositionWithoutAnimation(correctedPosition);
     541        correctedOffset.setY(vertical[activeVerticalIndex].offset.toInt());
     542
     543    if (correctedOffset != currentOffset) {
     544        LOG_WITH_STREAM(ScrollSnap, stream << " adjusting offset from " << currentOffset << " to " << correctedOffset);
     545        scrollToOffsetWithoutAnimation(correctedOffset);
    546546    }
    547547}
Note: See TracChangeset for help on using the changeset viewer.