| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/frame/TopControls.h" | 5 #include "core/frame/TopControls.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameHost.h" | 7 #include "core/frame/FrameHost.h" |
| 8 #include "core/frame/VisualViewport.h" | 8 #include "core/frame/VisualViewport.h" |
| 9 #include "core/page/ChromeClient.h" | 9 #include "core/page/ChromeClient.h" |
| 10 #include "platform/geometry/FloatSize.h" | 10 #include "platform/geometry/FloatSize.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 if (m_shownRatio == shownRatio) | 91 if (m_shownRatio == shownRatio) |
| 92 return; | 92 return; |
| 93 | 93 |
| 94 m_shownRatio = shownRatio; | 94 m_shownRatio = shownRatio; |
| 95 m_frameHost->chromeClient().didUpdateTopControls(); | 95 m_frameHost->chromeClient().didUpdateTopControls(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void TopControls::updateConstraints(WebTopControlsState constraints) | 98 void TopControls::updateConstraints(WebTopControlsState constraints) |
| 99 { | 99 { |
| 100 m_permittedState = constraints; | 100 m_permittedState = constraints; |
| 101 | |
| 102 if (m_permittedState == WebTopControlsShown) | |
| 103 setShownRatio(1.f); | |
| 104 else if (m_permittedState == WebTopControlsHidden) | |
| 105 setShownRatio(0.f); | |
| 106 } | 101 } |
| 107 | 102 |
| 108 void TopControls::setHeight(float height, bool shrinkViewport) | 103 void TopControls::setHeight(float height, bool shrinkViewport) |
| 109 { | 104 { |
| 110 if (m_height == height && m_shrinkViewport == shrinkViewport) | 105 if (m_height == height && m_shrinkViewport == shrinkViewport) |
| 111 return; | 106 return; |
| 112 | 107 |
| 113 m_height = height; | 108 m_height = height; |
| 114 m_shrinkViewport = shrinkViewport; | 109 m_shrinkViewport = shrinkViewport; |
| 115 m_frameHost->chromeClient().didUpdateTopControls(); | 110 m_frameHost->chromeClient().didUpdateTopControls(); |
| 116 } | 111 } |
| 117 | 112 |
| 118 } // namespace blink | 113 } // namespace blink |
| OLD | NEW |