[webkit-changes] [WebKit/WebKit] 44a0df: [iOS] Stop using _UIHighlightView to show highligh...

Wenson Hsieh noreply at github.com
Mon Sep 18 16:30:39 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 44a0dfea8e7b82c1a64c0dcd5efe56d71abd5b5f
      https://github.com/WebKit/WebKit/commit/44a0dfea8e7b82c1a64c0dcd5efe56d71abd5b5f
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-09-18 (Mon, 18 Sep 2023)

  Changed paths:
    M Source/WebCore/platform/graphics/PathUtilities.cpp
    M Source/WebCore/platform/graphics/PathUtilities.h
    M Source/WebKit/Platform/spi/ios/UIKitSPI.h
    M Source/WebKit/SourcesCocoa.txt
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    A Source/WebKit/UIProcess/ios/WKTapHighlightView.h
    A Source/WebKit/UIProcess/ios/WKTapHighlightView.mm
    M Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj

  Log Message:
  -----------
  [iOS] Stop using _UIHighlightView to show highlights over DOM elements when tapping
https://bugs.webkit.org/show_bug.cgi?id=261691
rdar://115524347

Reviewed by Megan Gardner.

Replace uses of UIKit's `_UIHighlightView` with a WebKit-internal implementation instead:
`WKTapHighlightView`. This new view is (for the most part) a 1-1 drop-in replacement for
`_UIHighlightView`, and implements the same functionality.

See below for details.

* Source/WebCore/platform/graphics/PathUtilities.cpp:
(WebCore::PathUtilities::pathWithShrinkWrappedRects):

Add a helper to create shrink-wrapped rects from a list of rects and corner radii. This falls back
to the existing `pathWithShrinkWrappedRects` implementation in the case where the corner radii all
have the same value, and otherwise returns a combined `WebCore::Path` that consists of multiple
rounded rects, each with the given corner radii.

* Source/WebCore/platform/graphics/PathUtilities.h:
* Source/WebKit/Platform/spi/ios/UIKitSPI.h:

Remove now-unused SPI declarations for `_UIHighlightView`.

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

Replace `_highlightView` with `_tapHighlightView` (I opted to rename this ivar, to make its purpose
more obvious).

(tapHighlightBorderRadius):
(-[WKContentView _updateTapHighlight]):
(-[WKContentView tapHighlightViewRect]):
(-[WKContentView _showTapHighlight]):
(-[WKContentView _cancelInteraction]):
(-[WKContentView _fadeTapHighlightViewIfNeeded]):
(nsSizeForTapHighlightBorderRadius): Deleted.
* Source/WebKit/UIProcess/ios/WKTapHighlightView.h: Added.
* Source/WebKit/UIProcess/ios/WKTapHighlightView.mm: Added.
(-[WKTapHighlightView initWithFrame:]):
(-[WKTapHighlightView cleanUp]):
(-[WKTapHighlightView setColor:]):
(-[WKTapHighlightView setMinimumCornerRadius:]):
(-[WKTapHighlightView setCornerRadii:]):
(-[WKTapHighlightView setFrames:]):
(-[WKTapHighlightView setQuads:boundaryRect:]):
(-[WKTapHighlightView setFrame:]):
(-[WKTapHighlightView drawRect:]):
(-[WKTapHighlightView hitTest:withEvent:]):

Implement the drop-in replacement. Note that there is a subtle behavioral difference here: in the
case where either the corner radii are not all equal, or there is only one rect to highlight,
`_UIHighlightView` would have previously used continuous corners for the rounded rect; otherwise,
we'd fall back to WebKit's shrink-wrapping logic. This patch makes it so that we now only use the
WebKit shrink-wrapping codepath for both of the cases above.

* Source/WebKit/UIProcess/ios/WebProcessProxyIOS.mm:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::underlayColor const):
(WebKit::WebViewImpl::pageExtendedBackgroundColor const):
(WebKit::compositionHighlights):
(WebKit::compositionAnnotations):
(WebKit::WebViewImpl::setMarkedText):
(WebKit::WebViewImpl::updateMediaPlaybackControlsManager):
(WebKit::subscribeToTextInputNotifications):

Add various missing includes and `WebCore` namespacing due to changes in source unification order.

* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

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




More information about the webkit-changes mailing list