RESOLVED FIXED 202214
Update API availability for autoplay event
https://bugs.webkit.org/show_bug.cgi?id=202214
Summary Update API availability for autoplay event
Luming Yin
Reported 2019-09-25 11:14:17 PDT
Attachments
Patch (5.92 KB, patch)
2019-09-25 11:18 PDT, Luming Yin
no flags
Patch (6.40 KB, patch)
2019-09-25 11:45 PDT, Luming Yin
no flags
Patch (33.71 KB, patch)
2019-09-25 14:48 PDT, Luming Yin
no flags
Patch (49.94 KB, patch)
2019-09-30 15:45 PDT, Luming Yin
no flags
Patch (49.86 KB, patch)
2019-09-30 18:21 PDT, Luming Yin
no flags
Patch (51.98 KB, patch)
2020-01-06 07:20 PST, Luming Yin
no flags
Patch (28.65 KB, patch)
2020-01-14 15:54 PST, Luming Yin
no flags
Luming Yin
Comment 1 2019-09-25 11:18:52 PDT
Wenson Hsieh
Comment 2 2019-09-25 11:26:16 PDT
Comment on attachment 379562 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379562&action=review > Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h:213 > +- (void)_webView:(WKWebView *)webView handleAutoplayEvent:(_WKAutoplayEvent)event withFlags:(_WKAutoplayEventFlags)flags WK_API_AVAILABLE(macos(10.13.4), ios(WK_IOS_TBA)); It looks like this should be moved into a cross-platform part of the header as well.
Tim Horton
Comment 3 2019-09-25 11:26:42 PDT
Comment on attachment 379562 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379562&action=review > Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h:213 > +- (void)_webView:(WKWebView *)webView handleAutoplayEvent:(_WKAutoplayEvent)event withFlags:(_WKAutoplayEventFlags)flags WK_API_AVAILABLE(macos(10.13.4), ios(WK_IOS_TBA)); I think this is in the wrong section? it's in an #else of a #if TARGET_OS_IPHONE
Tim Horton
Comment 4 2019-09-25 11:27:35 PDT
Comment on attachment 379562 [details] Patch Also, is there a test for this you can enable on iOS now?
Luming Yin
Comment 5 2019-09-25 11:45:45 PDT
Luming Yin
Comment 6 2019-09-25 11:50:00 PDT
(In reply to Wenson Hsieh from comment #2) > Comment on attachment 379562 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=379562&action=review > > > Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h:213 > > +- (void)_webView:(WKWebView *)webView handleAutoplayEvent:(_WKAutoplayEvent)event withFlags:(_WKAutoplayEventFlags)flags WK_API_AVAILABLE(macos(10.13.4), ios(WK_IOS_TBA)); > > It looks like this should be moved into a cross-platform part of the header > as well. (In reply to Tim Horton from comment #3) > Comment on attachment 379562 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=379562&action=review > > > Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h:213 > > +- (void)_webView:(WKWebView *)webView handleAutoplayEvent:(_WKAutoplayEvent)event withFlags:(_WKAutoplayEventFlags)flags WK_API_AVAILABLE(macos(10.13.4), ios(WK_IOS_TBA)); > > I think this is in the wrong section? it's in an #else of a #if > TARGET_OS_IPHONE Oops, it's indeed in the wrong section! Updated my patch to move it to cross-platform part of the header. (In reply to Tim Horton from comment #4) > Comment on attachment 379562 [details] > Patch > > Also, is there a test for this you can enable on iOS now? It doesn't seem like there's any test(s) for this API. Are WebKit tests in a separate repository?
Wenson Hsieh
Comment 7 2019-09-25 11:57:51 PDT
(In reply to Luming Yin from comment #6) > (In reply to Tim Horton from comment #4) > > Comment on attachment 379562 [details] > > Patch > > > > Also, is there a test for this you can enable on iOS now? > > It doesn't seem like there's any test(s) for this API. Are WebKit tests in a > separate repository? In a separate project, Tools/TestWebKitAPI. You may want to take a look at WebsitePolicies.mm. I think you might need some additional changes to get this working for iOS though (e.g., UIClient::handleAutoplayEvent is macOS-only right now).
Luming Yin
Comment 8 2019-09-25 14:48:57 PDT
Luming Yin
Comment 9 2019-09-30 15:45:22 PDT
Luming Yin
Comment 10 2019-09-30 15:46:28 PDT
(In reply to Tim Horton from comment #4) > Comment on attachment 379562 [details] > Patch > > Also, is there a test for this you can enable on iOS now? Patch updated to enable relevant API tests on iOS.
Luming Yin
Comment 11 2019-09-30 18:21:56 PDT
Wenson Hsieh
Comment 12 2019-10-07 21:01:56 PDT
Comment on attachment 379869 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=379869&action=review > Source/WebCore/page/Quirks.cpp:-109 > - auto host = m_document->topDocument().url().host(); > - return equalLettersIgnoringASCIICase(host, "netflix.com") || host.endsWithIgnoringASCIICase(".netflix.com"); Just to double check — would we not need this quirk on iOS anymore because it will be handled by Safari? > Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:848 > +void WebPage::simulateTap(const IntPoint& point, OptionSet<WebEvent::Modifier> modifiers) > +{ > + FloatPoint adjustedPoint; > + Node* nodeRespondingToClick = m_page->mainFrame().nodeRespondingToClickEvents(point, adjustedPoint); > + if (nodeRespondingToClick) > + handleSyntheticClick(*nodeRespondingToClick, adjustedPoint, modifiers); > +} Hm…I think we generally try to avoid deep testing hooks like this if we can, and mostly limit interaction-related testing hooks such as this to the UI process (commonly, WKContentViewInteraction and WKWebView). That said, I recall that this was difficult in API tests due to how there are `lastLayerTreeTransactionId` checks throughout WebPageIOS that fail due to `lastLayerTreeTransactionId ` being 0. If that’s the case, could we additionally synthesize touch events by calling into -_webTouchEventsRecognized: (or add a simple hook to do so) before sending the click? I think that /might/ be slightly cleaner than adding a different testing codepath in the web process for simulating clicks.
Luming Yin
Comment 13 2020-01-06 07:20:53 PST
Luming Yin
Comment 14 2020-01-06 07:24:53 PST
(In reply to Wenson Hsieh from comment #12) > Comment on attachment 379869 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=379869&action=review > > > Source/WebCore/page/Quirks.cpp:-109 > > - auto host = m_document->topDocument().url().host(); > > - return equalLettersIgnoringASCIICase(host, "netflix.com") || host.endsWithIgnoringASCIICase(".netflix.com"); > > Just to double check — would we not need this quirk on iOS anymore because > it will be handled by Safari? Oops, I just double checked, and we do in fact still need this quirk on iOS. I've Added the quirk back. > > > Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:848 > > +void WebPage::simulateTap(const IntPoint& point, OptionSet<WebEvent::Modifier> modifiers) > > +{ > > + FloatPoint adjustedPoint; > > + Node* nodeRespondingToClick = m_page->mainFrame().nodeRespondingToClickEvents(point, adjustedPoint); > > + if (nodeRespondingToClick) > > + handleSyntheticClick(*nodeRespondingToClick, adjustedPoint, modifiers); > > +} > > Hm…I think we generally try to avoid deep testing hooks like this if we can, > and mostly limit interaction-related testing hooks such as this to the UI > process (commonly, WKContentViewInteraction and WKWebView). > > That said, I recall that this was difficult in API tests due to how there > are `lastLayerTreeTransactionId` checks throughout WebPageIOS that fail due > to `lastLayerTreeTransactionId ` being 0. If that’s the case, could we > additionally synthesize touch events by calling into > -_webTouchEventsRecognized: (or add a simple hook to do so) before sending > the click? I think that /might/ be slightly cleaner than adding a different > testing codepath in the web process for simulating clicks. This is indeed the case! Generating synthetic taps in the UI process is difficult due to various `lastLayerTreeTransactionId` checks. I also tried to use _WKTouchEventGenerator to generate touches, but when running the headless WebKit API tests, [UIApplication sharedApplication] returns nil, so there’s no way to get the associated contextID, meaning this also isn't a valid option. I've updated the patch to synthesize touch events by calling into -_webTouchEventsRecognized: before sending the click.
Luming Yin
Comment 15 2020-01-14 15:54:22 PST
Tim Horton
Comment 16 2020-01-14 16:09:27 PST
Please check with media folks
Jer Noble
Comment 17 2020-01-14 16:12:29 PST
(In reply to Tim Horton from comment #16) > Please check with media folks No problem from the media folks. Fewer unnecessary platform-specific blocks of code is definitely better.
EWS
Comment 18 2020-01-14 16:15:35 PST
Comment on attachment 387716 [details] Patch Rejecting attachment 387716 [details] from commit-queue. luming_yin@apple.com does not have committer permissions according to https://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/contributors.json. - If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags. - If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/contributors.json by adding yourself to the file (no review needed). The commit-queue restarts itself every 2 hours. After restart the commit-queue will correctly respect your committer rights.
WebKit Commit Bot
Comment 19 2020-01-14 17:16:11 PST
The commit-queue encountered the following flaky tests while processing attachment 387716 [details]: editing/spelling/spellcheck-async-remove-frame.html bug 158401 (authors: morrita@google.com, rniwa@webkit.org, and tony@chromium.org) The commit-queue is continuing to process your patch.
WebKit Commit Bot
Comment 20 2020-01-14 17:16:31 PST
The commit-queue encountered the following flaky tests while processing attachment 387716 [details]: editing/spelling/spellcheck-attribute.html bug 206178 (authors: g.czajkowski@samsung.com, mark.lam@apple.com, and rniwa@webkit.org) The commit-queue is continuing to process your patch.
WebKit Commit Bot
Comment 21 2020-01-14 18:22:02 PST
Comment on attachment 387716 [details] Patch Clearing flags on attachment: 387716 Committed r254553: <https://trac.webkit.org/changeset/254553>
WebKit Commit Bot
Comment 22 2020-01-14 18:22:04 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.