OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "cc/trees/layer_tree_host.h" | 9 #include "cc/trees/layer_tree_host.h" |
10 #include "content/renderer/gpu/render_widget_compositor.h" | 10 #include "content/renderer/gpu/render_widget_compositor.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // compositor has been initialized. | 29 // compositor has been initialized. |
30 LOG_IF(WARNING, !compositor_) << "OnUpdateTopControlsState was unhandled."; | 30 LOG_IF(WARNING, !compositor_) << "OnUpdateTopControlsState was unhandled."; |
31 if (compositor_) { | 31 if (compositor_) { |
32 cc::TopControlsState constraints = cc::BOTH; | 32 cc::TopControlsState constraints = cc::BOTH; |
33 if (!enable_showing) | 33 if (!enable_showing) |
34 constraints = cc::HIDDEN; | 34 constraints = cc::HIDDEN; |
35 if (!enable_hiding) | 35 if (!enable_hiding) |
36 constraints = cc::SHOWN; | 36 constraints = cc::SHOWN; |
37 cc::TopControlsState current = cc::BOTH; | 37 cc::TopControlsState current = cc::BOTH; |
38 compositor_->UpdateTopControlsState(constraints, current, animate); | 38 compositor_->UpdateTopControlsState(constraints, current, animate); |
| 39 top_controls_constraints_ = constraints; |
39 } | 40 } |
40 } | 41 } |
41 | 42 |
42 void RenderViewImpl::UpdateTopControlsState(TopControlsState constraints, | 43 void RenderViewImpl::UpdateTopControlsState(TopControlsState constraints, |
43 TopControlsState current, | 44 TopControlsState current, |
44 bool animate) { | 45 bool animate) { |
45 cc::TopControlsState constraints_cc = | 46 cc::TopControlsState constraints_cc = |
46 ContentToCcTopControlsState(constraints); | 47 ContentToCcTopControlsState(constraints); |
47 cc::TopControlsState current_cc = ContentToCcTopControlsState(current); | 48 cc::TopControlsState current_cc = ContentToCcTopControlsState(current); |
48 if (compositor_) | 49 if (compositor_) |
49 compositor_->UpdateTopControlsState(constraints_cc, current_cc, animate); | 50 compositor_->UpdateTopControlsState(constraints_cc, current_cc, animate); |
| 51 top_controls_constraints_ = constraints_cc; |
| 52 } |
| 53 |
| 54 void RenderViewImpl::didScrollWithKeyboard(const WebKit::WebSize& delta) { |
| 55 if (delta.height == 0) |
| 56 return; |
| 57 if (compositor_) { |
| 58 cc::TopControlsState current = delta.height < 0 ? cc::SHOWN : cc::HIDDEN; |
| 59 compositor_->UpdateTopControlsState(top_controls_constraints_, |
| 60 current, |
| 61 true); |
| 62 } |
50 } | 63 } |
51 | 64 |
52 } // namespace content | 65 } // namespace content |
OLD | NEW |