[webkit-changes] [WebKit/WebKit] 9a8207: AX: Play Animation and Pause Animation actions don...

Tyler Wilcock noreply at github.com
Mon Apr 24 11:38:00 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9a8207739bc98ae6aa05f346c725246ab5d7d4a5
      https://github.com/WebKit/WebKit/commit/9a8207739bc98ae6aa05f346c725246ab5d7d4a5
  Author: Tyler Wilcock <tyler_w at apple.com>
  Date:   2023-04-24 (Mon, 24 Apr 2023)

  Changed paths:
    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/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 Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/WebKitCocoa/animated-red-green-blue-repeat-infinite.gif
    A Tools/TestWebKitAPI/Tests/WebKitCocoa/img-animation-in-anchor.html
    M Tools/TestWebKitAPI/Tests/ios/ActionSheetTests.mm

  Log Message:
  -----------
  AX: Play Animation and Pause Animation actions don't appear for animations with a link parent element
https://bugs.webkit.org/show_bug.cgi?id=255758
rdar://108350118

Reviewed by Andres Gonzalez.

This happened because we only tried to append these actions inside `-[WKActionSheetAssistant showImageSheet]`.
But when an animation has a direct anchor parent like so:

<a href="#foo">
    <img src="animated-red-green-blue-repeat-infinite.gif" width="223" height="223">
</a>

`-[WKActionSheetAssistant defaultActionsForLinkSheet:]` is what actually gets called. We need to surface these
actions in this case, too.

This patch also fixes another bug where `isAnimatedImage`, `isAnimating`, and `canShowAnimationControls` were
not being copied from InteractionInformationAtPosition to _WKActivatedElementInfo in every scenario, which
prevented Play Animation and Pause Animation from showing.

To remedy this, better `-[_WKActivatedElementInfo _initWithType ...]` overrides were added. Most callsites of _initWithType
took all but 1-3 parameters from InteractionInformationAtPosition. These new overrides simplify these callsites by taking
any custom parameters for the callsite and filling the rest of the information in with a InteractionInformationAtPosition instance.
This has the added benefit of ensuring `isAnimatedImage`, `isAnimating`, and `canShowAnimationControls` are always copied
end-to-end.

PlayPauseAnimationInsideLink API test added to cover this behavior.

* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _allowAnimationControlsForTesting]):
* Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfo.mm:
(-[_WKActivatedElementInfo _initWithType:URL:information:]):
(-[_WKActivatedElementInfo _initWithType:image:information:]):
(-[_WKActivatedElementInfo _initWithType:URL:imageURL:information:]):
(-[_WKActivatedElementInfo _initWithType:URL:image:information:]):
(-[_WKActivatedElementInfo _initWithType:URL:imageURL:userInfo:information:]):
(-[_WKActivatedElementInfo _initWithType:URL:imageURL:image:userInfo:information:]):
(-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:imageMIMEType:isAnimatedImage:isAnimating:canShowAnimationControls:userInfo:]):
(-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:imageMIMEType:]): Deleted.
(-[_WKActivatedElementInfo _initWithType:URL:imageURL:location:title:ID:rect:image:imageMIMEType:userInfo:]): Deleted.
* Source/WebKit/UIProcess/API/Cocoa/_WKActivatedElementInfoInternal.h:
* Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h:
* Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant showImageSheet]):
(-[WKActionSheetAssistant _appendAnimationAction:elementInfo:]):
(-[WKActionSheetAssistant defaultActionsForLinkSheet:]):
(-[WKActionSheetAssistant defaultActionsForImageSheet:]):
(-[WKActionSheetAssistant showLinkSheet]):
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _showAttachmentSheet]):
(-[WKContentView _allowAnimationControlsForTesting]):
(-[WKContentView _dataForPreviewItemController:atPosition:type:]):
(-[WKContentView _presentedViewControllerForPreviewItemController:]):
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/animated-red-green-blue-repeat-infinite.gif: Added.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/img-animation-in-anchor.html: Added.
* Tools/TestWebKitAPI/Tests/ios/ActionSheetTests.mm:
(-[TestWKWebViewForAnimationControls _allowAnimationControlsForTesting]):
(TestWebKitAPI::performLongPressAction):
(TestWebKitAPI::TEST):

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




More information about the webkit-changes mailing list