OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "cc/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/animation/keyframed_animation_curve.h" | 8 #include "cc/animation/keyframed_animation_curve.h" |
9 #include "cc/animation/scrollbar_animation_controller.h" | 9 #include "cc/animation/scrollbar_animation_controller.h" |
10 #include "cc/debug/traced_value.h" | 10 #include "cc/debug/traced_value.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 gfx::RectF(ScrollableViewportSize()).bottom_right(); | 216 gfx::RectF(ScrollableViewportSize()).bottom_right(); |
217 | 217 |
218 // The viewport may be larger than the contents in some cases, such as | 218 // The viewport may be larger than the contents in some cases, such as |
219 // having a vertical scrollbar but no horizontal overflow. | 219 // having a vertical scrollbar but no horizontal overflow. |
220 max_scroll.SetToMax(gfx::Vector2dF()); | 220 max_scroll.SetToMax(gfx::Vector2dF()); |
221 | 221 |
222 root_scroll_layer_->SetMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); | 222 root_scroll_layer_->SetMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); |
223 } | 223 } |
224 | 224 |
225 void LayerTreeImpl::UpdateSolidColorScrollbars() { | 225 void LayerTreeImpl::UpdateSolidColorScrollbars() { |
226 DCHECK(settings().solid_color_scrollbars); | 226 // TODO(wjmaclean) This logic will need to change when we re-factor |
| 227 // RootScrollLayer() into InnerViewportScrollLayer() and |
| 228 // OuterViewportScrollLayer(), since in the desktop case the |
| 229 // OuterViewportScrollLayer() won't have solid color |
| 230 // scrollbars, while the InnerViewportScrollLayer() will. Ultimately, the |
| 231 // plan is for this function to disappear altogether. |
| 232 DCHECK(settings().force_solid_color_scrollbars); |
227 | 233 |
228 LayerImpl* root_scroll = RootScrollLayer(); | 234 LayerImpl* root_scroll = RootScrollLayer(); |
229 DCHECK(root_scroll); | 235 DCHECK(root_scroll); |
230 DCHECK(IsActiveTree()); | 236 DCHECK(IsActiveTree()); |
231 | 237 |
232 gfx::RectF scrollable_viewport( | 238 gfx::RectF scrollable_viewport( |
233 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), | 239 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), |
234 ScrollableViewportSize()); | 240 ScrollableViewportSize()); |
235 float vertical_adjust = 0.0f; | 241 float vertical_adjust = 0.0f; |
236 if (RootClipLayer()) | 242 if (RootClipLayer()) |
237 vertical_adjust = layer_tree_host_impl_->VisibleViewportSize().height() - | 243 vertical_adjust = layer_tree_host_impl_->VisibleViewportSize().height() - |
238 RootClipLayer()->bounds().height(); | 244 RootClipLayer()->bounds().height(); |
239 if (ScrollbarLayerImpl* horiz = root_scroll->horizontal_scrollbar_layer()) { | 245 if (ScrollbarLayerImpl* horiz = root_scroll->horizontal_scrollbar_layer()) { |
240 horiz->set_vertical_adjust(vertical_adjust); | 246 horiz->set_vertical_adjust(vertical_adjust); |
241 horiz->set_visible_to_total_length_ratio( | 247 horiz->set_visible_to_total_length_ratio( |
242 scrollable_viewport.width() / ScrollableSize().width()); | 248 scrollable_viewport.width() / ScrollableSize().width()); |
243 } | 249 } |
244 if (ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer()) { | 250 if (ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer()) { |
245 vertical->set_vertical_adjust(vertical_adjust); | 251 vertical->set_vertical_adjust(vertical_adjust); |
246 vertical->set_visible_to_total_length_ratio( | 252 vertical->set_visible_to_total_length_ratio( |
247 scrollable_viewport.height() / ScrollableSize().height()); | 253 scrollable_viewport.height() / ScrollableSize().height()); |
248 } | 254 } |
249 } | 255 } |
250 | 256 |
251 void LayerTreeImpl::UpdateDrawProperties() { | 257 void LayerTreeImpl::UpdateDrawProperties() { |
252 if (IsActiveTree() && RootScrollLayer() && RootClipLayer()) | 258 if (IsActiveTree() && RootScrollLayer() && RootClipLayer()) |
253 UpdateRootScrollLayerSizeDelta(); | 259 UpdateRootScrollLayerSizeDelta(); |
254 | 260 |
255 if (settings().solid_color_scrollbars && | 261 if (settings().force_solid_color_scrollbars && |
256 IsActiveTree() && | 262 IsActiveTree() && |
257 RootScrollLayer()) { | 263 RootScrollLayer()) { |
258 UpdateSolidColorScrollbars(); | 264 UpdateSolidColorScrollbars(); |
259 | 265 |
260 // The top controls manager is incompatible with the WebKit-created cliprect | 266 // The top controls manager is incompatible with the WebKit-created cliprect |
261 // because it can bring into view a larger amount of content when it | 267 // because it can bring into view a larger amount of content when it |
262 // hides. It's safe to deactivate the clip rect if no non-overlay scrollbars | 268 // hides. It's safe to deactivate the clip rect if no non-overlay scrollbars |
263 // are present. | 269 // are present. |
264 if (RootClipLayer() && layer_tree_host_impl_->top_controls_manager()) | 270 if (RootClipLayer() && layer_tree_host_impl_->top_controls_manager()) |
265 RootClipLayer()->SetMasksToBounds(false); | 271 RootClipLayer()->SetMasksToBounds(false); |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 | 556 |
551 void LayerTreeImpl::ClearLatencyInfo() { | 557 void LayerTreeImpl::ClearLatencyInfo() { |
552 latency_info_.Clear(); | 558 latency_info_.Clear(); |
553 } | 559 } |
554 | 560 |
555 void LayerTreeImpl::WillModifyTilePriorities() { | 561 void LayerTreeImpl::WillModifyTilePriorities() { |
556 layer_tree_host_impl_->SetNeedsManageTiles(); | 562 layer_tree_host_impl_->SetNeedsManageTiles(); |
557 } | 563 } |
558 | 564 |
559 } // namespace cc | 565 } // namespace cc |
OLD | NEW |