Chromium Code Reviews| 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 1d90b0d8fedb9d495cd032a65a8c456d2a276532..7045eea94250d6ad31a307c6dc8f2ce020df35ef 100644 |
| --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| @@ -282,6 +282,11 @@ String preloadTypeToString(WebMediaPlayer::Preload preloadType) { |
| return String(); |
| } |
| +bool isCrossOrigin(Document& document) { |
| + const LocalFrame* frame = document.frame(); |
| + return frame && frame->isCrossOriginSubframe(); |
| +} |
| + |
| } // anonymous namespace |
| class HTMLMediaElement::AutoplayHelperClientImpl |
| @@ -471,6 +476,9 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, |
| // default, otherwise the experiment does nothing. |
| if ((document.settings() && |
| document.settings()->mediaPlaybackRequiresUserGesture()) || |
| + (document.settings() && isCrossOrigin(document) && |
|
whywhat
2016/11/16 17:37:17
is it this that you don't like? you could've had a
Zhiqiang Zhang (Slow)
2016/11/16 18:11:40
Already merged them into a helper function in my l
|
| + document.settings() |
| + ->mediaPlaybackInCrossOriginIframesRequiresUserGesture()) || |
| m_autoplayHelper->isExperimentEnabled()) { |
| m_lockedPendingUserGesture = true; |
| } |
| @@ -519,10 +527,17 @@ void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument) { |
| bool oldDocumentRequiresUserGesture = |
| (oldDocument.settings() && |
| oldDocument.settings()->mediaPlaybackRequiresUserGesture()) || |
| + (oldDocument.settings() && isCrossOrigin(oldDocument) && |
| + oldDocument.settings() |
| + ->mediaPlaybackInCrossOriginIframesRequiresUserGesture()) || |
| m_autoplayHelper->isExperimentEnabled(); |
| bool newDocumentRequiresUserGesture = |
| (document().settings() && |
| document().settings()->mediaPlaybackRequiresUserGesture()) || |
| + (document().settings() && isCrossOrigin(oldDocument) && |
| + document() |
| + .settings() |
| + ->mediaPlaybackInCrossOriginIframesRequiresUserGesture()) || |
| m_autoplayHelper->isExperimentEnabled(); |
| if (newDocumentRequiresUserGesture && !oldDocumentRequiresUserGesture) { |
| m_lockedPendingUserGesture = true; |