OLD | NEW |
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 if (!m_exitFullscreenPageScaleFactor) { | 81 if (!m_exitFullscreenPageScaleFactor) { |
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_webViewImpl->setPageScaleFactorPreservingScrollOffset(1.0f); | 84 m_webViewImpl->setPageScaleFactorPreservingScrollOffset(1.0f); |
85 } | 85 } |
86 | 86 |
87 FullscreenElementStack::from(*doc).webkitDidEnterFullScreenForElemen
t(0); | 87 FullscreenElementStack::from(*doc).webkitDidEnterFullScreenForElemen
t(0); |
88 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) { | 88 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) { |
89 Element* element = FullscreenElementStack::currentFullScreenElem
entFrom(*doc); | 89 Element* element = FullscreenElementStack::currentFullScreenElem
entFrom(*doc); |
90 ASSERT(element); | 90 ASSERT(element); |
91 if (element->isMediaElement() && m_webViewImpl->layerTreeView()) | 91 if (isHTMLMediaElement(*element) && m_webViewImpl->layerTreeView
()) |
92 m_webViewImpl->layerTreeView()->setHasTransparentBackground(
true); | 92 m_webViewImpl->layerTreeView()->setHasTransparentBackground(
true); |
93 } | 93 } |
94 } | 94 } |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 void FullscreenController::willExitFullScreen() | 98 void FullscreenController::willExitFullScreen() |
99 { | 99 { |
100 if (!m_fullScreenFrame) | 100 if (!m_fullScreenFrame) |
101 return; | 101 return; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 // We are already in fullscreen mode. | 151 // We are already in fullscreen mode. |
152 if (m_fullScreenFrame) { | 152 if (m_fullScreenFrame) { |
153 m_provisionalFullScreenElement = element; | 153 m_provisionalFullScreenElement = element; |
154 willEnterFullScreen(); | 154 willEnterFullScreen(); |
155 didEnterFullScreen(); | 155 didEnterFullScreen(); |
156 return; | 156 return; |
157 } | 157 } |
158 | 158 |
159 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() | 159 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() |
160 && element && element->isMediaElement() | 160 && isHTMLMediaElement(element) |
161 // FIXME: There is no embedder-side handling in layout test mode. | 161 // FIXME: There is no embedder-side handling in layout test mode. |
162 && !isRunningLayoutTest()) { | 162 && !isRunningLayoutTest()) { |
163 HTMLMediaElement* mediaElement = toHTMLMediaElement(element); | 163 HTMLMediaElement* mediaElement = toHTMLMediaElement(element); |
164 if (mediaElement->player() && mediaElement->player()->canShowFullscreenO
verlay()) { | 164 if (mediaElement->player() && mediaElement->player()->canShowFullscreenO
verlay()) { |
165 mediaElement->player()->showFullscreenOverlay(); | 165 mediaElement->player()->showFullscreenOverlay(); |
166 m_provisionalFullScreenElement = element; | 166 m_provisionalFullScreenElement = element; |
167 return; | 167 return; |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 // We need to transition to fullscreen mode. | 171 // We need to transition to fullscreen mode. |
172 if (WebViewClient* client = m_webViewImpl->client()) { | 172 if (WebViewClient* client = m_webViewImpl->client()) { |
173 if (client->enterFullScreen()) | 173 if (client->enterFullScreen()) |
174 m_provisionalFullScreenElement = element; | 174 m_provisionalFullScreenElement = element; |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 void FullscreenController::exitFullScreenForElement(WebCore::Element* element) | 178 void FullscreenController::exitFullScreenForElement(WebCore::Element* element) |
179 { | 179 { |
180 // The client is exiting full screen, so don't send a notification. | 180 // The client is exiting full screen, so don't send a notification. |
181 if (m_isCancelingFullScreen) | 181 if (m_isCancelingFullScreen) |
182 return; | 182 return; |
183 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() | 183 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() |
184 && element && element->isMediaElement() | 184 && isHTMLMediaElement(element) |
185 // FIXME: There is no embedder-side handling in layout test mode. | 185 // FIXME: There is no embedder-side handling in layout test mode. |
186 && !isRunningLayoutTest()) { | 186 && !isRunningLayoutTest()) { |
187 HTMLMediaElement* mediaElement = toHTMLMediaElement(element); | 187 HTMLMediaElement* mediaElement = toHTMLMediaElement(element); |
188 if (mediaElement->player()) | 188 if (mediaElement->player()) |
189 mediaElement->player()->hideFullscreenOverlay(); | 189 mediaElement->player()->hideFullscreenOverlay(); |
190 return; | 190 return; |
191 } | 191 } |
192 if (WebViewClient* client = m_webViewImpl->client()) | 192 if (WebViewClient* client = m_webViewImpl->client()) |
193 client->exitFullScreen(); | 193 client->exitFullScreen(); |
194 } | 194 } |
195 | 195 |
196 } | 196 } |
197 | 197 |
OLD | NEW |