RESOLVED FIXED Bug 201371
Provide a prototype for AR QuickLook to trigger processing in the originating page
https://bugs.webkit.org/show_bug.cgi?id=201371
Summary Provide a prototype for AR QuickLook to trigger processing in the originating...
Dean Jackson
Reported 2019-08-30 18:07:31 PDT
Provide a prototype for AR QuickLook to trigger processing in the originating page
Attachments
Patch (5.38 KB, patch)
2019-08-30 18:17 PDT, Dean Jackson
no flags
Patch (5.38 KB, patch)
2019-08-31 12:42 PDT, Dean Jackson
no flags
Patch (5.37 KB, patch)
2019-08-31 13:52 PDT, Dean Jackson
no flags
Patch (44.01 KB, patch)
2019-09-11 18:10 PDT, Dean Jackson
no flags
Patch (1.33 KB, patch)
2019-09-17 09:22 PDT, Jonathan Bedard
no flags
Dean Jackson
Comment 1 2019-08-30 18:16:13 PDT
Dean Jackson
Comment 2 2019-08-30 18:17:13 PDT
Anders Carlsson
Comment 3 2019-08-31 09:51:29 PDT
(In reply to Dean Jackson from comment #2) > Created attachment 377776 [details] > Patch Looks like iOS is broken.
Dean Jackson
Comment 4 2019-08-31 12:42:01 PDT
Dean Jackson
Comment 5 2019-08-31 13:52:42 PDT
Sam Weinig
Comment 6 2019-08-31 15:31:18 PDT
Comment on attachment 377806 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=377806&action=review > Source/WebKit/ChangeLog:12 > + Provide a way for a Web page to know if a particular action in the AR scene > + was performed, if and only if the system AR library calls a delegate with > + particular parameters. Post a message to the window on the main frame > + to indicate the action was triggered. Why the mainframe? Can a AR QuickLook be triggered only from a mainframe? > Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:161 > + NSString *javaScriptString = [NSString stringWithFormat:@"window.postMessage({_origin: '_apple_ar_quicklook' , action: 'buttonTapped'}, window.location.origin);"]; > + _previewController->page().runJavaScriptInMainFrame(javaScriptString, true, [](API::SerializedScriptValue*, bool, const WebCore::ExceptionDetails&, WebKit::ScriptValueCallback::Error) { }); > + } Is there any chance the page has navigated since quicklook started? It would be good to either defend agains that or assert that it didn't happen.
Wenson Hsieh
Comment 7 2019-08-31 15:48:31 PDT
Comment on attachment 377806 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=377806&action=review > Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:73 > +- (instancetype)initWithSystemPreviewController:(WebKit::SystemPreviewController*)previewController MIMEType:(NSString*)mimeType originatingPageURL:(URL)url Nit - do we ever expect the previewController to be null? If not, perhaps this should take a reference.
Simon Fraser (smfr)
Comment 8 2019-08-31 17:03:41 PDT
Comment on attachment 377806 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=377806&action=review > Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:158 > + if ([[message[@"callToAction"] description] isEqualToString:@"buttonTapped"]) { -description is generally used for debugging and might contain all kinds of junk (addresses, class names).
Dean Jackson
Comment 9 2019-09-11 18:10:55 PDT
Simon Fraser (smfr)
Comment 10 2019-09-13 12:00:27 PDT
Comment on attachment 378606 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=378606&action=review > Source/WebCore/html/HTMLAnchorElement.cpp:489 > + systemPreviewInfo.globalFrameID.frameID = document().frame()->loader().client().frameID().valueOr(FrameIdentifier { }); > + systemPreviewInfo.globalFrameID.pageID = document().frame()->loader().client().pageID().valueOr(PageIdentifier { }); Weird flex but OK. Not sure why the PageIdentifier and FrameIdentifiers aren't on Page and Frame. Chris? > Source/WebCore/loader/FrameLoaderTypes.h:185 > + IntRect previewRect; What coordinate system is this rect in? > Source/WebKit/UIProcess/SystemPreviewController.h:65 > + void triggerSystemPreviewActionWithTarget(uint64_t frameID, uint64_t pageID); Maybe put "ForTesting" in the name
Dean Jackson
Comment 11 2019-09-13 14:43:42 PDT
Ryan Haddad
Comment 12 2019-09-13 16:44:34 PDT
(In reply to Dean Jackson from comment #11) > Committed r249855: <https://trac.webkit.org/changeset/249855> TestWebKitAPI.WebKit.SystemPreviewTriggered (added with this change) is timing out on the iOS Simulator bots: https://build.webkit.org/builders/Apple%20iOS%2012%20Simulator%20Release%20WK2%20(Tests)/builds/6364
Jonathan Bedard
Comment 13 2019-09-13 17:41:58 PDT
This breaks the iOS 13 OpenSource build...perhaps it needs <https://trac.webkit.org/changeset/249859/webkit>? Or an SPI declaration for ARQuickLookWebKitItemDelegate?
Jonathan Bedard
Comment 14 2019-09-17 09:22:38 PDT
Reopening to attach new patch.
Jonathan Bedard
Comment 15 2019-09-17 09:22:39 PDT
Jonathan Bedard
Comment 16 2019-09-17 09:25:38 PDT
Wenson Hsieh
Comment 17 2019-09-23 09:31:23 PDT
Comment on attachment 378606 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=378606&action=review > Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:508 > +- (void)_triggerSystemPreviewActionOnFrame:(uint64_t)frameID page:(uint64_t)pageID WK_API_AVAILABLE(ios(13.0)); Should this be WK_IOS_TBA?
Note You need to log in before you can comment on or make changes to this bug.