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

  Changed paths:
    M Source/WebCore/dom/UserGestureIndicator.cpp
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm

  Log Message:
  -----------
  Top color sampling occasionally fails on page reload when JavaScript is 
injected
https://bugs.webkit.org/show_bug.cgi?id=309024#
rdar://171571987

Reviewed by Wenson Hsieh and Abrar Rahman Protyasha.

To prevent rapid changes in the sampled top color, we stop updating it after
user interaction. However, WebKit APIs used for JS injections often force
user gestures, and we sometimes stop updating before sampling the proper
color as a result.

To fix this, we only stop updating after user interaction if the user gesture
did not originate from JS injection. If the process interaction style is
ProcessInteractionStyle::Never, then we know it originated from JS injection
from `ScriptController::executeScriptInWorld`.

* Source/WebCore/dom/UserGestureIndicator.cpp:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::didCommitLoad):
(WebCore::Page::updateFixedContainerEdges):
* Source/WebCore/page/Page.h:
(WebCore::Page::setUserDidInteractWithPageExcludingForcedUserGestures):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SampledPageTopColor.mm:
(TEST(SampledPageTopColor, 
ForcedUserGestureFromJSInjectionDoesNotPreventTopEdgeSampling)):

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



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

Reply via email to