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 13 matching lines...) Expand all Loading... |
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 Loading... |
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)) { |
| 93 if (videoElement.webMediaPlayer()) |
| 94 videoElement.webMediaPlayer()->ancestorEnteredFullscreen(); |
| 95 } |
89 } | 96 } |
90 } | 97 } |
91 | 98 |
92 void FullscreenController::didExitFullscreen() { | 99 void FullscreenController::didExitFullscreen() { |
93 if (!m_fullscreenFrame) | 100 if (!m_fullscreenFrame) |
94 return; | 101 return; |
95 | 102 |
96 if (m_haveEnteredFullscreen) | 103 if (m_haveEnteredFullscreen) |
97 updatePageScaleConstraints(true); | 104 updatePageScaleConstraints(true); |
98 | 105 |
(...skipping 14 matching lines...) Expand all Loading... |
113 m_webViewImpl->layerTreeView()->setHasTransparentBackground( | 120 m_webViewImpl->layerTreeView()->setHasTransparentBackground( |
114 m_webViewImpl->isTransparent()); | 121 m_webViewImpl->isTransparent()); |
115 | 122 |
116 // We need to wait until style and layout are updated in order | 123 // We need to wait until style and layout are updated in order |
117 // to propertly restore scroll offsets since content may not be | 124 // to propertly restore scroll offsets since content may not be |
118 // overflowing in the same way until they do. | 125 // overflowing in the same way until they do. |
119 if (m_haveEnteredFullscreen) | 126 if (m_haveEnteredFullscreen) |
120 m_needsScrollAndScaleRestore = true; | 127 m_needsScrollAndScaleRestore = true; |
121 | 128 |
122 fullscreen->didExitFullscreen(); | 129 fullscreen->didExitFullscreen(); |
| 130 if (!isHTMLVideoElement(element)) { |
| 131 for (HTMLVideoElement& videoElement : |
| 132 Traversal<HTMLVideoElement>::descendantsOf(*element)) { |
| 133 if (videoElement.webMediaPlayer()) |
| 134 videoElement.webMediaPlayer()->ancestorExitedFullscreen(); |
| 135 } |
| 136 } |
123 } | 137 } |
124 } | 138 } |
125 } | 139 } |
126 | 140 |
127 m_haveEnteredFullscreen = false; | 141 m_haveEnteredFullscreen = false; |
128 m_fullscreenFrame.clear(); | 142 m_fullscreenFrame.clear(); |
129 } | 143 } |
130 | 144 |
131 void FullscreenController::enterFullscreenForElement(Element* element) { | 145 void FullscreenController::enterFullscreenForElement(Element* element) { |
132 // We are already transitioning to fullscreen for a different element. | 146 // We are already transitioning to fullscreen for a different element. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 247 |
234 m_webViewImpl->updateMainFrameLayoutSize(); | 248 m_webViewImpl->updateMainFrameLayoutSize(); |
235 } | 249 } |
236 | 250 |
237 DEFINE_TRACE(FullscreenController) { | 251 DEFINE_TRACE(FullscreenController) { |
238 visitor->trace(m_provisionalFullscreenElement); | 252 visitor->trace(m_provisionalFullscreenElement); |
239 visitor->trace(m_fullscreenFrame); | 253 visitor->trace(m_fullscreenFrame); |
240 } | 254 } |
241 | 255 |
242 } // namespace blink | 256 } // namespace blink |
OLD | NEW |