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

Unified Diff: third_party/WebKit/Source/core/html/shadow/MediaControlsOrientationLockDelegate.cpp

Issue 2793273002: Use internal hooks for notifying fullscreen changes to media controls (Closed)
Patch Set: update more tests Created 3 years, 8 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/shadow/MediaControlsOrientationLockDelegate.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlsOrientationLockDelegate.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControlsOrientationLockDelegate.cpp
index 71d89b35e4e776ac71a0738f96e19a9387791acd..ca8e1e597b25fa4ecc147382d7a4d53d232a0ee0 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlsOrientationLockDelegate.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlsOrientationLockDelegate.cpp
@@ -71,22 +71,26 @@ MediaControlsOrientationLockDelegate::MediaControlsOrientationLockDelegate(
void MediaControlsOrientationLockDelegate::attach() {
DCHECK(videoElement().isConnected());
- document().addEventListener(EventTypeNames::fullscreenchange, this, true);
- videoElement().addEventListener(EventTypeNames::webkitfullscreenchange, this,
- true);
videoElement().addEventListener(EventTypeNames::loadedmetadata, this, true);
}
void MediaControlsOrientationLockDelegate::detach() {
DCHECK(!videoElement().isConnected());
- document().removeEventListener(EventTypeNames::fullscreenchange, this, true);
- videoElement().removeEventListener(EventTypeNames::webkitfullscreenchange,
- this, true);
videoElement().removeEventListener(EventTypeNames::loadedmetadata, this,
true);
}
+void MediaControlsOrientationLockDelegate::didEnterFullscreen() {
+ if (m_state == State::PendingFullscreen)
+ maybeLockOrientation();
+}
+
+void MediaControlsOrientationLockDelegate::didExitFullscreen() {
+ if (m_state != State::PendingFullscreen)
+ maybeUnlockOrientation();
+}
+
bool MediaControlsOrientationLockDelegate::operator==(
const EventListener& other) const {
return this == &other;
@@ -151,19 +155,6 @@ Document& MediaControlsOrientationLockDelegate::document() const {
void MediaControlsOrientationLockDelegate::handleEvent(
ExecutionContext* executionContext,
Event* event) {
- if (event->type() == EventTypeNames::fullscreenchange ||
- event->type() == EventTypeNames::webkitfullscreenchange) {
- if (videoElement().isFullscreen()) {
- if (m_state == State::PendingFullscreen)
- maybeLockOrientation();
- } else {
- if (m_state != State::PendingFullscreen)
- maybeUnlockOrientation();
- }
-
- return;
- }
-
if (event->type() == EventTypeNames::loadedmetadata) {
if (m_state == State::PendingMetadata)
maybeLockOrientation();

Powered by Google App Engine
This is Rietveld 408576698