| 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" |
| 11 #include "cc/layers/heads_up_display_layer_impl.h" | 11 #include "cc/layers/heads_up_display_layer_impl.h" |
| 12 #include "cc/layers/render_surface_impl.h" | 12 #include "cc/layers/render_surface_impl.h" |
| 13 #include "cc/layers/scrollbar_layer_impl.h" | 13 #include "cc/layers/scrollbar_layer_impl_base.h" |
| 14 #include "cc/trees/layer_tree_host_common.h" | 14 #include "cc/trees/layer_tree_host_common.h" |
| 15 #include "cc/trees/layer_tree_host_impl.h" | 15 #include "cc/trees/layer_tree_host_impl.h" |
| 16 #include "ui/gfx/size_conversions.h" | 16 #include "ui/gfx/size_conversions.h" |
| 17 #include "ui/gfx/vector2d_conversions.h" | 17 #include "ui/gfx/vector2d_conversions.h" |
| 18 | 18 |
| 19 namespace cc { | 19 namespace cc { |
| 20 | 20 |
| 21 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) | 21 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) |
| 22 : layer_tree_host_impl_(layer_tree_host_impl), | 22 : layer_tree_host_impl_(layer_tree_host_impl), |
| 23 source_frame_number_(-1), | 23 source_frame_number_(-1), |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - | 215 gfx::Vector2dF max_scroll = gfx::Rect(ScrollableSize()).bottom_right() - |
| 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 // TODO(wjmaclean) This needs to go away, and be replaced with a single core |
| 226 // of login that works for both scrollbar layer types. This is already planned |
| 227 // as part of the larger pinch-zoom re-factoring viewport. |
| 225 void LayerTreeImpl::UpdateSolidColorScrollbars() { | 228 void LayerTreeImpl::UpdateSolidColorScrollbars() { |
| 226 DCHECK(settings().solid_color_scrollbars); | 229 DCHECK(settings().solid_color_scrollbars); |
| 227 | 230 |
| 228 LayerImpl* root_scroll = RootScrollLayer(); | 231 LayerImpl* root_scroll = RootScrollLayer(); |
| 229 DCHECK(root_scroll); | 232 DCHECK(root_scroll); |
| 230 DCHECK(IsActiveTree()); | 233 DCHECK(IsActiveTree()); |
| 231 | 234 |
| 232 gfx::RectF scrollable_viewport( | 235 gfx::RectF scrollable_viewport( |
| 233 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), | 236 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), |
| 234 ScrollableViewportSize()); | 237 ScrollableViewportSize()); |
| 235 float vertical_adjust = 0.0f; | 238 float vertical_adjust = 0.0f; |
| 236 if (RootClipLayer()) | 239 if (RootClipLayer()) |
| 237 vertical_adjust = layer_tree_host_impl_->VisibleViewportSize().height() - | 240 vertical_adjust = layer_tree_host_impl_->VisibleViewportSize().height() - |
| 238 RootClipLayer()->bounds().height(); | 241 RootClipLayer()->bounds().height(); |
| 239 if (ScrollbarLayerImpl* horiz = root_scroll->horizontal_scrollbar_layer()) { | 242 if (ScrollbarLayerImplBase* horiz = |
| 243 root_scroll->horizontal_scrollbar_layer()) { |
| 240 horiz->set_vertical_adjust(vertical_adjust); | 244 horiz->set_vertical_adjust(vertical_adjust); |
| 241 horiz->set_visible_to_total_length_ratio( | 245 horiz->set_visible_to_total_length_ratio( |
| 242 scrollable_viewport.width() / ScrollableSize().width()); | 246 scrollable_viewport.width() / ScrollableSize().width()); |
| 243 } | 247 } |
| 244 if (ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer()) { | 248 if (ScrollbarLayerImplBase* vertical = |
| 249 root_scroll->vertical_scrollbar_layer()) { |
| 245 vertical->set_vertical_adjust(vertical_adjust); | 250 vertical->set_vertical_adjust(vertical_adjust); |
| 246 vertical->set_visible_to_total_length_ratio( | 251 vertical->set_visible_to_total_length_ratio( |
| 247 scrollable_viewport.height() / ScrollableSize().height()); | 252 scrollable_viewport.height() / ScrollableSize().height()); |
| 248 } | 253 } |
| 249 } | 254 } |
| 250 | 255 |
| 251 void LayerTreeImpl::UpdateDrawProperties() { | 256 void LayerTreeImpl::UpdateDrawProperties() { |
| 252 if (IsActiveTree() && RootScrollLayer() && RootClipLayer()) | 257 if (IsActiveTree() && RootScrollLayer() && RootClipLayer()) |
| 253 UpdateRootScrollLayerSizeDelta(); | 258 UpdateRootScrollLayerSizeDelta(); |
| 254 | 259 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 555 |
| 551 void LayerTreeImpl::ClearLatencyInfo() { | 556 void LayerTreeImpl::ClearLatencyInfo() { |
| 552 latency_info_.Clear(); | 557 latency_info_.Clear(); |
| 553 } | 558 } |
| 554 | 559 |
| 555 void LayerTreeImpl::WillModifyTilePriorities() { | 560 void LayerTreeImpl::WillModifyTilePriorities() { |
| 556 layer_tree_host_impl_->SetNeedsManageTiles(); | 561 layer_tree_host_impl_->SetNeedsManageTiles(); |
| 557 } | 562 } |
| 558 | 563 |
| 559 } // namespace cc | 564 } // namespace cc |
| OLD | NEW |