| 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 19 matching lines...) Expand all Loading... |
| 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/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" | |
| 41 #include "platform/RuntimeEnabledFeatures.h" | 40 #include "platform/RuntimeEnabledFeatures.h" |
| 42 #include "public/platform/WebLayerTreeView.h" | 41 #include "public/platform/WebLayerTreeView.h" |
| 43 #include "public/web/WebFrameClient.h" | 42 #include "public/web/WebFrameClient.h" |
| 44 #include "web/WebLocalFrameImpl.h" | 43 #include "web/WebLocalFrameImpl.h" |
| 45 #include "web/WebSettingsImpl.h" | 44 #include "web/WebSettingsImpl.h" |
| 46 #include "web/WebViewImpl.h" | 45 #include "web/WebViewImpl.h" |
| 47 | 46 |
| 48 namespace blink { | 47 namespace blink { |
| 49 | 48 |
| 50 FullscreenController* FullscreenController::create(WebViewImpl* webViewImpl) | 49 FullscreenController* FullscreenController::create(WebViewImpl* webViewImpl) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 123 } |
| 125 } | 124 } |
| 126 } | 125 } |
| 127 | 126 |
| 128 m_haveEnteredFullscreen = false; | 127 m_haveEnteredFullscreen = false; |
| 129 m_fullScreenFrame.clear(); | 128 m_fullScreenFrame.clear(); |
| 130 } | 129 } |
| 131 | 130 |
| 132 void FullscreenController::enterFullScreenForElement(Element* element) | 131 void FullscreenController::enterFullScreenForElement(Element* element) |
| 133 { | 132 { |
| 133 // TODO(dsinclair): This should not be needed because we addToTopLayer |
| 134 // in Fullscreen::pushFullscreenElementStack but, the WebView code doesn't |
| 135 // call Fullscreen::requestFullscreen() and, instead, just enters and |
| 136 // exists itself. This should be unified so there is one way to go |
| 137 // fullscreen. crbug.com/538158 |
| 138 element->document().addToTopLayer(element); |
| 139 |
| 134 // We are already transitioning to fullscreen for a different element. | 140 // We are already transitioning to fullscreen for a different element. |
| 135 if (m_provisionalFullScreenElement) { | 141 if (m_provisionalFullScreenElement) { |
| 136 m_provisionalFullScreenElement = element; | 142 m_provisionalFullScreenElement = element; |
| 137 return; | 143 return; |
| 138 } | 144 } |
| 139 | 145 |
| 140 // We are already in fullscreen mode. | 146 // We are already in fullscreen mode. |
| 141 if (m_fullScreenFrame) { | 147 if (m_fullScreenFrame) { |
| 142 m_provisionalFullScreenElement = element; | 148 m_provisionalFullScreenElement = element; |
| 143 didEnterFullScreen(); | 149 didEnterFullScreen(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 159 if (!Fullscreen::from(element->document()).forCrossProcessAncestor()) | 165 if (!Fullscreen::from(element->document()).forCrossProcessAncestor()) |
| 160 frame->client()->enterFullscreen(); | 166 frame->client()->enterFullscreen(); |
| 161 m_provisionalFullScreenElement = element; | 167 m_provisionalFullScreenElement = element; |
| 162 } | 168 } |
| 163 } | 169 } |
| 164 | 170 |
| 165 void FullscreenController::exitFullScreenForElement(Element* element) | 171 void FullscreenController::exitFullScreenForElement(Element* element) |
| 166 { | 172 { |
| 167 DCHECK(element); | 173 DCHECK(element); |
| 168 | 174 |
| 175 // TODO(dsinclair): This should not be needed because we addToTopLayer |
| 176 // in Fullscreen::popFullscreenElementStack but, the WebView code doesn't |
| 177 // call Fullscreen::requestFullscreen() and, instead, just enters and |
| 178 // exists itself. This should be unified so there is one way to go |
| 179 // fullscreen. crbug.com/538158 |
| 180 element->document().removeFromTopLayer(element); |
| 181 |
| 169 // The client is exiting full screen, so don't send a notification. | 182 // The client is exiting full screen, so don't send a notification. |
| 170 if (m_isCancelingFullScreen) | 183 if (m_isCancelingFullScreen) |
| 171 return; | 184 return; |
| 172 | 185 |
| 173 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(element->document().
frame()); | 186 WebLocalFrameImpl* frame = WebLocalFrameImpl::fromFrame(element->document().
frame()); |
| 174 if (frame && frame->client()) | 187 if (frame && frame->client()) |
| 175 frame->client()->exitFullscreen(); | 188 frame->client()->exitFullscreen(); |
| 176 } | 189 } |
| 177 | 190 |
| 178 void FullscreenController::updateSize() | 191 void FullscreenController::updateSize() |
| 179 { | 192 { |
| 180 if (!isFullscreen()) | 193 if (!isFullscreen()) |
| 181 return; | 194 return; |
| 182 | 195 |
| 183 updatePageScaleConstraints(false); | 196 updatePageScaleConstraints(false); |
| 184 | 197 |
| 185 LayoutFullScreen* layoutObject = Fullscreen::from(*m_fullScreenFrame->docume
nt()).fullScreenLayoutObject(); | 198 Document* document = m_fullScreenFrame->document(); |
| 186 if (layoutObject) | 199 if (Element* fullscreenElement = Fullscreen::currentFullScreenElementFrom(*d
ocument)) |
| 187 layoutObject->updateStyle(); | 200 Fullscreen::from(fullscreenElement->document()).didUpdateSize(*fullscree
nElement); |
| 188 } | 201 } |
| 189 | 202 |
| 190 void FullscreenController::updatePageScaleConstraints(bool removeConstraints) | 203 void FullscreenController::updatePageScaleConstraints(bool removeConstraints) |
| 191 { | 204 { |
| 192 PageScaleConstraints fullscreenConstraints; | 205 PageScaleConstraints fullscreenConstraints; |
| 193 if (!removeConstraints) { | 206 if (!removeConstraints) { |
| 194 fullscreenConstraints = PageScaleConstraints(1.0, 1.0, 1.0); | 207 fullscreenConstraints = PageScaleConstraints(1.0, 1.0, 1.0); |
| 195 fullscreenConstraints.layoutSize = FloatSize(m_webViewImpl->size()); | 208 fullscreenConstraints.layoutSize = FloatSize(m_webViewImpl->size()); |
| 196 } | 209 } |
| 197 m_webViewImpl->pageScaleConstraintsSet().setFullscreenConstraints(fullscreen
Constraints); | 210 m_webViewImpl->pageScaleConstraintsSet().setFullscreenConstraints(fullscreen
Constraints); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 209 m_webViewImpl->updateMainFrameLayoutSize(); | 222 m_webViewImpl->updateMainFrameLayoutSize(); |
| 210 } | 223 } |
| 211 | 224 |
| 212 DEFINE_TRACE(FullscreenController) | 225 DEFINE_TRACE(FullscreenController) |
| 213 { | 226 { |
| 214 visitor->trace(m_provisionalFullScreenElement); | 227 visitor->trace(m_provisionalFullScreenElement); |
| 215 visitor->trace(m_fullScreenFrame); | 228 visitor->trace(m_fullScreenFrame); |
| 216 } | 229 } |
| 217 | 230 |
| 218 } // namespace blink | 231 } // namespace blink |
| 219 | |
| OLD | NEW |