| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 | 209 |
| 210 void LayerTreeImpl::UpdateMaxScrollOffset() { | 210 void LayerTreeImpl::UpdateMaxScrollOffset() { |
| 211 LayerImpl* root_scroll = RootScrollLayer(); | 211 LayerImpl* root_scroll = RootScrollLayer(); |
| 212 if (!root_scroll || !root_scroll->children().size()) | 212 if (!root_scroll || !root_scroll->children().size()) |
| 213 return; | 213 return; |
| 214 | 214 |
| 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 scrollable viewport size is based on device viewport instead of Blink's | |
| 219 // container layer, so we need to adjust for non-overlay scrollbars. | |
| 220 ScrollbarLayerImpl* horiz = root_scroll->horizontal_scrollbar_layer(); | |
| 221 ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer(); | |
| 222 if (horiz && !horiz->is_overlay_scrollbar()) | |
| 223 max_scroll.set_y(max_scroll.y() + horiz->thumb_thickness()); | |
| 224 if (vertical && !vertical->is_overlay_scrollbar()) | |
| 225 max_scroll.set_x(max_scroll.x() + vertical->thumb_thickness()); | |
| 226 | |
| 227 // 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 |
| 228 // having a vertical scrollbar but no horizontal overflow. | 219 // having a vertical scrollbar but no horizontal overflow. |
| 229 max_scroll.SetToMax(gfx::Vector2dF()); | 220 max_scroll.SetToMax(gfx::Vector2dF()); |
| 230 | 221 |
| 231 root_scroll_layer_->SetMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); | 222 root_scroll_layer_->SetMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); |
| 232 } | 223 } |
| 233 | 224 |
| 234 static void ApplySentScrollDeltasOn(LayerImpl* layer) { | 225 static void ApplySentScrollDeltasOn(LayerImpl* layer) { |
| 235 layer->ApplySentScrollDeltas(); | 226 layer->ApplySentScrollDeltas(); |
| 236 } | 227 } |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() | 599 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() |
| 609 const { | 600 const { |
| 610 // Only the active tree needs to know about layers with copy requests, as | 601 // Only the active tree needs to know about layers with copy requests, as |
| 611 // they are aborted if not serviced during draw. | 602 // they are aborted if not serviced during draw. |
| 612 DCHECK(IsActiveTree()); | 603 DCHECK(IsActiveTree()); |
| 613 | 604 |
| 614 return layers_with_copy_output_request_; | 605 return layers_with_copy_output_request_; |
| 615 } | 606 } |
| 616 | 607 |
| 617 } // namespace cc | 608 } // namespace cc |
| OLD | NEW |