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