| Index: third_party/WebKit/Source/core/html/MediaCustomControlsFullscreenDetector.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/MediaCustomControlsFullscreenDetector.cpp b/third_party/WebKit/Source/core/html/MediaCustomControlsFullscreenDetector.cpp
|
| index 0d5a4ae6714079a8afe8222acc4ab629f142c4c5..39e9ee874369b1bcf003372bed0d6f83a6eba6a0 100644
|
| --- a/third_party/WebKit/Source/core/html/MediaCustomControlsFullscreenDetector.cpp
|
| +++ b/third_party/WebKit/Source/core/html/MediaCustomControlsFullscreenDetector.cpp
|
| @@ -23,7 +23,6 @@ constexpr float kMostlyFillViewportThresholdOfVisibleProportion = 0.75f;
|
| MediaCustomControlsFullscreenDetector::MediaCustomControlsFullscreenDetector(
|
| HTMLVideoElement& video)
|
| : EventListener(CPPEventListenerType),
|
| - ContextLifecycleObserver(nullptr),
|
| m_videoElement(video),
|
| m_checkViewportIntersectionTimer(
|
| TaskRunnerHelper::get(TaskType::Unthrottled, &video.document()),
|
| @@ -44,7 +43,6 @@ bool MediaCustomControlsFullscreenDetector::operator==(
|
| }
|
|
|
| void MediaCustomControlsFullscreenDetector::attach() {
|
| - setContext(&videoElement().document());
|
| videoElement().document().addEventListener(
|
| EventTypeNames::webkitfullscreenchange, this, true);
|
| videoElement().document().addEventListener(EventTypeNames::fullscreenchange,
|
| @@ -52,12 +50,14 @@ void MediaCustomControlsFullscreenDetector::attach() {
|
| }
|
|
|
| void MediaCustomControlsFullscreenDetector::detach() {
|
| - setContext(nullptr);
|
| videoElement().document().removeEventListener(
|
| EventTypeNames::webkitfullscreenchange, this, true);
|
| videoElement().document().removeEventListener(
|
| EventTypeNames::fullscreenchange, this, true);
|
| m_checkViewportIntersectionTimer.stop();
|
| +
|
| + if (videoElement().webMediaPlayer())
|
| + videoElement().webMediaPlayer()->setIsEffectivelyFullscreen(false);
|
| }
|
|
|
| bool MediaCustomControlsFullscreenDetector::computeIsDominantVideoForTests(
|
| @@ -130,11 +130,11 @@ void MediaCustomControlsFullscreenDetector::handleEvent(
|
| BLINK_FROM_HERE);
|
| }
|
|
|
| -void MediaCustomControlsFullscreenDetector::contextDestroyed(
|
| - ExecutionContext*) {
|
| - if (videoElement().webMediaPlayer())
|
| - videoElement().webMediaPlayer()->setIsEffectivelyFullscreen(false);
|
| -
|
| +void MediaCustomControlsFullscreenDetector::contextDestroyed() {
|
| + // This method is called by HTMLVideoElement when it observes context destroy.
|
| + // The reason is that when HTMLMediaElement observes context destroy, it will
|
| + // destroy webMediaPlayer() thus the final setIsEffectivelyFullscreen(false)
|
| + // is not called.
|
| detach();
|
| }
|
|
|
| @@ -164,7 +164,6 @@ bool MediaCustomControlsFullscreenDetector::isVideoOrParentFullscreen() {
|
|
|
| DEFINE_TRACE(MediaCustomControlsFullscreenDetector) {
|
| EventListener::trace(visitor);
|
| - ContextLifecycleObserver::trace(visitor);
|
| visitor->trace(m_videoElement);
|
| }
|
|
|
|
|