Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: eb23c6ac8bad7d2cbd9cb6e03a41fabb2cbbea68
https://github.com/WebKit/WebKit/commit/eb23c6ac8bad7d2cbd9cb6e03a41fabb2cbbea68
Author: Wenson Hsieh <[email protected]>
Date: 2024-12-09 (Mon, 09 Dec 2024)
Changed paths:
A
LayoutTests/editing/selection/ios/bidi-visually-contiguous-selection-3-expected.txt
A
LayoutTests/editing/selection/ios/bidi-visually-contiguous-selection-3.html
M Source/WebKit/Scripts/webkit/messages.py
M Source/WebKit/Shared/ios/GestureTypes.h
M Source/WebKit/Shared/ios/GestureTypes.serialization.in
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
Log Message:
-----------
[iOS] Support visually contiguous bidi selection behavior for more text
interactions
https://bugs.webkit.org/show_bug.cgi?id=284303
rdar://141163441
Reviewed by Aditya Keerthi.
Deploy visually-contiguous bidi text selection support for the following text
interactions:
• Tap-and-a-half gesture
• Tap-and-drag gesture
• Trackpad (mouse) drag
While the user is actively modifying text selections, we ensure that the text
selection is visually
contiguous across bidi boundaries by having
`shouldDrawVisuallyContiguousBidiSelection()` return
`true`. When the text interaction is finished, we then adjust the bidi
selection boundaries (if
needed) to be both visually and logically contiguous.
To achieve this, we refactor some of the existing logic to toggle visually
contiguous bidi selection
behavior on `WebPage`, such that we keep track of the set of active text
interactions using a new
`OptionSet<TextInteractionSource>` on `WebPage`. When the first flag is added,
we enter visually-
contiguous bidi selection mode, and when we remove the last flag, we
automatically adjust the
selection to nearest visually- and logicaly-contiguous boundaries.
See below for more details.
*
LayoutTests/editing/selection/ios/bidi-visually-contiguous-selection-3-expected.txt:
Added.
* LayoutTests/editing/selection/ios/bidi-visually-contiguous-selection-3.html:
Added.
Add a layout test to exercise the tap-and-drag text interaction. I opted for
this one, since
trackpad/mouse simulation isn't currently supported in WebKitTestRunner, and
tap-and-half and tap-
and-drag both exercise the same codepath (but the latter is more simpler (and
probably more
reliable) to trigger.
* Source/WebKit/Scripts/webkit/messages.py:
(headers_for_type):
* Source/WebKit/Shared/ios/GestureTypes.h:
* Source/WebKit/Shared/ios/GestureTypes.serialization.in:
Add a new enum-class-backed option set type to represent whether the text
interaction is driven by
mouse or touch interactions.
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didBeginTouchPoint):
Rename `resetPotentialTapSecurityOrigin` to `didBeginTouchPoint`. In addition
to resetting the tap
security origin, this now also sets the `m_hasAnyActiveTouchPoints` flag (see
below).
(WebKit::WebPageProxy::resetPotentialTapSecurityOrigin): Deleted.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _touchEventsRecognized]):
(-[WKContentView
updateSelectionWithExtentPoint:withBoundary:completionHandler:]):
Pass in whether or not the selection update is triggered by a mouse- or
touch-based interaction.
Note that this is an option set (despite the fact that this specific IPC
message currently only
sends a single value) because the backing enum class type will be stored as an
option set in
`WebPage` anyways.
* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::updateSelectionWithExtentPointAndBoundary):
(WebKit::WebPageProxy::didReleaseAllTouchPoints):
Add a new IPC call to tell the webpage that all touch points have been released.
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::mouseEvent):
(WebKit::WebPage::didBeginTouchPoint):
Update `m_hasAnyActiveTouchPoints` in addition to resetting the potential tap
security origin.
(WebKit::WebPage::didCommitLoad):
Reset `m_hasAnyActiveTouchPoints` and `m_activeTextInteractionSources` when
committing a load.
(WebKit::WebPage::resetPotentialTapSecurityOrigin): Deleted.
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::shouldDrawVisuallyContiguousBidiSelection):
Make this return whether or not `m_activeTextInteractionSources` has any flags
set.
(WebKit::WebPage::addTextInteractionSources):
(WebKit::WebPage::removeTextInteractionSources):
Add helpers to add or remove active text interaction sources.
(WebKit::WebPage::updateSelectionWithTouches):
(WebKit::WebPage::updateSelectionWithExtentPointAndBoundary):
Update `m_activeTextInteractionSources` here, by adding the incoming text
interaction sources. Note
that this is invoked in response to both tap-and-a-half and tap-and-drag text
interaction gestures
as well as mouse drag, but (due to implementation details in UIKit) may be
invoked before or after
all touch points have been released in the former 2 cases (see below).
(WebKit::WebPage::didReleaseAllTouchPoints):
This is called when all of the active touch points are released from the web
view. Unset
`m_hasAnyActiveTouchPoints` and clear the active touch-based text interaction
flag.
(WebKit::WebPage::setShouldDrawVisuallyContiguousBidiSelection): Deleted.
Replaced by `(add|remove)TextInteractionSources`.
Canonical link: https://commits.webkit.org/287577@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes