| 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 23 matching lines...) Expand all Loading... |
| 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 "core/layout/LayoutFullScreen.h" | 40 #include "core/layout/LayoutFullScreen.h" |
| 41 #include "platform/RuntimeEnabledFeatures.h" | 41 #include "platform/RuntimeEnabledFeatures.h" |
| 42 #include "public/platform/WebLayerTreeView.h" | 42 #include "public/platform/WebLayerTreeView.h" |
| 43 #include "public/web/WebFrameClient.h" | 43 #include "public/web/WebFrameClient.h" |
| 44 #include "third_party/WebKit/Source/core/dom/TagCollection.h" |
| 44 #include "web/WebLocalFrameImpl.h" | 45 #include "web/WebLocalFrameImpl.h" |
| 45 #include "web/WebSettingsImpl.h" | 46 #include "web/WebSettingsImpl.h" |
| 46 #include "web/WebViewImpl.h" | 47 #include "web/WebViewImpl.h" |
| 47 | 48 |
| 48 namespace blink { | 49 namespace blink { |
| 49 | 50 |
| 50 FullscreenController* FullscreenController::create(WebViewImpl* webViewImpl) | 51 FullscreenController* FullscreenController::create(WebViewImpl* webViewImpl) |
| 51 { | 52 { |
| 52 return new FullscreenController(webViewImpl); | 53 return new FullscreenController(webViewImpl); |
| 53 } | 54 } |
| (...skipping 28 matching lines...) Expand all 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 // Notify all the video descendants that its ancestor enters full screen
. |
| 95 for (HTMLVideoElement& videoElement : Traversal<HTMLVideoElement>::desce
ndantsOf(*element)) { |
| 96 if (videoElement.webMediaPlayer()) |
| 97 videoElement.webMediaPlayer()->ancestorEnteredFullscreen(); |
| 98 } |
| 92 } | 99 } |
| 93 } | 100 } |
| 94 | 101 |
| 95 void FullscreenController::didExitFullscreen() | 102 void FullscreenController::didExitFullscreen() |
| 96 { | 103 { |
| 97 if (!m_fullscreenFrame) | 104 if (!m_fullscreenFrame) |
| 98 return; | 105 return; |
| 99 | 106 |
| 100 if (m_haveEnteredFullscreen) | 107 if (m_haveEnteredFullscreen) |
| 101 updatePageScaleConstraints(true); | 108 updatePageScaleConstraints(true); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 114 if (isHTMLVideoElement(element) && m_webViewImpl->layerTreeView(
)) | 121 if (isHTMLVideoElement(element) && m_webViewImpl->layerTreeView(
)) |
| 115 m_webViewImpl->layerTreeView()->setHasTransparentBackground(
m_webViewImpl->isTransparent()); | 122 m_webViewImpl->layerTreeView()->setHasTransparentBackground(
m_webViewImpl->isTransparent()); |
| 116 | 123 |
| 117 // We need to wait until style and layout are updated in order | 124 // We need to wait until style and layout are updated in order |
| 118 // to propertly restore scroll offsets since content may not be | 125 // to propertly restore scroll offsets since content may not be |
| 119 // overflowing in the same way until they do. | 126 // overflowing in the same way until they do. |
| 120 if (m_haveEnteredFullscreen) | 127 if (m_haveEnteredFullscreen) |
| 121 m_needsScrollAndScaleRestore = true; | 128 m_needsScrollAndScaleRestore = true; |
| 122 | 129 |
| 123 fullscreen->didExitFullscreen(); | 130 fullscreen->didExitFullscreen(); |
| 131 if (!isHTMLVideoElement(element)) { |
| 132 // Notify all the video descendants that its anecestor exits
full screen. |
| 133 for (HTMLVideoElement& videoElement : Traversal<HTMLVideoEle
ment>::descendantsOf(*element)) { |
| 134 if (videoElement.webMediaPlayer()) |
| 135 videoElement.webMediaPlayer()->ancestorExitedFullscr
een(); |
| 136 } |
| 137 } |
| 124 } | 138 } |
| 125 } | 139 } |
| 126 } | 140 } |
| 127 | 141 |
| 128 m_haveEnteredFullscreen = false; | 142 m_haveEnteredFullscreen = false; |
| 129 m_fullscreenFrame.clear(); | 143 m_fullscreenFrame.clear(); |
| 130 } | 144 } |
| 131 | 145 |
| 132 void FullscreenController::enterFullscreenForElement(Element* element) | 146 void FullscreenController::enterFullscreenForElement(Element* element) |
| 133 { | 147 { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 m_webViewImpl->updateMainFrameLayoutSize(); | 242 m_webViewImpl->updateMainFrameLayoutSize(); |
| 229 } | 243 } |
| 230 | 244 |
| 231 DEFINE_TRACE(FullscreenController) | 245 DEFINE_TRACE(FullscreenController) |
| 232 { | 246 { |
| 233 visitor->trace(m_provisionalFullscreenElement); | 247 visitor->trace(m_provisionalFullscreenElement); |
| 234 visitor->trace(m_fullscreenFrame); | 248 visitor->trace(m_fullscreenFrame); |
| 235 } | 249 } |
| 236 | 250 |
| 237 } // namespace blink | 251 } // namespace blink |
| OLD | NEW |