[webkit-changes] [WebKit/WebKit] f5b5a3: Use `_UITextCursorDragAnimator` to animate the car...

Wenson Hsieh noreply at github.com
Mon Oct 23 16:37:57 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f5b5a33d6f129ebae5acab64dfff3e0e481283b7
      https://github.com/WebKit/WebKit/commit/f5b5a33d6f129ebae5acab64dfff3e0e481283b7
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-10-23 (Mon, 23 Oct 2023)

  Changed paths:
    M Source/WTF/wtf/PlatformHave.h
    M Source/WebKit/Platform/spi/ios/UIKitSPI.h
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

  Log Message:
  -----------
  Use `_UITextCursorDragAnimator` to animate the caret view when dropping over editable content
https://bugs.webkit.org/show_bug.cgi?id=263540
rdar://114331535

Reviewed by Megan Gardner.

Adopt `_UITextCursorDragAnimator` and use it to display the "drop caret" when hovering over an
editable element on iOS, with an active drag session (we currently use `_UITextDragCaretView`). The
new animator works similarly, taking `UITextPosition`s that can be used to update the caret position
when the drop position changes; however, it must be initialized with a `UIView<UITextCursorView>`,
which we can indirectly create by

* Source/WTF/wtf/PlatformHave.h:

Add a new compile-time flag.

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

Import the requisite header for `_UITextCursorDragAnimator`.

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

Use the new animator only if `UseAsyncUIKitInteractions` is set, and the animator class is available
at runtime.

(-[WKContentView cleanUpDragSourceSessionState]):
(-[WKContentView _insertDropCaret:]):
(-[WKContentView _removeDropCaret]):

Consolidate logic for tearing down the drop caret in a single method, now that it needs to take care
of both the legacy `_UITextDragCaretView` and the modern `_UITextCursorDragAnimator` /
`UIView<UITextCursorView>`.

(-[WKContentView _didChangeDragCaretRect:currentRect:]):

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




More information about the webkit-changes mailing list