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 617bad3cd641e9a7bf1e4b5b9079f621ea4ba1c1..9ad9702945948e0fd9c7b94c2dbaf48d4ec15114 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
@@ -37,7 +37,6 @@ |
#include "core/dom/DOMException.h" |
#include "core/dom/ElementTraversal.h" |
#include "core/dom/ElementVisibilityObserver.h" |
-#include "core/dom/Fullscreen.h" |
#include "core/dom/TaskRunnerHelper.h" |
#include "core/dom/shadow/ShadowRoot.h" |
#include "core/events/Event.h" |
@@ -482,6 +481,8 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, |
addElementToDocumentMap(this, &document); |
UseCounter::count(document, UseCounter::HTMLMediaElement); |
+ |
+ Fullscreen::from(document).registerObserver(this); |
} |
HTMLMediaElement::~HTMLMediaElement() { |
@@ -492,6 +493,8 @@ HTMLMediaElement::~HTMLMediaElement() { |
// the AudioNode is destructed, m_audioSourceNode is explicitly cleared |
// even if the AudioNode and the HTMLMediaElement die together. |
DCHECK(!m_audioSourceNode); |
+ |
+ Fullscreen::from(document()).removeObserver(this); |
} |
void HTMLMediaElement::dispose() { |
@@ -4098,4 +4101,23 @@ IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() |
return result; |
} |
+void HTMLMediaElement::onEnteredFullscreen() { |
+ if (!webMediaPlayer()) |
+ return; |
+ if (isFullscreen()) |
+ return; |
+ |
+ Element* fullscreenElement = |
+ Fullscreen::currentFullScreenElementFrom(document()); |
+ if (fullscreenElement->isShadowIncludingInclusiveAncestorOf(this) && |
+ clientWidth() >= document().domWindow()->innerWidth() * 0.9 && |
+ clientHeight() >= document().domWindow()->innerHeight() * 0.9) |
+ webMediaPlayer()->enteredFullWindow(); |
+} |
+ |
+void HTMLMediaElement::onExitedFullscreen() { |
+ if (webMediaPlayer()) |
+ webMediaPlayer()->exitedFullWindow(); |
+} |
+ |
} // namespace blink |