Chromium Code Reviews| 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 // FIXME: This logic will need to change when we re-factor RootScrollLayer() |
|
enne (OOO)
2013/06/26 17:39:05
FIXME => TODO(wjmaclean)
wjmaclean
2013/06/26 18:16:00
Done.
| |
| 227 // into InnerViewportScrollLayer() and OuterViewportScrollLayer(), since in | |
| 228 // the desktop case the OuterViewportScrollLayer() won't have solid color | |
| 229 // scrollbars, while the InnerViewportScrollLayer() will. Ultimately, the | |
| 230 // plan is for this function to disappear altogether. | |
| 231 DCHECK(settings().force_solid_color_scrollbars); | |
| 227 | 232 |
| 228 LayerImpl* root_scroll = RootScrollLayer(); | 233 LayerImpl* root_scroll = RootScrollLayer(); |
| 229 DCHECK(root_scroll); | 234 DCHECK(root_scroll); |
| 230 DCHECK(IsActiveTree()); | 235 DCHECK(IsActiveTree()); |
| 231 | 236 |
| 232 gfx::RectF scrollable_viewport( | 237 gfx::RectF scrollable_viewport( |
| 233 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), | 238 gfx::PointAtOffsetFromOrigin(root_scroll->TotalScrollOffset()), |
| 234 ScrollableViewportSize()); | 239 ScrollableViewportSize()); |
| 235 float vertical_adjust = 0.0f; | 240 float vertical_adjust = 0.0f; |
| 236 if (RootClipLayer()) | 241 if (RootClipLayer()) |
| 237 vertical_adjust = layer_tree_host_impl_->VisibleViewportSize().height() - | 242 vertical_adjust = layer_tree_host_impl_->VisibleViewportSize().height() - |
| 238 RootClipLayer()->bounds().height(); | 243 RootClipLayer()->bounds().height(); |
| 239 if (ScrollbarLayerImpl* horiz = root_scroll->horizontal_scrollbar_layer()) { | 244 if (ScrollbarLayerImpl* horiz = root_scroll->horizontal_scrollbar_layer()) { |
| 240 horiz->set_vertical_adjust(vertical_adjust); | 245 horiz->set_vertical_adjust(vertical_adjust); |
| 241 horiz->set_visible_to_total_length_ratio( | 246 horiz->set_visible_to_total_length_ratio( |
| 242 scrollable_viewport.width() / ScrollableSize().width()); | 247 scrollable_viewport.width() / ScrollableSize().width()); |
| 243 } | 248 } |
| 244 if (ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer()) { | 249 if (ScrollbarLayerImpl* vertical = 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 |
| 255 if (settings().solid_color_scrollbars && | 260 if (settings().force_solid_color_scrollbars && |
| 256 IsActiveTree() && | 261 IsActiveTree() && |
| 257 RootScrollLayer()) { | 262 RootScrollLayer()) { |
| 258 UpdateSolidColorScrollbars(); | 263 UpdateSolidColorScrollbars(); |
| 259 | 264 |
| 260 // The top controls manager is incompatible with the WebKit-created cliprect | 265 // 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 | 266 // 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 | 267 // hides. It's safe to deactivate the clip rect if no non-overlay scrollbars |
| 263 // are present. | 268 // are present. |
| 264 if (RootClipLayer() && layer_tree_host_impl_->top_controls_manager()) | 269 if (RootClipLayer() && layer_tree_host_impl_->top_controls_manager()) |
| 265 RootClipLayer()->SetMasksToBounds(false); | 270 RootClipLayer()->SetMasksToBounds(false); |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 567 | 572 |
| 568 void LayerTreeImpl::ClearLatencyInfo() { | 573 void LayerTreeImpl::ClearLatencyInfo() { |
| 569 latency_info_.Clear(); | 574 latency_info_.Clear(); |
| 570 } | 575 } |
| 571 | 576 |
| 572 void LayerTreeImpl::WillModifyTilePriorities() { | 577 void LayerTreeImpl::WillModifyTilePriorities() { |
| 573 layer_tree_host_impl_->SetNeedsManageTiles(); | 578 layer_tree_host_impl_->SetNeedsManageTiles(); |
| 574 } | 579 } |
| 575 | 580 |
| 576 } // namespace cc | 581 } // namespace cc |
| OLD | NEW |