| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 layer->needs_show_scrollbars_ = needs_show_scrollbars_; | 330 layer->needs_show_scrollbars_ = needs_show_scrollbars_; |
| 331 | 331 |
| 332 if (layer_property_changed_) { | 332 if (layer_property_changed_) { |
| 333 layer->layer_tree_impl()->set_needs_update_draw_properties(); | 333 layer->layer_tree_impl()->set_needs_update_draw_properties(); |
| 334 layer->layer_property_changed_ = true; | 334 layer->layer_property_changed_ = true; |
| 335 } | 335 } |
| 336 | 336 |
| 337 layer->SetBounds(bounds_); | 337 layer->SetBounds(bounds_); |
| 338 layer->SetScrollClipLayer(scroll_clip_layer_id_); | 338 layer->SetScrollClipLayer(scroll_clip_layer_id_); |
| 339 layer->SetMutableProperties(mutable_properties_); | 339 layer->SetMutableProperties(mutable_properties_); |
| 340 layer->SetScrollSnapOffsets(snap_offsets_); |
| 340 | 341 |
| 341 // If the main thread commits multiple times before the impl thread actually | 342 // If the main thread commits multiple times before the impl thread actually |
| 342 // draws, then damage tracking will become incorrect if we simply clobber the | 343 // draws, then damage tracking will become incorrect if we simply clobber the |
| 343 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. | 344 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. |
| 344 // union) any update changes that have occurred on the main thread. | 345 // union) any update changes that have occurred on the main thread. |
| 345 update_rect_.Union(layer->update_rect()); | 346 update_rect_.Union(layer->update_rect()); |
| 346 layer->SetUpdateRect(update_rect_); | 347 layer->SetUpdateRect(update_rect_); |
| 347 | 348 |
| 348 if (owned_debug_info_) | 349 if (owned_debug_info_) |
| 349 layer->SetDebugInfo(std::move(owned_debug_info_)); | 350 layer->SetDebugInfo(std::move(owned_debug_info_)); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 return; | 500 return; |
| 500 | 501 |
| 501 bounds_ = bounds; | 502 bounds_ = bounds; |
| 502 | 503 |
| 503 // Scrollbar positions depend on scrolling bounds and scroll clip bounds. | 504 // Scrollbar positions depend on scrolling bounds and scroll clip bounds. |
| 504 layer_tree_impl()->SetScrollbarGeometriesNeedUpdate(); | 505 layer_tree_impl()->SetScrollbarGeometriesNeedUpdate(); |
| 505 | 506 |
| 506 NoteLayerPropertyChanged(); | 507 NoteLayerPropertyChanged(); |
| 507 } | 508 } |
| 508 | 509 |
| 510 void LayerImpl::SetScrollSnapOffsets(const SnapPointList& offsets) { |
| 511 snap_offsets_ = offsets; |
| 512 layer_tree_impl()->DidUpdateScrollState(id()); |
| 513 |
| 514 NoteLayerPropertyChanged(); |
| 515 } |
| 516 |
| 509 void LayerImpl::SetViewportBoundsDelta(const gfx::Vector2dF& bounds_delta) { | 517 void LayerImpl::SetViewportBoundsDelta(const gfx::Vector2dF& bounds_delta) { |
| 510 DCHECK(IsActive()); | 518 DCHECK(IsActive()); |
| 511 | 519 |
| 512 if (bounds_delta == ViewportBoundsDelta()) | 520 if (bounds_delta == ViewportBoundsDelta()) |
| 513 return; | 521 return; |
| 514 | 522 |
| 515 PropertyTrees* property_trees = GetPropertyTrees(); | 523 PropertyTrees* property_trees = GetPropertyTrees(); |
| 516 switch (viewport_layer_type_) { | 524 switch (viewport_layer_type_) { |
| 517 case (INNER_VIEWPORT_CONTAINER): | 525 case (INNER_VIEWPORT_CONTAINER): |
| 518 property_trees->SetInnerViewportContainerBoundsDelta(bounds_delta); | 526 property_trees->SetInnerViewportContainerBoundsDelta(bounds_delta); |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 | 997 |
| 990 const bool has_valid_scroll_node = | 998 const bool has_valid_scroll_node = |
| 991 !!GetScrollTree().Node(scroll_tree_index()); | 999 !!GetScrollTree().Node(scroll_tree_index()); |
| 992 DCHECK(has_valid_scroll_node); | 1000 DCHECK(has_valid_scroll_node); |
| 993 | 1001 |
| 994 return has_valid_transform_node && has_valid_effect_node && | 1002 return has_valid_transform_node && has_valid_effect_node && |
| 995 has_valid_clip_node && has_valid_scroll_node; | 1003 has_valid_clip_node && has_valid_scroll_node; |
| 996 } | 1004 } |
| 997 | 1005 |
| 998 } // namespace cc | 1006 } // namespace cc |
| OLD | NEW |