Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 436e6d6b2318c0f44c208523663f145daafe3306
      
https://github.com/WebKit/WebKit/commit/436e6d6b2318c0f44c208523663f145daafe3306
  Author: Richard Robinson <[email protected]>
  Date:   2026-09-22 (Tue, 22 Sep 2026)

  Changed paths:
    M Source/WebCore/editing/FrameSelection.cpp
    M Source/WebCore/editing/FrameSelection.h
    M Source/WebCore/editing/VisibleSelection.cpp
    M Source/WebCore/editing/VisibleSelection.h
    M Source/WebCore/page/EventHandler.cpp
    M Source/WebCore/rendering/HitTestResult.h
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/Shared/Cocoa/GestureTypes.h
    M Source/WebKit/Shared/Cocoa/GestureTypes.serialization.in
    M Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/mac/WKTextSelectionController.h
    M Source/WebKit/UIProcess/mac/WKTextSelectionController.swift
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Source/WebKit/WebProcess/Plugins/PluginView.cpp
    M Source/WebKit/WebProcess/Plugins/PluginView.h
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
    M Tools/TestWebKitAPI/Helpers/cocoa/WebPage+Extras.swift
    M Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture 
Tests/AppKitGesturesTestsSupport.swift
    M Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture 
Tests/BasicAppKitGesturesTests.swift

  Log Message:
  -----------
  [AppKit Gestures] Shift-click does not extend text selection
https://bugs.webkit.org/show_bug.cgi?id=324622
rdar://187830190

Reviewed by Tim Horton.

The shift-click handling in `EventHandler::handleMousePressEventSingleClick` 
does not take effect
in the AppKit-gestures text interaction path.

Fix by handling the extension explicitly in the gesture path instead. Extending 
is already implemented
by `updateSelectionWithExtentPointAndBoundary`, which grows and shrinks the 
selection relative to
`m_initialSelection`, the range captured when the gesture began, but a 
shift-initiated gesture has
no such range since it anchors on the selection that already exists. This is 
resolved by adding a
`SelectionExtentAnchor` argument saying which of the two applies.

Refactor the shift-click extending handling logic that is currently in 
EventHandler into VisibleSelection
so that it can bow be re-used.

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

* Source/WebCore/editing/VisibleSelection.cpp:
(WebCore::textDistance):
(WebCore::VisibleSelection::endpointToPreserveWhenExtendedTo const):
* Source/WebCore/editing/VisibleSelection.h:
* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEventSingleClick):
(WebCore::textDistance): Deleted.
* Source/WebKit/Scripts/webkit/messages.py:
(headers_for_type):
* Source/WebKit/Shared/Cocoa/GestureTypes.h:
* Source/WebKit/Shared/Cocoa/GestureTypes.serialization.in:
* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/mac/WKTextSelectionController.h:
* Source/WebKit/UIProcess/mac/WKTextSelectionController.swift:
(WKTextSelectionController.reextendSelectionForAutoscrollIfNeeded):
(WKTextSelectionController.beginRangeSelection(at:with:modifiers:)):
(WKTextSelectionController.beginRangeSelection(at:with:)):
(WKTextSelectionController.continueRangeSelection(at:)):
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:

* Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture 
Tests/AppKitGesturesTestsSupport.swift:
(KeyboardModifiers.hidUsages):
(KeyboardModifiers.domNames):
(RCPEventStreamComposer.keyboardOrKeypadUsagePage):
(RCPEventStreamComposer.modifierDelay):
(RCPEventStreamComposer.holdingModifiers(_:_:)):
(KeyboardModifier.hidUsage): Deleted.
(KeyboardModifier.domName): Deleted.

Minor test infra improvements.

* Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture 
Tests/BasicAppKitGesturesTests.swift:
(AppKitGesturesTests.singleClickReportsHeldModifierKeys(_:)):
(AppKitGesturesTests.shiftClickAfterSelectionExtendsSelectionForward(_:)):
(AppKitGesturesTests.shiftClickBeforeSelectionExtendsSelectionBackward(_:)):
(AppKitGesturesTests.shiftClickInsideSelectionShrinksSelection(_:)):
(AppKitGesturesTests.shiftClickAfterCaretCreatesSelectionFromCaret):
(AppKitGesturesTests.clickWithoutShiftAfterSelectionReplacesSelection):

Tests.

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



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

Reply via email to