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

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

Issue 277823002: Don't show video fullscreen until DidEnterFullscreen() is called (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 m_exitFullscreenPageScaleFactor = m_webViewImpl->pageScaleFactor (); 82 m_exitFullscreenPageScaleFactor = m_webViewImpl->pageScaleFactor ();
83 m_exitFullscreenScrollOffset = m_webViewImpl->mainFrame()->scrol lOffset(); 83 m_exitFullscreenScrollOffset = m_webViewImpl->mainFrame()->scrol lOffset();
84 m_exitFullscreenPinchViewportOffset = m_webViewImpl->pinchViewpo rtOffset(); 84 m_exitFullscreenPinchViewportOffset = m_webViewImpl->pinchViewpo rtOffset();
85 m_webViewImpl->setPageScaleFactor(1.0f); 85 m_webViewImpl->setPageScaleFactor(1.0f);
86 } 86 }
87 87
88 FullscreenElementStack::from(*doc).webkitDidEnterFullScreenForElemen t(0); 88 FullscreenElementStack::from(*doc).webkitDidEnterFullScreenForElemen t(0);
89 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) { 89 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) {
90 Element* element = FullscreenElementStack::currentFullScreenElem entFrom(*doc); 90 Element* element = FullscreenElementStack::currentFullScreenElem entFrom(*doc);
91 ASSERT(element); 91 ASSERT(element);
92 if (isHTMLMediaElement(*element) && m_webViewImpl->layerTreeView ()) 92 if (isHTMLMediaElement(*element)) {
93 m_webViewImpl->layerTreeView()->setHasTransparentBackground( true); 93 HTMLMediaElement* mediaElement = toHTMLMediaElement(element) ;
94 if (mediaElement->player() && mediaElement->player()->canSho wFullscreenOverlay()
95 // FIXME: There is no embedder-side handling in layout t est mode.
96 && !isRunningLayoutTest()) {
97 mediaElement->player()->showFullscreenOverlay();
98 }
99 if (m_webViewImpl->layerTreeView())
100 m_webViewImpl->layerTreeView()->setHasTransparentBackgro und(true);
101 }
94 } 102 }
95 } 103 }
96 } 104 }
97 } 105 }
98 106
99 void FullscreenController::willExitFullScreen() 107 void FullscreenController::willExitFullScreen()
100 { 108 {
101 if (!m_fullScreenFrame) 109 if (!m_fullScreenFrame)
102 return; 110 return;
103 111
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 159 }
152 160
153 // We are already in fullscreen mode. 161 // We are already in fullscreen mode.
154 if (m_fullScreenFrame) { 162 if (m_fullScreenFrame) {
155 m_provisionalFullScreenElement = element; 163 m_provisionalFullScreenElement = element;
156 willEnterFullScreen(); 164 willEnterFullScreen();
157 didEnterFullScreen(); 165 didEnterFullScreen();
158 return; 166 return;
159 } 167 }
160 168
161 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()
162 && isHTMLMediaElement(element)
163 // FIXME: There is no embedder-side handling in layout test mode.
164 && !isRunningLayoutTest()) {
165 HTMLMediaElement* mediaElement = toHTMLMediaElement(element);
166 if (mediaElement->player() && mediaElement->player()->canShowFullscreenO verlay()) {
167 mediaElement->player()->showFullscreenOverlay();
168 m_provisionalFullScreenElement = element;
169 return;
170 }
171 }
172
173 // We need to transition to fullscreen mode. 169 // We need to transition to fullscreen mode.
174 if (WebViewClient* client = m_webViewImpl->client()) { 170 if (WebViewClient* client = m_webViewImpl->client()) {
175 if (client->enterFullScreen()) 171 if (client->enterFullScreen())
176 m_provisionalFullScreenElement = element; 172 m_provisionalFullScreenElement = element;
177 } 173 }
178 } 174 }
179 175
180 void FullscreenController::exitFullScreenForElement(WebCore::Element* element) 176 void FullscreenController::exitFullScreenForElement(WebCore::Element* element)
181 { 177 {
182 // The client is exiting full screen, so don't send a notification. 178 // The client is exiting full screen, so don't send a notification.
183 if (m_isCancelingFullScreen) 179 if (m_isCancelingFullScreen)
184 return; 180 return;
185 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() 181
186 && isHTMLMediaElement(element)
187 // FIXME: There is no embedder-side handling in layout test mode.
188 && !isRunningLayoutTest()) {
189 HTMLMediaElement* mediaElement = toHTMLMediaElement(element);
190 if (mediaElement->player())
191 mediaElement->player()->hideFullscreenOverlay();
192 return;
193 }
194 if (WebViewClient* client = m_webViewImpl->client()) 182 if (WebViewClient* client = m_webViewImpl->client())
195 client->exitFullScreen(); 183 client->exitFullScreen();
196 } 184 }
197 185
198 } 186 }
199 187
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698