OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 | 1302 |
1303 gfx::ScrollOffset max_offset( | 1303 gfx::ScrollOffset max_offset( |
1304 scaled_scroll_bounds.width() - clip_layer_bounds.width(), | 1304 scaled_scroll_bounds.width() - clip_layer_bounds.width(), |
1305 scaled_scroll_bounds.height() - clip_layer_bounds.height()); | 1305 scaled_scroll_bounds.height() - clip_layer_bounds.height()); |
1306 | 1306 |
1307 max_offset.Scale(1 / scale_factor); | 1307 max_offset.Scale(1 / scale_factor); |
1308 max_offset.SetToMax(gfx::ScrollOffset()); | 1308 max_offset.SetToMax(gfx::ScrollOffset()); |
1309 return max_offset; | 1309 return max_offset; |
1310 } | 1310 } |
1311 | 1311 |
| 1312 void ScrollTree::OnScrollOffsetAnimated(int layer_id, |
| 1313 int transform_tree_index, |
| 1314 int scroll_tree_index, |
| 1315 const gfx::ScrollOffset& scroll_offset, |
| 1316 LayerTreeImpl* layer_tree_impl) { |
| 1317 // Only active tree needs to be updated, pending tree will find out about |
| 1318 // these changes as a result of the shared SyncedProperty. |
| 1319 if (!property_trees()->is_active) |
| 1320 return; |
| 1321 |
| 1322 ScrollNode* scroll_node = Node(scroll_tree_index); |
| 1323 if (SetScrollOffset(layer_id, |
| 1324 ClampScrollOffsetToLimits(scroll_offset, scroll_node))) |
| 1325 layer_tree_impl->DidUpdateScrollOffset(layer_id, transform_tree_index); |
| 1326 layer_tree_impl->DidAnimateScrollOffset(); |
| 1327 } |
| 1328 |
1312 gfx::Size ScrollTree::scroll_clip_layer_bounds(int scroll_node_id) const { | 1329 gfx::Size ScrollTree::scroll_clip_layer_bounds(int scroll_node_id) const { |
1313 const ScrollNode* scroll_node = Node(scroll_node_id); | 1330 const ScrollNode* scroll_node = Node(scroll_node_id); |
1314 gfx::Size scroll_clip_layer_bounds = scroll_node->scroll_clip_layer_bounds; | 1331 gfx::Size scroll_clip_layer_bounds = scroll_node->scroll_clip_layer_bounds; |
1315 | 1332 |
1316 gfx::Vector2dF scroll_clip_layer_bounds_delta; | 1333 gfx::Vector2dF scroll_clip_layer_bounds_delta; |
1317 if (scroll_node->is_inner_viewport_scroll_layer) { | 1334 if (scroll_node->is_inner_viewport_scroll_layer) { |
1318 scroll_clip_layer_bounds_delta.Add( | 1335 scroll_clip_layer_bounds_delta.Add( |
1319 property_trees()->inner_viewport_container_bounds_delta()); | 1336 property_trees()->inner_viewport_container_bounds_delta()); |
1320 } else if (scroll_node->is_outer_viewport_scroll_layer) { | 1337 } else if (scroll_node->is_outer_viewport_scroll_layer) { |
1321 scroll_clip_layer_bounds_delta.Add( | 1338 scroll_clip_layer_bounds_delta.Add( |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2231 from_target.ConcatTransform(draw_transforms.from_target); | 2248 from_target.ConcatTransform(draw_transforms.from_target); |
2232 from_target.Scale(effect_node->surface_contents_scale.x(), | 2249 from_target.Scale(effect_node->surface_contents_scale.x(), |
2233 effect_node->surface_contents_scale.y()); | 2250 effect_node->surface_contents_scale.y()); |
2234 DCHECK(from_target.ApproximatelyEqual(*transform) || | 2251 DCHECK(from_target.ApproximatelyEqual(*transform) || |
2235 !draw_transforms.invertible); | 2252 !draw_transforms.invertible); |
2236 } | 2253 } |
2237 return success; | 2254 return success; |
2238 } | 2255 } |
2239 | 2256 |
2240 } // namespace cc | 2257 } // namespace cc |
OLD | NEW |