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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 m_haveEnteredFullscreen = true; | 83 m_haveEnteredFullscreen = true; |
83 } | 84 } |
84 | 85 |
85 Fullscreen::from(document).didEnterFullscreenForElement(element); | 86 Fullscreen::from(document).didEnterFullscreenForElement(element); |
86 DCHECK_EQ(Fullscreen::currentFullScreenElementFrom(document), element); | 87 DCHECK_EQ(Fullscreen::currentFullScreenElementFrom(document), element); |
87 | 88 |
88 if (isHTMLVideoElement(element)) { | 89 if (isHTMLVideoElement(element)) { |
89 HTMLVideoElement* videoElement = toHTMLVideoElement(element); | 90 HTMLVideoElement* videoElement = toHTMLVideoElement(element); |
90 if (videoElement->usesOverlayFullscreenVideo() && m_webViewImpl->layerTr
eeView()) | 91 if (videoElement->usesOverlayFullscreenVideo() && m_webViewImpl->layerTr
eeView()) |
91 m_webViewImpl->layerTreeView()->setHasTransparentBackground(true); | 92 m_webViewImpl->layerTreeView()->setHasTransparentBackground(true); |
| 93 } else { |
| 94 for (HTMLVideoElement& videoElement : Traversal<HTMLVideoElement>::desce
ndantsOf(*element)) { |
| 95 if (videoElement.webMediaPlayer()) |
| 96 videoElement.webMediaPlayer()->ancestorEnteredFullscreen(); |
| 97 } |
92 } | 98 } |
93 } | 99 } |
94 | 100 |
95 void FullscreenController::didExitFullscreen() | 101 void FullscreenController::didExitFullscreen() |
96 { | 102 { |
97 if (!m_fullscreenFrame) | 103 if (!m_fullscreenFrame) |
98 return; | 104 return; |
99 | 105 |
100 if (m_haveEnteredFullscreen) | 106 if (m_haveEnteredFullscreen) |
101 updatePageScaleConstraints(true); | 107 updatePageScaleConstraints(true); |
(...skipping 12 matching lines...) Expand all Loading... |
114 if (isHTMLVideoElement(element) && m_webViewImpl->layerTreeView(
)) | 120 if (isHTMLVideoElement(element) && m_webViewImpl->layerTreeView(
)) |
115 m_webViewImpl->layerTreeView()->setHasTransparentBackground(
m_webViewImpl->isTransparent()); | 121 m_webViewImpl->layerTreeView()->setHasTransparentBackground(
m_webViewImpl->isTransparent()); |
116 | 122 |
117 // 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 |
118 // to propertly restore scroll offsets since content may not be | 124 // to propertly restore scroll offsets since content may not be |
119 // overflowing in the same way until they do. | 125 // overflowing in the same way until they do. |
120 if (m_haveEnteredFullscreen) | 126 if (m_haveEnteredFullscreen) |
121 m_needsScrollAndScaleRestore = true; | 127 m_needsScrollAndScaleRestore = true; |
122 | 128 |
123 fullscreen->didExitFullscreen(); | 129 fullscreen->didExitFullscreen(); |
| 130 if (!isHTMLVideoElement(element)) { |
| 131 for (HTMLVideoElement& videoElement : Traversal<HTMLVideoEle
ment>::descendantsOf(*element)) { |
| 132 if (videoElement.webMediaPlayer()) |
| 133 videoElement.webMediaPlayer()->ancestorExitedFullscr
een(); |
| 134 } |
| 135 } |
124 } | 136 } |
125 } | 137 } |
126 } | 138 } |
127 | 139 |
128 m_haveEnteredFullscreen = false; | 140 m_haveEnteredFullscreen = false; |
129 m_fullscreenFrame.clear(); | 141 m_fullscreenFrame.clear(); |
130 } | 142 } |
131 | 143 |
132 void FullscreenController::enterFullscreenForElement(Element* element) | 144 void FullscreenController::enterFullscreenForElement(Element* element) |
133 { | 145 { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 m_webViewImpl->updateMainFrameLayoutSize(); | 240 m_webViewImpl->updateMainFrameLayoutSize(); |
229 } | 241 } |
230 | 242 |
231 DEFINE_TRACE(FullscreenController) | 243 DEFINE_TRACE(FullscreenController) |
232 { | 244 { |
233 visitor->trace(m_provisionalFullscreenElement); | 245 visitor->trace(m_provisionalFullscreenElement); |
234 visitor->trace(m_fullscreenFrame); | 246 visitor->trace(m_fullscreenFrame); |
235 } | 247 } |
236 | 248 |
237 } // namespace blink | 249 } // namespace blink |
OLD | NEW |