| 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 <utility> | 10 #include <utility> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 mask_layer_id_(-1), | 55 mask_layer_id_(-1), |
| 56 replica_layer_id_(-1), | 56 replica_layer_id_(-1), |
| 57 layer_id_(id), | 57 layer_id_(id), |
| 58 layer_tree_impl_(tree_impl), | 58 layer_tree_impl_(tree_impl), |
| 59 scroll_offset_(scroll_offset), | 59 scroll_offset_(scroll_offset), |
| 60 scroll_clip_layer_id_(Layer::INVALID_ID), | 60 scroll_clip_layer_id_(Layer::INVALID_ID), |
| 61 main_thread_scrolling_reasons_( | 61 main_thread_scrolling_reasons_( |
| 62 MainThreadScrollingReason::kNotScrollingOnMain), | 62 MainThreadScrollingReason::kNotScrollingOnMain), |
| 63 user_scrollable_horizontal_(true), | 63 user_scrollable_horizontal_(true), |
| 64 user_scrollable_vertical_(true), | 64 user_scrollable_vertical_(true), |
| 65 stacking_order_changed_(false), | |
| 66 double_sided_(true), | 65 double_sided_(true), |
| 67 should_flatten_transform_(true), | 66 should_flatten_transform_(true), |
| 68 should_flatten_transform_from_property_tree_(false), | 67 should_flatten_transform_from_property_tree_(false), |
| 69 layer_property_changed_(false), | 68 layer_property_changed_(false), |
| 70 masks_to_bounds_(false), | 69 masks_to_bounds_(false), |
| 71 contents_opaque_(false), | 70 contents_opaque_(false), |
| 72 is_root_for_isolated_group_(false), | 71 is_root_for_isolated_group_(false), |
| 73 use_parent_backface_visibility_(false), | 72 use_parent_backface_visibility_(false), |
| 74 use_local_transform_for_backface_visibility_(false), | 73 use_local_transform_for_backface_visibility_(false), |
| 75 should_check_backface_visibility_(false), | 74 should_check_backface_visibility_(false), |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 602 |
| 604 layer->PassCopyRequests(©_requests_); | 603 layer->PassCopyRequests(©_requests_); |
| 605 | 604 |
| 606 // If the main thread commits multiple times before the impl thread actually | 605 // If the main thread commits multiple times before the impl thread actually |
| 607 // draws, then damage tracking will become incorrect if we simply clobber the | 606 // draws, then damage tracking will become incorrect if we simply clobber the |
| 608 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. | 607 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. |
| 609 // union) any update changes that have occurred on the main thread. | 608 // union) any update changes that have occurred on the main thread. |
| 610 update_rect_.Union(layer->update_rect()); | 609 update_rect_.Union(layer->update_rect()); |
| 611 layer->SetUpdateRect(update_rect_); | 610 layer->SetUpdateRect(update_rect_); |
| 612 | 611 |
| 613 layer->SetStackingOrderChanged(stacking_order_changed_); | |
| 614 layer->SetDebugInfo(debug_info_); | 612 layer->SetDebugInfo(debug_info_); |
| 615 | 613 |
| 616 if (frame_timing_requests_dirty_) { | 614 if (frame_timing_requests_dirty_) { |
| 617 layer->SetFrameTimingRequests(frame_timing_requests_); | 615 layer->SetFrameTimingRequests(frame_timing_requests_); |
| 618 frame_timing_requests_dirty_ = false; | 616 frame_timing_requests_dirty_ = false; |
| 619 } | 617 } |
| 620 | 618 |
| 621 // Reset any state that should be cleared for the next update. | 619 // Reset any state that should be cleared for the next update. |
| 622 stacking_order_changed_ = false; | |
| 623 layer_property_changed_ = false; | 620 layer_property_changed_ = false; |
| 624 update_rect_ = gfx::Rect(); | 621 update_rect_ = gfx::Rect(); |
| 625 needs_push_properties_ = false; | 622 needs_push_properties_ = false; |
| 626 num_dependents_need_push_properties_ = 0; | 623 num_dependents_need_push_properties_ = 0; |
| 627 } | 624 } |
| 628 | 625 |
| 629 bool LayerImpl::IsAffectedByPageScale() const { | 626 bool LayerImpl::IsAffectedByPageScale() const { |
| 630 TransformTree& transform_tree = | 627 TransformTree& transform_tree = |
| 631 layer_tree_impl()->property_trees()->transform_tree; | 628 layer_tree_impl()->property_trees()->transform_tree; |
| 632 return transform_tree.Node(transform_tree_index()) | 629 return transform_tree.Node(transform_tree_index()) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 } | 676 } |
| 680 | 677 |
| 681 list = new base::ListValue; | 678 list = new base::ListValue; |
| 682 for (size_t i = 0; i < children_.size(); ++i) | 679 for (size_t i = 0; i < children_.size(); ++i) |
| 683 list->Append(children_[i]->LayerTreeAsJson()); | 680 list->Append(children_[i]->LayerTreeAsJson()); |
| 684 result->Set("Children", list); | 681 result->Set("Children", list); |
| 685 | 682 |
| 686 return result; | 683 return result; |
| 687 } | 684 } |
| 688 | 685 |
| 689 void LayerImpl::SetStackingOrderChanged(bool stacking_order_changed) { | |
| 690 if (stacking_order_changed) { | |
| 691 stacking_order_changed_ = true; | |
| 692 NoteLayerPropertyChangedForSubtree(); | |
| 693 } | |
| 694 } | |
| 695 | |
| 696 bool LayerImpl::LayerPropertyChanged() const { | 686 bool LayerImpl::LayerPropertyChanged() const { |
| 697 if (layer_property_changed_) | 687 if (layer_property_changed_) |
| 698 return true; | 688 return true; |
| 699 TransformNode* node = | 689 TransformNode* node = |
| 700 layer_tree_impl()->property_trees()->transform_tree.Node( | 690 layer_tree_impl()->property_trees()->transform_tree.Node( |
| 701 transform_tree_index()); | 691 transform_tree_index()); |
| 702 if (node && node->data.transform_changed) | 692 if (node && node->data.transform_changed) |
| 703 return true; | 693 return true; |
| 704 return false; | 694 return false; |
| 705 } | 695 } |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 | 1252 |
| 1263 void LayerImpl::SetTransformAndInvertibility(const gfx::Transform& transform, | 1253 void LayerImpl::SetTransformAndInvertibility(const gfx::Transform& transform, |
| 1264 bool transform_is_invertible) { | 1254 bool transform_is_invertible) { |
| 1265 if (transform_ == transform) { | 1255 if (transform_ == transform) { |
| 1266 DCHECK(transform_is_invertible_ == transform_is_invertible) | 1256 DCHECK(transform_is_invertible_ == transform_is_invertible) |
| 1267 << "Can't change invertibility if transform is unchanged"; | 1257 << "Can't change invertibility if transform is unchanged"; |
| 1268 return; | 1258 return; |
| 1269 } | 1259 } |
| 1270 transform_ = transform; | 1260 transform_ = transform; |
| 1271 transform_is_invertible_ = transform_is_invertible; | 1261 transform_is_invertible_ = transform_is_invertible; |
| 1272 NoteLayerPropertyChangedForSubtree(); | |
| 1273 } | 1262 } |
| 1274 | 1263 |
| 1275 bool LayerImpl::TransformIsAnimating() const { | 1264 bool LayerImpl::TransformIsAnimating() const { |
| 1276 LayerAnimationController::ObserverType observer_type = | 1265 LayerAnimationController::ObserverType observer_type = |
| 1277 IsActive() ? LayerAnimationController::ObserverType::ACTIVE | 1266 IsActive() ? LayerAnimationController::ObserverType::ACTIVE |
| 1278 : LayerAnimationController::ObserverType::PENDING; | 1267 : LayerAnimationController::ObserverType::PENDING; |
| 1279 return layer_animation_controller_ | 1268 return layer_animation_controller_ |
| 1280 ? layer_animation_controller_->IsCurrentlyAnimatingProperty( | 1269 ? layer_animation_controller_->IsCurrentlyAnimatingProperty( |
| 1281 Animation::TRANSFORM, observer_type) | 1270 Animation::TRANSFORM, observer_type) |
| 1282 : layer_tree_impl_->IsAnimatingTransformProperty(this); | 1271 : layer_tree_impl_->IsAnimatingTransformProperty(this); |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1798 .layer_transforms_should_scale_layer_contents) { | 1787 .layer_transforms_should_scale_layer_contents) { |
| 1799 return default_scale; | 1788 return default_scale; |
| 1800 } | 1789 } |
| 1801 | 1790 |
| 1802 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1791 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
| 1803 DrawTransform(), default_scale); | 1792 DrawTransform(), default_scale); |
| 1804 return std::max(transform_scales.x(), transform_scales.y()); | 1793 return std::max(transform_scales.x(), transform_scales.y()); |
| 1805 } | 1794 } |
| 1806 | 1795 |
| 1807 } // namespace cc | 1796 } // namespace cc |
| OLD | NEW |