[webkit-changes] [WebKit/WebKit] 31091c: Play Animation and Pause Animation action sheet it...

Tyler Wilcock noreply at github.com
Tue May 2 11:14:43 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 31091c93475d4d29c78644b5ec7787e4594b28c2
      https://github.com/WebKit/WebKit/commit/31091c93475d4d29c78644b5ec7787e4594b28c2
  Author: Tyler Wilcock <tyler_w at apple.com>
  Date:   2023-05-02 (Tue, 02 May 2023)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/dom/ElementAnimationContext.h
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/Shared/ios/InteractionInformationAtPosition.h
    M Source/WebKit/Shared/ios/InteractionInformationAtPosition.serialization.in
    M Source/WebKit/Shared/ios/InteractionInformationRequest.cpp
    M Source/WebKit/Shared/ios/InteractionInformationRequest.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm
    M Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfo.mm
    M Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h
    M Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/WebKitCocoa/img-animation-covered-by-link.html
    M Tools/TestWebKitAPI/Tests/ios/ActionSheetTests.mm

  Log Message:
  -----------
  Play Animation and Pause Animation action sheet items don't appear when a sibling link covers the animation
https://bugs.webkit.org/show_bug.cgi?id=255953
rdar://problem/108524363

Reviewed by Wenson Hsieh.

When an image animation has a DOM sibling anchor that covers it via CSS, that sibling anchor can become the
primary interaction node for a long-press, meaning the Play Animation and Pause Animation actions won't appear
despite the animation being underneath the hit test.

With this patch, we add a new InteractionInformationRequest flag: `gatherAnimations`. This flag is used as a
signal to collect multiple elements in the hit test traversal, and then roll any animations in this element
collection into a new `InteractionInformationAtPosition::animationsAtPoint` field. We now show Play Animation
and Pause Animation both if the primary interaction node is an animation (as happens prior to this patch), and
when there any animations under the hit-test point (new to this patch).

Then, when Play Animation or Pause Animation is selected, WKActionSheetAssistant sends the action to all animations
in the list.

New ActionSheetTests.PlayPauseAnimationCoveredByLink API test added to cover this behavior change.

* Source/WebCore/dom/ElementAnimationContext.h:
Added. Represents an ElementContext plus animation state.
* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
Add ElementAnimationContext.h.

* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
(WebCore::ElementAnimationContext::ElementAnimationContext):
* Source/WebKit/Scripts/webkit/messages.py:
(headers_for_type):
Add serialization constructs for ElementAnimationContext.

* Source/WebKit/Shared/ios/InteractionInformationAtPosition.h:
* Source/WebKit/Shared/ios/InteractionInformationAtPosition.serialization.in:
* Source/WebKit/Shared/ios/InteractionInformationRequest.cpp:
(WebKit::InteractionInformationRequest::encode const):
(WebKit::InteractionInformationRequest::decode):
(WebKit::InteractionInformationRequest::isValidForRequest const):
Handle new `gatherAnimations` flag.

* Source/WebKit/Shared/ios/InteractionInformationRequest.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _allowAnimationControls]): Added.
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _allowAnimationControlsForTesting]): Deleted.
Replaced by -[WKWebView _allowAnimationControls].

* Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
(-[_WKActivatedElementInfo _initWithInteractionInformationAtPosition:isUsingAlternateURLForImage:userInfo:]):
(-[_WKActivatedElementInfo _initWithType:URL:imageURL:image:userInfo:information:]):
(-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:imageMIMEType:isAnimatedImage:isAnimating:canShowAnimationControls:animationsUnderElement:userInfo:]):
(-[_WKActivatedElementInfo _animationsUnderElement]):
(-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:imageMIMEType:isAnimatedImage:isAnimating:canShowAnimationControls:userInfo:]): Deleted.
* Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h:
* Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant _appendAnimationAction:elementInfo:]):
(-[WKActionSheetAssistant handleElementActionWithType:element:needsInteraction:]):
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView gestureRecognizerShouldBegin:]):
(-[WKContentView positionInformationForActionSheetAssistant:]):
(-[WKContentView updatePositionInformationForActionSheetAssistant:]):
(-[WKContentView _actionSheetAssistant:performAction:onElements:]):
(-[WKContentView _allowAnimationControls]): Added.
(-[WKContentView _contextMenuInteraction:configurationForMenuAtLocation:completion:]):
(-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
(-[WKContentView _allowAnimationControlsForTesting]): Deleted.
Replaced by -[WKWebView _allowAnimationControls].

* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::performActionOnElements):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::imagePositionInformation):
(WebKit::animationPositionInformation):
(WebKit::WebPage::positionInformation):
(WebKit::handleAnimationActions):
(WebKit::WebPage::performActionOnElement):
(WebKit::WebPage::performActionOnElements): Added.
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/img-animation-covered-by-link.html: Added.
* Tools/TestWebKitAPI/Tests/ios/ActionSheetTests.mm:
Add new test: ActionSheetTests.PlayPauseAnimationCoveredByLink
(-[TestWKWebViewForAnimationControls _allowAnimationControls]):
(TestWebKitAPI::playPauseAnimationTest): Added.
(-[TestWKWebViewForAnimationControls _allowAnimationControlsForTesting]): Deleted.
Replaced by -[WKWebView _allowAnimationControls].

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




More information about the webkit-changes mailing list