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 22 matching lines...) Expand all Loading... |
33 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
34 #include "core/dom/Fullscreen.h" | 34 #include "core/dom/Fullscreen.h" |
35 #include "core/frame/FrameView.h" | 35 #include "core/frame/FrameView.h" |
36 #include "core/frame/LocalFrame.h" | 36 #include "core/frame/LocalFrame.h" |
37 #include "core/frame/PageScaleConstraintsSet.h" | 37 #include "core/frame/PageScaleConstraintsSet.h" |
38 #include "core/html/HTMLMediaElement.h" | 38 #include "core/html/HTMLMediaElement.h" |
39 #include "core/html/HTMLVideoElement.h" | 39 #include "core/html/HTMLVideoElement.h" |
40 #include "platform/RuntimeEnabledFeatures.h" | 40 #include "platform/RuntimeEnabledFeatures.h" |
41 #include "public/platform/WebLayerTreeView.h" | 41 #include "public/platform/WebLayerTreeView.h" |
42 #include "public/web/WebFrameClient.h" | 42 #include "public/web/WebFrameClient.h" |
| 43 #include "third_party/WebKit/Source/core/dom/TagCollection.h" |
43 #include "web/WebLocalFrameImpl.h" | 44 #include "web/WebLocalFrameImpl.h" |
44 #include "web/WebSettingsImpl.h" | 45 #include "web/WebSettingsImpl.h" |
45 #include "web/WebViewImpl.h" | 46 #include "web/WebViewImpl.h" |
46 | 47 |
47 namespace blink { | 48 namespace blink { |
48 | 49 |
49 FullscreenController* FullscreenController::create(WebViewImpl* webViewImpl) | 50 FullscreenController* FullscreenController::create(WebViewImpl* webViewImpl) |
50 { | 51 { |
51 return new FullscreenController(webViewImpl); | 52 return new FullscreenController(webViewImpl); |
52 } | 53 } |
(...skipping 28 matching lines...) Expand all Loading... |
81 m_haveEnteredFullscreen = true; | 82 m_haveEnteredFullscreen = true; |
82 } | 83 } |
83 | 84 |
84 Fullscreen::from(document).didEnterFullscreenForElement(element); | 85 Fullscreen::from(document).didEnterFullscreenForElement(element); |
85 DCHECK_EQ(Fullscreen::currentFullScreenElementFrom(document), element); | 86 DCHECK_EQ(Fullscreen::currentFullScreenElementFrom(document), element); |
86 | 87 |
87 if (isHTMLVideoElement(element)) { | 88 if (isHTMLVideoElement(element)) { |
88 HTMLVideoElement* videoElement = toHTMLVideoElement(element); | 89 HTMLVideoElement* videoElement = toHTMLVideoElement(element); |
89 if (videoElement->usesOverlayFullscreenVideo() && m_webViewImpl->layerTr
eeView()) | 90 if (videoElement->usesOverlayFullscreenVideo() && m_webViewImpl->layerTr
eeView()) |
90 m_webViewImpl->layerTreeView()->setHasTransparentBackground(true); | 91 m_webViewImpl->layerTreeView()->setHasTransparentBackground(true); |
| 92 } else { |
| 93 // Notify all the video descendants that it enters full screen. |
| 94 for (HTMLVideoElement& videoElement : Traversal<HTMLVideoElement>::desce
ndantsOf(*element)) |
| 95 videoElement.parentEnteredFullscreen(); |
91 } | 96 } |
92 } | 97 } |
93 | 98 |
94 void FullscreenController::didExitFullscreen() | 99 void FullscreenController::didExitFullscreen() |
95 { | 100 { |
96 if (!m_fullScreenFrame) | 101 if (!m_fullScreenFrame) |
97 return; | 102 return; |
98 | 103 |
99 if (m_haveEnteredFullscreen) | 104 if (m_haveEnteredFullscreen) |
100 updatePageScaleConstraints(true); | 105 updatePageScaleConstraints(true); |
(...skipping 12 matching lines...) Expand all Loading... |
113 if (isHTMLVideoElement(element) && m_webViewImpl->layerTreeView(
)) | 118 if (isHTMLVideoElement(element) && m_webViewImpl->layerTreeView(
)) |
114 m_webViewImpl->layerTreeView()->setHasTransparentBackground(
m_webViewImpl->isTransparent()); | 119 m_webViewImpl->layerTreeView()->setHasTransparentBackground(
m_webViewImpl->isTransparent()); |
115 | 120 |
116 // We need to wait until style and layout are updated in order | 121 // We need to wait until style and layout are updated in order |
117 // to propertly restore scroll offsets since content may not be | 122 // to propertly restore scroll offsets since content may not be |
118 // overflowing in the same way until they do. | 123 // overflowing in the same way until they do. |
119 if (m_haveEnteredFullscreen) | 124 if (m_haveEnteredFullscreen) |
120 m_needsScrollAndScaleRestore = true; | 125 m_needsScrollAndScaleRestore = true; |
121 | 126 |
122 fullscreen->didExitFullscreen(); | 127 fullscreen->didExitFullscreen(); |
| 128 if (!isHTMLVideoElement(element)) { |
| 129 // Notify all the video descendants that it exits full scree
n. |
| 130 for (HTMLVideoElement& videoElement : Traversal<HTMLVideoEle
ment>::descendantsOf(*element)) |
| 131 videoElement.parentExitedFullscreen(); |
| 132 } |
123 } | 133 } |
124 } | 134 } |
125 } | 135 } |
126 | 136 |
127 m_haveEnteredFullscreen = false; | 137 m_haveEnteredFullscreen = false; |
128 m_fullScreenFrame.clear(); | 138 m_fullScreenFrame.clear(); |
129 } | 139 } |
130 | 140 |
131 void FullscreenController::enterFullScreenForElement(Element* element) | 141 void FullscreenController::enterFullScreenForElement(Element* element) |
132 { | 142 { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 m_webViewImpl->updateMainFrameLayoutSize(); | 251 m_webViewImpl->updateMainFrameLayoutSize(); |
242 } | 252 } |
243 | 253 |
244 DEFINE_TRACE(FullscreenController) | 254 DEFINE_TRACE(FullscreenController) |
245 { | 255 { |
246 visitor->trace(m_provisionalFullScreenElement); | 256 visitor->trace(m_provisionalFullScreenElement); |
247 visitor->trace(m_fullScreenFrame); | 257 visitor->trace(m_fullScreenFrame); |
248 } | 258 } |
249 | 259 |
250 } // namespace blink | 260 } // namespace blink |
OLD | NEW |