Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Unified Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2047433003: Update autoplay settings when moving media elements between documents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed nits in tests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/media/autoplay-document-move.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index 7beecb9dd4be9a28665ac847fe9e6f45f67b085f..3f464532bcb1ee93ae0a288175e545284155bb84 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -487,6 +487,16 @@ void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument)
{
DVLOG(MEDIA_LOG_LEVEL) << "didMoveToNewDocument(" << (void*)this << ")";
+ // If any experiment is enabled, then we want to enable a user gesture by
+ // default, otherwise the experiment does nothing.
+ bool oldDocumentRequiresUserGesture = (oldDocument.settings() && oldDocument.settings()->mediaPlaybackRequiresUserGesture())
+ || m_autoplayHelper->isExperimentEnabled();
+ bool newDocumentRequiresUserGesture = (document().settings() && document().settings()->mediaPlaybackRequiresUserGesture())
+ || m_autoplayHelper->isExperimentEnabled();
+ if (newDocumentRequiresUserGesture && !oldDocumentRequiresUserGesture) {
+ m_lockedPendingUserGesture = true;
+ }
+
if (m_shouldDelayLoadEvent) {
document().incrementLoadEventDelayCount();
// Note: Keeping the load event delay count increment on oldDocument that was added
« no previous file with comments | « third_party/WebKit/LayoutTests/media/autoplay-document-move.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698