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

Side by Side Diff: third_party/WebKit/Source/web/FullscreenController.cpp

Issue 2411553003: Notify WebMediaPlayer when its ancestor enters/exists fullscreen. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "web/FullscreenController.h" 31 #include "web/FullscreenController.h"
32 32
33 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
34 #include "core/dom/ElementTraversal.h"
34 #include "core/dom/Fullscreen.h" 35 #include "core/dom/Fullscreen.h"
35 #include "core/frame/FrameView.h" 36 #include "core/frame/FrameView.h"
36 #include "core/frame/LocalFrame.h" 37 #include "core/frame/LocalFrame.h"
37 #include "core/frame/PageScaleConstraintsSet.h" 38 #include "core/frame/PageScaleConstraintsSet.h"
38 #include "core/html/HTMLMediaElement.h" 39 #include "core/html/HTMLMediaElement.h"
39 #include "core/html/HTMLVideoElement.h" 40 #include "core/html/HTMLVideoElement.h"
40 #include "core/layout/LayoutFullScreen.h" 41 #include "core/layout/LayoutFullScreen.h"
41 #include "platform/RuntimeEnabledFeatures.h" 42 #include "platform/RuntimeEnabledFeatures.h"
42 #include "public/platform/WebLayerTreeView.h" 43 #include "public/platform/WebLayerTreeView.h"
43 #include "public/web/WebFrameClient.h" 44 #include "public/web/WebFrameClient.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 80 }
80 81
81 Fullscreen::from(document).didEnterFullscreenForElement(element); 82 Fullscreen::from(document).didEnterFullscreenForElement(element);
82 DCHECK_EQ(Fullscreen::currentFullScreenElementFrom(document), element); 83 DCHECK_EQ(Fullscreen::currentFullScreenElementFrom(document), element);
83 84
84 if (isHTMLVideoElement(element)) { 85 if (isHTMLVideoElement(element)) {
85 HTMLVideoElement* videoElement = toHTMLVideoElement(element); 86 HTMLVideoElement* videoElement = toHTMLVideoElement(element);
86 if (videoElement->usesOverlayFullscreenVideo() && 87 if (videoElement->usesOverlayFullscreenVideo() &&
87 m_webViewImpl->layerTreeView()) 88 m_webViewImpl->layerTreeView())
88 m_webViewImpl->layerTreeView()->setHasTransparentBackground(true); 89 m_webViewImpl->layerTreeView()->setHasTransparentBackground(true);
90 } else {
91 for (HTMLVideoElement& videoElement :
92 Traversal<HTMLVideoElement>::descendantsOf(*element)) {
esprehn 2016/10/11 21:40:04 I still don't think we should land this. It requir
93 if (videoElement.webMediaPlayer() &&
94 videoElement.clientWidth() >=
95 videoElement.document().domWindow()->innerWidth() * 0.9 &&
96 videoElement.clientHeight() >=
97 videoElement.document().domWindow()->innerHeight() * 0.9) {
98 videoElement.webMediaPlayer()->enterFullWindow();
99 break;
100 }
101 }
89 } 102 }
90 } 103 }
91 104
92 void FullscreenController::didExitFullscreen() { 105 void FullscreenController::didExitFullscreen() {
93 if (!m_fullscreenFrame) 106 if (!m_fullscreenFrame)
94 return; 107 return;
95 108
96 if (m_haveEnteredFullscreen) 109 if (m_haveEnteredFullscreen)
97 updatePageScaleConstraints(true); 110 updatePageScaleConstraints(true);
98 111
(...skipping 14 matching lines...) Expand all
113 m_webViewImpl->layerTreeView()->setHasTransparentBackground( 126 m_webViewImpl->layerTreeView()->setHasTransparentBackground(
114 m_webViewImpl->isTransparent()); 127 m_webViewImpl->isTransparent());
115 128
116 // We need to wait until style and layout are updated in order 129 // We need to wait until style and layout are updated in order
117 // to propertly restore scroll offsets since content may not be 130 // to propertly restore scroll offsets since content may not be
118 // overflowing in the same way until they do. 131 // overflowing in the same way until they do.
119 if (m_haveEnteredFullscreen) 132 if (m_haveEnteredFullscreen)
120 m_needsScrollAndScaleRestore = true; 133 m_needsScrollAndScaleRestore = true;
121 134
122 fullscreen->didExitFullscreen(); 135 fullscreen->didExitFullscreen();
136
137 for (HTMLVideoElement& videoElement :
138 Traversal<HTMLVideoElement>::descendantsOf(*element)) {
139 if (videoElement.webMediaPlayer() &&
140 videoElement.webMediaPlayer()->isFullWindow()) {
141 videoElement.webMediaPlayer()->exitFullWindow();
foolip 2016/10/11 09:37:13 Test and comment somewhere on what happens if the
xjz 2016/10/11 19:27:26 The WebMediaPlayer get destroyed and the romoting
142 break;
143 }
144 }
123 } 145 }
124 } 146 }
125 } 147 }
126 148
127 m_haveEnteredFullscreen = false; 149 m_haveEnteredFullscreen = false;
128 m_fullscreenFrame.clear(); 150 m_fullscreenFrame.clear();
129 } 151 }
130 152
131 void FullscreenController::enterFullscreenForElement(Element* element) { 153 void FullscreenController::enterFullscreenForElement(Element* element) {
132 // We are already transitioning to fullscreen for a different element. 154 // We are already transitioning to fullscreen for a different element.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 255
234 m_webViewImpl->updateMainFrameLayoutSize(); 256 m_webViewImpl->updateMainFrameLayoutSize();
235 } 257 }
236 258
237 DEFINE_TRACE(FullscreenController) { 259 DEFINE_TRACE(FullscreenController) {
238 visitor->trace(m_provisionalFullscreenElement); 260 visitor->trace(m_provisionalFullscreenElement);
239 visitor->trace(m_fullscreenFrame); 261 visitor->trace(m_fullscreenFrame);
240 } 262 }
241 263
242 } // namespace blink 264 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698