Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b5e32a9849bc8cd13c9b3f451bf1db742e7d26f5
      
https://github.com/WebKit/WebKit/commit/b5e32a9849bc8cd13c9b3f451bf1db742e7d26f5
  Author: Richard Robinson <[email protected]>
  Date:   2026-06-01 (Mon, 01 Jun 2026)

  Changed paths:
    M Source/WebCore/html/HTMLInputElement.h
    M Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.h
    M Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.mm
    M 
Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.serialization.in
    M Source/WebKit/UIProcess/mac/WKAppKitGestureController.mm
    M Source/WebKit/UIProcess/mac/WKTextSelectionController.swift
    M Source/WebKit/WebProcess/WebPage/Cocoa/PositionInformationForWebPage.mm
    M Tools/TestWebKitAPI/Helpers/cocoa/WebPage+JavaScriptExpression.swift
    A Tools/TestWebKitAPI/Resources/cocoa/custom-slider.html
    M Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKitGesturesTests.swift

  Log Message:
  -----------
  [AppKit Gestures] Scrolling sometimes removes text selection
https://bugs.webkit.org/show_bug.cgi?id=316013
rdar://176988227

Reviewed by Abrar Rahman Protyasha.

This was happening because the mouse tracking gesture recognizer was being 
recognized when it should
not have been, resulting in a mouse press happening which then clears the 
selection.

Fix this by blocking the mouse tracking gesture recognizer on the pan gesture 
recognizer.
Consequently, the pan gesture recognizer needs to be changed to make its 
activation conditions more
limited.

This also requires special handling of elements such as range inputs to ensure 
that they still receive
the proper events instead of scrolling happening instead.

This also fixes a latent issue in WKTextSelectionController that was revealed 
incidentally with the above
changes; the selection should be considered changed if one of the previous or 
new visual data's is nil.

Tests: Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKitGesturesTests.swift

* Source/WebCore/html/HTMLInputElement.h:
* Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.h:
* Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::InteractionInformationAtPosition):
* Source/WebKit/Shared/Cocoa/InteractionInformationAtPosition.serialization.in:
* Source/WebKit/UIProcess/mac/WKAppKitGestureController.mm:
(-[WKAppKitGestureController _dragPressShouldBeginAtLocation:]):
(-[WKAppKitGestureController _panShouldBeginAtLocation:]):
(-[WKAppKitGestureController 
gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:]):
(-[WKAppKitGestureController 
gestureRecognizer:shouldRequireFailureOfGestureRecognizer:]):
(-[WKAppKitGestureController gestureRecognizerShouldBegin:]):
* Source/WebKit/UIProcess/mac/WKTextSelectionController.swift:
(WKTextSelectionController.moveInsertionCursor(to:placeAtWordBoundary:)):
* Source/WebKit/WebProcess/WebPage/Cocoa/PositionInformationForWebPage.mm:
(WebKit::selectionPositionInformation):
* Tools/TestWebKitAPI/Helpers/cocoa/WebPage+JavaScriptExpression.swift:
* Tools/TestWebKitAPI/Resources/cocoa/custom-slider.html: Added.
* Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKitGesturesTests.swift:
(AppKitGesturesTests.singleClickFiresPointerMouseAndClickEvents(_:)):
(AppKitGesturesTests.scrollingDoesNotRemoveTextSelection):
(AppKitGesturesTests.pressDragOverRangeInputChangesInputValue(_:)):
(AppKitGesturesTests.pressDragOnImageInitiatesDragAndDrop):
(AppKitGesturesTests.pressDragOverRangeInputChangesInputValue): Deleted.

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



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

Reply via email to