RESOLVED FIXED 167355
TAKE 2: Pass down website autoplay policies to media elements
https://bugs.webkit.org/show_bug.cgi?id=167355
Summary TAKE 2: Pass down website autoplay policies to media elements
Matt Rajca
Reported 2017-01-23 18:28:22 PST
Website autoplay policies passed to the web frame loader should be respected by media elements. This is take 2 of https://bugs.webkit.org/show_bug.cgi?id=167132 with follow-up work from https://bugs.webkit.org/show_bug.cgi?id=167325 and fixes introduced in https://bugs.webkit.org/show_bug.cgi?id=167346 . If non-default autoplay policies are passed during navigation, prefer those to global preferences. If not, use the values specified in document settings.
Attachments
Patch (190.65 KB, patch)
2017-01-23 18:36 PST, Matt Rajca
no flags
Patch (190.37 KB, patch)
2017-01-24 11:31 PST, Matt Rajca
no flags
Matt Rajca
Comment 1 2017-01-23 18:36:08 PST
Alex Christensen
Comment 2 2017-01-24 10:58:42 PST
Comment on attachment 299566 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=299566&action=review > Source/WebCore/loader/DocumentLoader.h:471 > + std::optional<bool> m_audioPlaybackRequiresUserGesture; > + std::optional<bool> m_videoPlaybackRequiresUserGesture; I think this should be a 3-state enum, probably with a different name like m_audioPlaybackPolicy. enum class AutoplayPolicy { RequireUserGesture, AutoPlay, AutoPlayWithoutSound, Default, <-- This name might need to be more descriptive indicating that the policy hasn't been set by the WebsitePolicies so default to the Settings value. Maybe just a comment explaining this. etc. } These two could probably even be made into one enum > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:820 > +#if PLATFORM(MAC) Let's get rid of this now that it doesn't do anything for other platforms. > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:823 > + documentLoader->setAudioPlaybackRequiresUserGesture(std::optional<bool>()); std::nullopt
Matt Rajca
Comment 3 2017-01-24 11:31:00 PST
Matt Rajca
Comment 4 2017-01-24 11:31:54 PST
(In reply to comment #2) > Comment on attachment 299566 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=299566&action=review > > > Source/WebCore/loader/DocumentLoader.h:471 > > + std::optional<bool> m_audioPlaybackRequiresUserGesture; > > + std::optional<bool> m_videoPlaybackRequiresUserGesture; > > I think this should be a 3-state enum, probably with a different name like > m_audioPlaybackPolicy. > enum class AutoplayPolicy { > RequireUserGesture, > AutoPlay, > AutoPlayWithoutSound, > Default, <-- This name might need to be more descriptive indicating that > the policy hasn't been set by the WebsitePolicies so default to the Settings > value. Maybe just a comment explaining this. > etc. > } > These two could probably even be made into one enum Done. > > > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:820 > > +#if PLATFORM(MAC) > > Let's get rid of this now that it doesn't do anything for other platforms. Okay, and I made the tests run on iOS as well. > > > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:823 > > + documentLoader->setAudioPlaybackRequiresUserGesture(std::optional<bool>()); > > std::nullopt Not necessary with the changes above.
WebKit Commit Bot
Comment 5 2017-01-24 13:05:00 PST
Comment on attachment 299613 [details] Patch Clearing flags on attachment: 299613 Committed r211097: <http://trac.webkit.org/changeset/211097>
WebKit Commit Bot
Comment 6 2017-01-24 13:05:04 PST
All reviewed patches have been landed. Closing bug.
Matt Rajca
Comment 7 2017-01-24 13:12:10 PST
*** Bug 167346 has been marked as a duplicate of this bug. ***
Matt Rajca
Comment 8 2017-01-24 13:12:49 PST
*** Bug 167132 has been marked as a duplicate of this bug. ***
Matt Rajca
Comment 9 2017-01-24 13:13:22 PST
*** Bug 167325 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.