| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/BrowserControls.h" | 5 #include "core/frame/BrowserControls.h" |
| 6 | 6 |
| 7 #include <algorithm> // for std::min and std::max |
| 8 |
| 7 #include "core/frame/FrameHost.h" | 9 #include "core/frame/FrameHost.h" |
| 8 #include "core/frame/VisualViewport.h" | 10 #include "core/frame/VisualViewport.h" |
| 9 #include "core/page/ChromeClient.h" | 11 #include "core/page/ChromeClient.h" |
| 12 #include "core/page/Page.h" |
| 10 #include "platform/geometry/FloatSize.h" | 13 #include "platform/geometry/FloatSize.h" |
| 11 #include <algorithm> // for std::min and std::max | |
| 12 | 14 |
| 13 namespace blink { | 15 namespace blink { |
| 14 | 16 |
| 15 BrowserControls::BrowserControls(const FrameHost& frameHost) | 17 BrowserControls::BrowserControls(const FrameHost& frameHost) |
| 16 : m_frameHost(&frameHost), | 18 : m_frameHost(&frameHost), |
| 17 m_height(0), | 19 m_height(0), |
| 18 m_shownRatio(0), | 20 m_shownRatio(0), |
| 19 m_baselineContentOffset(0), | 21 m_baselineContentOffset(0), |
| 20 m_accumulatedScrollDelta(0), | 22 m_accumulatedScrollDelta(0), |
| 21 m_shrinkViewport(false), | 23 m_shrinkViewport(false), |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 81 } |
| 80 | 82 |
| 81 void BrowserControls::setShownRatio(float shownRatio) { | 83 void BrowserControls::setShownRatio(float shownRatio) { |
| 82 shownRatio = std::min(shownRatio, 1.f); | 84 shownRatio = std::min(shownRatio, 1.f); |
| 83 shownRatio = std::max(shownRatio, 0.f); | 85 shownRatio = std::max(shownRatio, 0.f); |
| 84 | 86 |
| 85 if (m_shownRatio == shownRatio) | 87 if (m_shownRatio == shownRatio) |
| 86 return; | 88 return; |
| 87 | 89 |
| 88 m_shownRatio = shownRatio; | 90 m_shownRatio = shownRatio; |
| 89 m_frameHost->chromeClient().didUpdateBrowserControls(); | 91 m_frameHost->page().chromeClient().didUpdateBrowserControls(); |
| 90 } | 92 } |
| 91 | 93 |
| 92 void BrowserControls::updateConstraintsAndState( | 94 void BrowserControls::updateConstraintsAndState( |
| 93 WebBrowserControlsState constraints, | 95 WebBrowserControlsState constraints, |
| 94 WebBrowserControlsState current, | 96 WebBrowserControlsState current, |
| 95 bool animate) { | 97 bool animate) { |
| 96 m_permittedState = constraints; | 98 m_permittedState = constraints; |
| 97 | 99 |
| 98 DCHECK(!(constraints == WebBrowserControlsShown && | 100 DCHECK(!(constraints == WebBrowserControlsShown && |
| 99 current == WebBrowserControlsHidden)); | 101 current == WebBrowserControlsHidden)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 116 else | 118 else |
| 117 setShownRatio(1.f); | 119 setShownRatio(1.f); |
| 118 } | 120 } |
| 119 | 121 |
| 120 void BrowserControls::setHeight(float height, bool shrinkViewport) { | 122 void BrowserControls::setHeight(float height, bool shrinkViewport) { |
| 121 if (m_height == height && m_shrinkViewport == shrinkViewport) | 123 if (m_height == height && m_shrinkViewport == shrinkViewport) |
| 122 return; | 124 return; |
| 123 | 125 |
| 124 m_height = height; | 126 m_height = height; |
| 125 m_shrinkViewport = shrinkViewport; | 127 m_shrinkViewport = shrinkViewport; |
| 126 m_frameHost->chromeClient().didUpdateBrowserControls(); | 128 m_frameHost->page().chromeClient().didUpdateBrowserControls(); |
| 127 } | 129 } |
| 128 | 130 |
| 129 } // namespace blink | 131 } // namespace blink |
| OLD | NEW |