Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 191b1f341a7e02b3fa6b67fc479f7b9ed05a4acc
      
https://github.com/WebKit/WebKit/commit/191b1f341a7e02b3fa6b67fc479f7b9ed05a4acc
  Author: Richard Robinson <[email protected]>
  Date:   2026-07-01 (Wed, 01 Jul 2026)

  Changed paths:
    M Source/WebCore/page/EventHandler.cpp
    M Source/WebCore/page/EventHandler.h
    M Source/WebKit/WebProcess/WebPage/Cocoa/PositionInformationForWebPage.mm
    M Source/WebKit/_WebKit_SwiftUI/API/View+WebViewModifiers.swift
    M 
Source/WebKit/_WebKit_SwiftUI/Implementation/EnvironmentValues+Extras.swift
    M Source/WebKit/_WebKit_SwiftUI/Implementation/SwiftUI+Extras.swift
    M Source/WebKit/_WebKit_SwiftUI/Implementation/WebViewRepresentable.swift
    M Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture 
Tests/AppKitGesturesTestsSupport.swift
    M Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture 
Tests/EmbeddedAppKitGesturesTests.swift

  Log Message:
  -----------
  [AppKit Gestures] Double-clicking to select a word when scrolled to the top 
with obscured content insets sometimes doesn't work
https://bugs.webkit.org/show_bug.cgi?id=318293
rdar://181076925

Reviewed by Abrar Rahman Protyasha.

The calculations in `PositionInformationForWebPage.mm` were using the wrong 
coordinate space
when performing hit-testing. This underlying issue revealed itself when the 
page has a top content
inset applied, since then point is displaced and the wrong element is "hit".

When the scroll position is roughly the same as the size of the content inset, 
they cancel each other
out, which is why the bug only reproduces on some scroll offsets, and only on 
certain page layouts
when there's a selectable and non-selectable element vertically near each other.

Fix by using the correct coordinate space.

Test: Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture 
Tests/BasicAppKitGesturesTests.swift

* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::hitTestResultAtPoint const):
* Source/WebCore/page/EventHandler.h:
* Source/WebKit/WebProcess/WebPage/Cocoa/PositionInformationForWebPage.mm:
(WebKit::selectionPositionInformation):
(WebKit::textInteractionPositionInformation):
(WebKit::positionInformationForWebPage):
* Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture 
Tests/BasicAppKitGesturesTests.swift:
(AppKitGesturesTests.doubleClickingSelectsWordWhenScrolledToTopWithObscuredContentInset):

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



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

Reply via email to