Chromium Code Reviews| 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 #ifndef FullscreenController_h | 31 #ifndef FullscreenController_h |
| 32 #define FullscreenController_h | 32 #define FullscreenController_h |
| 33 | 33 |
| 34 #include <memory> | |
| 34 #include "platform/geometry/FloatPoint.h" | 35 #include "platform/geometry/FloatPoint.h" |
|
lfg
2017/03/23 16:05:21
nit: one line spacing after <memory>, according to
Eric Seckler
2017/03/23 16:34:48
Done.
| |
| 35 #include "platform/geometry/IntSize.h" | 36 #include "platform/geometry/IntSize.h" |
| 36 #include <memory> | 37 #include "platform/graphics/Color.h" |
| 37 | 38 |
| 38 namespace blink { | 39 namespace blink { |
| 39 | 40 |
| 40 class Element; | 41 class Element; |
| 41 class LocalFrame; | 42 class LocalFrame; |
| 42 class WebViewImpl; | 43 class WebViewImpl; |
| 43 | 44 |
| 44 class FullscreenController { | 45 class FullscreenController { |
| 45 public: | 46 public: |
| 46 static std::unique_ptr<FullscreenController> create(WebViewImpl*); | 47 static std::unique_ptr<FullscreenController> create(WebViewImpl*); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 64 | 65 |
| 65 void updateSize(); | 66 void updateSize(); |
| 66 | 67 |
| 67 void didUpdateLayout(); | 68 void didUpdateLayout(); |
| 68 | 69 |
| 69 protected: | 70 protected: |
| 70 explicit FullscreenController(WebViewImpl*); | 71 explicit FullscreenController(WebViewImpl*); |
| 71 | 72 |
| 72 private: | 73 private: |
| 73 void updatePageScaleConstraints(bool removeConstraints); | 74 void updatePageScaleConstraints(bool removeConstraints); |
| 75 void restoreBackgroundColorOverride(); | |
| 74 | 76 |
| 75 WebViewImpl* m_webViewImpl; | 77 WebViewImpl* m_webViewImpl; |
| 76 | 78 |
| 77 // State is used to avoid unnecessary enter/exit requests, and to restore the | 79 // State is used to avoid unnecessary enter/exit requests, and to restore the |
| 78 // m_initial* after the first layout upon exiting fullscreen. Typically, the | 80 // m_initial* after the first layout upon exiting fullscreen. Typically, the |
| 79 // state goes through every state from Initial to NeedsScrollAndScaleRestore | 81 // state goes through every state from Initial to NeedsScrollAndScaleRestore |
| 80 // and then back to Initial, but the are two exceptions: | 82 // and then back to Initial, but the are two exceptions: |
| 81 // 1. didExitFullscreen() can transition from any non-Initial state to | 83 // 1. didExitFullscreen() can transition from any non-Initial state to |
| 82 // NeedsScrollAndScaleRestore, in case of a browser-intiated exit. | 84 // NeedsScrollAndScaleRestore, in case of a browser-intiated exit. |
| 83 // 2. enterFullscreen() can transition from NeedsScrollAndScaleRestore to | 85 // 2. enterFullscreen() can transition from NeedsScrollAndScaleRestore to |
| 84 // EnteringFullscreen, in case of a quick exit+enter. | 86 // EnteringFullscreen, in case of a quick exit+enter. |
| 85 enum class State { | 87 enum class State { |
| 86 Initial, | 88 Initial, |
| 87 EnteringFullscreen, | 89 EnteringFullscreen, |
| 88 Fullscreen, | 90 Fullscreen, |
| 89 ExitingFullscreen, | 91 ExitingFullscreen, |
| 90 NeedsScrollAndScaleRestore | 92 NeedsScrollAndScaleRestore |
| 91 }; | 93 }; |
| 92 State m_state = State::Initial; | 94 State m_state = State::Initial; |
| 93 | 95 |
| 94 float m_initialPageScaleFactor = 0.0f; | 96 float m_initialPageScaleFactor = 0.0f; |
| 95 IntSize m_initialScrollOffset; | 97 IntSize m_initialScrollOffset; |
| 96 FloatPoint m_initialVisualViewportOffset; | 98 FloatPoint m_initialVisualViewportOffset; |
| 99 bool m_initialBackgroundColorOverrideEnabled = false; | |
| 100 RGBA32 m_initialBackgroundColorOverride = Color::transparent; | |
| 97 }; | 101 }; |
| 98 | 102 |
| 99 } // namespace blink | 103 } // namespace blink |
| 100 | 104 |
| 101 #endif | 105 #endif |
| OLD | NEW |