Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Async text interaction] Enable selection autoscrolling, and reveal the edit menu after scrolling #20104

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

whsieh
Copy link
Member

@whsieh whsieh commented Nov 7, 2023

92399f9

[Async text interaction] Enable selection autoscrolling, and reveal the edit menu after scrolling
https://bugs.webkit.org/show_bug.cgi?id=264337

Reviewed by Megan Gardner.

This patch works towards additional support for async text interaction (and input client), by
adding plumbing for the following:

1.  Plumbing to autoscroll to a given `point` in content view coordinates.
2.  Logic to reveal the edit menu after scrolling or zooming, only if the edit menu was previously
    presented. To know this, we add a new flag on the content view to keep track of whether the edit
    menu has been fully presented.

* Source/WebKit/Platform/spi/ios/UIKitSPI.h:

Add an SPI method declaration here, only so that we can call super in our existing implementation of
`-interactionAssistant`.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView interactionAssistant]):
(-[WKContentView willPresentEditMenuWithAnimator:]):
(-[WKContentView willDismissEditMenuWithAnimator:]):

Keep track of `_isPresentingEditMenu`, so that we can consult it in the `WKTextInteractionWrapper`
below to conditionally restore edit menu visibility.

(-[WKContentView isPresentingEditMenu]):
(-[WKContentView autoscrollToPoint:]):
(-[WKContentView cancelAutoscroll]):

Implement a new method to hook into platform selection autoscrolling support using
`UIAsyncTextInputClient`.

* Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.mm:
(SOFT_LINK_CLASS_OPTIONAL):
(-[WKTextInteractionWrapper initWithView:]):
(-[WKTextInteractionWrapper willStartScrollingOverflow]):
(-[WKTextInteractionWrapper didEndScrollingOverflow]):
(-[WKTextInteractionWrapper willStartScrollingOrZooming]):
(-[WKTextInteractionWrapper didEndScrollingOrZooming]):

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

1e1e9f3

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug   πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ›  gtk
βœ… πŸ§ͺ ios-wk2-wpt   πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  tv-sim
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch ⏳ πŸ›  jsc-mips
βœ… πŸ›  watch-sim ⏳ πŸ§ͺ jsc-mips-tests

@whsieh whsieh requested a review from cdumez as a code owner November 7, 2023 16:03
@whsieh whsieh self-assigned this Nov 7, 2023
@whsieh whsieh added the Platform Portability improvements and other general platform improvements not driven directly by site bugs. label Nov 7, 2023
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 7, 2023
@whsieh whsieh removed the merging-blocked Applied to prevent a change from being merged label Nov 7, 2023
@whsieh
Copy link
Member Author

whsieh commented Nov 7, 2023

ios-wk2 failures are legit β€” need to move the -cancelAutoscroll method back out of the HAVE(UI_ASYNC_TEXT_INTERACTION) section.

@whsieh whsieh added the merge-queue Applied to send a pull request to merge-queue label Nov 7, 2023
…he edit menu after scrolling

https://bugs.webkit.org/show_bug.cgi?id=264337

Reviewed by Megan Gardner.

This patch works towards additional support for async text interaction (and input client), by
adding plumbing for the following:

1.  Plumbing to autoscroll to a given `point` in content view coordinates.
2.  Logic to reveal the edit menu after scrolling or zooming, only if the edit menu was previously
    presented. To know this, we add a new flag on the content view to keep track of whether the edit
    menu has been fully presented.

* Source/WebKit/Platform/spi/ios/UIKitSPI.h:

Add an SPI method declaration here, only so that we can call super in our existing implementation of
`-interactionAssistant`.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView interactionAssistant]):
(-[WKContentView willPresentEditMenuWithAnimator:]):
(-[WKContentView willDismissEditMenuWithAnimator:]):

Keep track of `_isPresentingEditMenu`, so that we can consult it in the `WKTextInteractionWrapper`
below to conditionally restore edit menu visibility.

(-[WKContentView isPresentingEditMenu]):
(-[WKContentView autoscrollToPoint:]):
(-[WKContentView cancelAutoscroll]):

Implement a new method to hook into platform selection autoscrolling support using
`UIAsyncTextInputClient`.

* Source/WebKit/UIProcess/ios/WKTextInteractionWrapper.mm:
(SOFT_LINK_CLASS_OPTIONAL):
(-[WKTextInteractionWrapper initWithView:]):
(-[WKTextInteractionWrapper willStartScrollingOverflow]):
(-[WKTextInteractionWrapper didEndScrollingOverflow]):
(-[WKTextInteractionWrapper willStartScrollingOrZooming]):
(-[WKTextInteractionWrapper didEndScrollingOrZooming]):

Canonical link: https://commits.webkit.org/270343@main
@webkit-commit-queue
Copy link
Collaborator

Committed 270343@main (92399f9): https://commits.webkit.org/270343@main

Reviewed commits have been landed. Closing PR #20104 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 92399f9 into WebKit:main Nov 7, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform Portability improvements and other general platform improvements not driven directly by site bugs.
Projects
None yet
6 participants