| 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 27 matching lines...) Expand all Loading... |
| 38 #include "core/html/HTMLVideoElement.h" | 38 #include "core/html/HTMLVideoElement.h" |
| 39 #include "platform/RuntimeEnabledFeatures.h" | 39 #include "platform/RuntimeEnabledFeatures.h" |
| 40 #include "public/platform/WebLayerTreeView.h" | 40 #include "public/platform/WebLayerTreeView.h" |
| 41 #include "public/web/WebFrameClient.h" | 41 #include "public/web/WebFrameClient.h" |
| 42 #include "web/WebLocalFrameImpl.h" | 42 #include "web/WebLocalFrameImpl.h" |
| 43 #include "web/WebSettingsImpl.h" | 43 #include "web/WebSettingsImpl.h" |
| 44 #include "web/WebViewImpl.h" | 44 #include "web/WebViewImpl.h" |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 RawPtr<FullscreenController> FullscreenController::create(WebViewImpl* webViewIm
pl) | 48 FullscreenController* FullscreenController::create(WebViewImpl* webViewImpl) |
| 49 { | 49 { |
| 50 return new FullscreenController(webViewImpl); | 50 return new FullscreenController(webViewImpl); |
| 51 } | 51 } |
| 52 | 52 |
| 53 FullscreenController::FullscreenController(WebViewImpl* webViewImpl) | 53 FullscreenController::FullscreenController(WebViewImpl* webViewImpl) |
| 54 : m_webViewImpl(webViewImpl) | 54 : m_webViewImpl(webViewImpl) |
| 55 , m_haveEnteredFullscreen(false) | 55 , m_haveEnteredFullscreen(false) |
| 56 , m_exitFullscreenPageScaleFactor(0) | 56 , m_exitFullscreenPageScaleFactor(0) |
| 57 , m_isCancelingFullScreen(false) | 57 , m_isCancelingFullScreen(false) |
| 58 { | 58 { |
| 59 } | 59 } |
| 60 | 60 |
| 61 void FullscreenController::didEnterFullScreen() | 61 void FullscreenController::didEnterFullScreen() |
| 62 { | 62 { |
| 63 if (!m_provisionalFullScreenElement) | 63 if (!m_provisionalFullScreenElement) |
| 64 return; | 64 return; |
| 65 | 65 |
| 66 RawPtr<Element> element = m_provisionalFullScreenElement.release(); | 66 Element* element = m_provisionalFullScreenElement.release(); |
| 67 Document& document = element->document(); | 67 Document& document = element->document(); |
| 68 m_fullScreenFrame = document.frame(); | 68 m_fullScreenFrame = document.frame(); |
| 69 | 69 |
| 70 if (!m_fullScreenFrame) | 70 if (!m_fullScreenFrame) |
| 71 return; | 71 return; |
| 72 | 72 |
| 73 if (!m_haveEnteredFullscreen) { | 73 if (!m_haveEnteredFullscreen) { |
| 74 updatePageScaleConstraints(false); | 74 updatePageScaleConstraints(false); |
| 75 m_webViewImpl->setPageScaleFactor(1.0f); | 75 m_webViewImpl->setPageScaleFactor(1.0f); |
| 76 m_webViewImpl->mainFrame()->setScrollOffset(WebSize()); | 76 m_webViewImpl->mainFrame()->setScrollOffset(WebSize()); |
| 77 m_webViewImpl->setVisualViewportOffset(FloatPoint()); | 77 m_webViewImpl->setVisualViewportOffset(FloatPoint()); |
| 78 m_haveEnteredFullscreen = true; | 78 m_haveEnteredFullscreen = true; |
| 79 } | 79 } |
| 80 | 80 |
| 81 Fullscreen::from(document).didEnterFullScreenForElement(element.get()); | 81 Fullscreen::from(document).didEnterFullScreenForElement(element); |
| 82 DCHECK_EQ(Fullscreen::currentFullScreenElementFrom(document), element); | 82 DCHECK_EQ(Fullscreen::currentFullScreenElementFrom(document), element); |
| 83 | 83 |
| 84 if (isHTMLVideoElement(element)) { | 84 if (isHTMLVideoElement(element)) { |
| 85 HTMLVideoElement* videoElement = toHTMLVideoElement(element); | 85 HTMLVideoElement* videoElement = toHTMLVideoElement(element); |
| 86 if (videoElement->usesOverlayFullscreenVideo() && m_webViewImpl->layerTr
eeView()) | 86 if (videoElement->usesOverlayFullscreenVideo() && m_webViewImpl->layerTr
eeView()) |
| 87 m_webViewImpl->layerTreeView()->setHasTransparentBackground(true); | 87 m_webViewImpl->layerTreeView()->setHasTransparentBackground(true); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 void FullscreenController::didExitFullScreen() | 91 void FullscreenController::didExitFullScreen() |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 193 } |
| 194 | 194 |
| 195 DEFINE_TRACE(FullscreenController) | 195 DEFINE_TRACE(FullscreenController) |
| 196 { | 196 { |
| 197 visitor->trace(m_provisionalFullScreenElement); | 197 visitor->trace(m_provisionalFullScreenElement); |
| 198 visitor->trace(m_fullScreenFrame); | 198 visitor->trace(m_fullScreenFrame); |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace blink | 201 } // namespace blink |
| 202 | 202 |
| OLD | NEW |