Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1d489b3538d6c3f561e8ceab185be188eab4e3dc
      
https://github.com/WebKit/WebKit/commit/1d489b3538d6c3f561e8ceab185be188eab4e3dc
  Author: Simon Fraser <[email protected]>
  Date:   2026-07-28 (Tue, 28 Jul 2026)

  Changed paths:
    A 
LayoutTests/fast/scrolling/mac/hidpi-overscroll-snap-discrete-scroll-expected.txt
    A LayoutTests/fast/scrolling/mac/hidpi-overscroll-snap-discrete-scroll.html
    A 
LayoutTests/fast/scrolling/mac/overscroll-snap-adjusted-scroll-destination-expected.txt
    A 
LayoutTests/fast/scrolling/mac/overscroll-snap-adjusted-scroll-destination.html
    M Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp
    M Source/WebCore/platform/ScrollSnapAnimatorState.cpp

  Log Message:
  -----------
  [Scroll snap] css/css-scroll-snap/overscroll-snap.html fails in Safari
https://bugs.webkit.org/show_bug.cgi?id=320405
rdar://183375912

Reviewed by Abrar Rahman Protyasha.

The WPT `css/css-scroll-snap/overscroll-snap.html` has a fractional height 
scroll snap element
that goes to the end of the scrolling content, which reveals a couple of issues 
in the scroll
snap code.

First, `snapOffsetCoversSnapport()` needs a bit of tolerance, because in this 
case the end
snap point is at, say, 20.5px, but the `scrollHeight` is integral and rounded 
up to 21px,
and we need to not thing we're outside this snap port, otherwise it triggers 
scrolling
back to the start.

Second, two places that use the destination scroll offset need to clamp for 
rubber-banding,
otherwise we again think that the target scroll position is outside the last 
snap target element,
and scroll to the wrong place.

Tests: fast/scrolling/mac/hidpi-overscroll-snap-discrete-scroll.html
       fast/scrolling/mac/overscroll-snap-adjusted-scroll-destination.html

* 
LayoutTests/fast/scrolling/mac/hidpi-overscroll-snap-discrete-scroll-expected.txt:
 Added.
* LayoutTests/fast/scrolling/mac/hidpi-overscroll-snap-discrete-scroll.html: 
Added.
* 
LayoutTests/fast/scrolling/mac/overscroll-snap-adjusted-scroll-destination-expected.txt:
 Added.
* 
LayoutTests/fast/scrolling/mac/overscroll-snap-adjusted-scroll-destination.html:
 Added.
* Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp:
(WebCore::RectType>::snapOffsetCoversSnapport const):
* Source/WebCore/platform/ScrollSnapAnimatorState.cpp:
(WebCore::ScrollSnapAnimatorState::adjustedScrollDestination const):
(WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset const):

Canonical link: https://commits.webkit.org/318081@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to