Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: aa9d5ddfb18a7595a71e659af04d1ea548a535b4
      
https://github.com/WebKit/WebKit/commit/aa9d5ddfb18a7595a71e659af04d1ea548a535b4
  Author: Lily Spiniolas <[email protected]>
  Date:   2026-03-06 (Fri, 06 Mar 2026)

  Changed paths:
    M Source/WebCore/page/LocalFrameView.cpp
    M Source/WebCore/page/LocalFrameView.h
    M Source/WebCore/page/Page.cpp
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm
    M Source/WebKit/UIProcess/WebPageProxyTesting.cpp
    M Source/WebKit/UIProcess/WebPageProxyTesting.h
    M Source/WebKit/WebProcess/WebPage/WebPageTesting.cpp
    M Source/WebKit/WebProcess/WebPage/WebPageTesting.h
    M Source/WebKit/WebProcess/WebPage/WebPageTesting.messages.in
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm
    M Tools/TestWebKitAPI/cocoa/TestWKWebView.h
    M Tools/TestWebKitAPI/cocoa/TestWKWebView.mm

  Log Message:
  -----------
  Top scroll stretching should not stop color sampling of top edge
https://bugs.webkit.org/show_bug.cgi?id=309215
rdar://171697732

Reviewed by Wenson Hsieh, Aditya Keerthi, and Abrar Rahman Protyasha.

To prevent rapid changes in the sampled top color, we stop updating it after
the user scrolls. However, if the user does not scroll into the page and instead
only scrolls into the top scroll stretch area, we should continue to update
the sampled color.

Add new method LocalFrameView::wasEverScrolledExplicitlyByUserBelowTopEdge()
which tracks exactly what it sounds like. In Page::updateFixedContainerEdges,
instead of skipping the top color sample if the user explicitly scrolled,
we only skip if the user expliclitly scrolled below the top of the page (aka
outside of the top scroll stretch area).

Add a new `wheelEventAtPoint:` method to `TestWKWebView.mm` which takes a
scroll phase and momentum phase to allow for simulated scrolls with 
rubberbanding
to occur on macOS.

Add new methods `_waitForWheelEventsToCompleteForTesting` and
`_startMonitoringWheelEventsForTesting` to track when scrolling completes during
an API test.

Tests: Tools/TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm

* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::reset):
(WebCore::LocalFrameView::setLastUserScrollType):
* Source/WebCore/page/LocalFrameView.h:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::updateFixedContainerEdges):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _startMonitoringWheelEventsForTesting:]):
(-[WKWebView _waitForWheelEventsToCompleteForTesting:]):
* Source/WebKit/UIProcess/WebPageProxyTesting.cpp:
(WebKit::WebPageProxyTesting::startMonitoringWheelEventsForTesting):
(WebKit::WebPageProxyTesting::waitForWheelEventsToCompleteForTesting):
* Source/WebKit/UIProcess/WebPageProxyTesting.h:
* Source/WebKit/WebProcess/WebPage/WebPageTesting.cpp:
(WebKit::WebPageTesting::startMonitoringWheelEventsForTesting):
(WebKit::WebPageTesting::waitForWheelEventsToCompleteForTesting):
* Source/WebKit/WebProcess/WebPage/WebPageTesting.h:
* Source/WebKit/WebProcess/WebPage/WebPageTesting.messages.in:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm:
(TestWebKitAPI::checkColorComponents):
(TestWebKitAPI::expectTomato):
(TestWebKitAPI::expectBlue):
(TestWebKitAPI::TEST(SampledPageTopColor, 
TopScrollStretchingDoesNotPreventTopEdgeSampling)):
(TestWebKitAPI::TEST(SampledPageTopColor, 
ForcedUserGestureFromJSInjectionDoesNotPreventTopEdgeSampling)):
* Tools/TestWebKitAPI/cocoa/TestWKWebView.h:
* Tools/TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView wheelEventAtPoint:wheelDelta:]):
(-[TestWKWebView wheelEventAtPoint:wheelDelta:phase:momentumPhase:]):

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



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

Reply via email to