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

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

Issue 2411553003: Notify WebMediaPlayer when its ancestor enters/exists fullscreen. (Closed)
Patch Set: Rebased. Add FullscreenObserver. Created 4 years, 2 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
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
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698