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/layer_impl.h" | 5 #include "cc/layer_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "cc/animation_registrar.h" | 10 #include "cc/animation_registrar.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 layer->SetDrawsContent(DrawsContent()); | 326 layer->SetDrawsContent(DrawsContent()); |
327 layer->SetFilters(filters()); | 327 layer->SetFilters(filters()); |
328 layer->SetFilter(filter()); | 328 layer->SetFilter(filter()); |
329 layer->SetBackgroundFilters(background_filters()); | 329 layer->SetBackgroundFilters(background_filters()); |
330 layer->SetMasksToBounds(masks_to_bounds_); | 330 layer->SetMasksToBounds(masks_to_bounds_); |
331 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); | 331 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); |
332 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); | 332 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); |
333 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); | 333 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); |
334 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); | 334 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); |
335 layer->SetContentsOpaque(contents_opaque_); | 335 layer->SetContentsOpaque(contents_opaque_); |
336 if (!OpacityIsAnimating()) | 336 layer->SetOpacity(opacity_); |
337 layer->SetOpacity(opacity_); | |
338 layer->SetPosition(position_); | 337 layer->SetPosition(position_); |
339 layer->SetIsContainerForFixedPositionLayers( | 338 layer->SetIsContainerForFixedPositionLayers( |
340 is_container_for_fixed_position_layers_); | 339 is_container_for_fixed_position_layers_); |
341 layer->SetFixedToContainerLayer(fixed_to_container_layer_); | 340 layer->SetFixedToContainerLayer(fixed_to_container_layer_); |
342 layer->SetPreserves3d(preserves_3d()); | 341 layer->SetPreserves3d(preserves_3d()); |
343 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); | 342 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); |
344 layer->SetSublayerTransform(sublayer_transform_); | 343 layer->SetSublayerTransform(sublayer_transform_); |
345 if (!TransformIsAnimating()) | 344 layer->SetTransform(transform_); |
346 layer->SetTransform(transform_); | |
347 | 345 |
348 layer->SetScrollable(scrollable_); | 346 layer->SetScrollable(scrollable_); |
349 layer->SetScrollOffset(scroll_offset_); | 347 layer->SetScrollOffset(scroll_offset_); |
350 layer->SetMaxScrollOffset(max_scroll_offset_); | 348 layer->SetMaxScrollOffset(max_scroll_offset_); |
351 | 349 |
352 // If the main thread commits multiple times before the impl thread actually | 350 // If the main thread commits multiple times before the impl thread actually |
353 // draws, then damage tracking will become incorrect if we simply clobber the | 351 // draws, then damage tracking will become incorrect if we simply clobber the |
354 // updateRect here. The LayerImpl's updateRect needs to accumulate (i.e. | 352 // updateRect here. The LayerImpl's updateRect needs to accumulate (i.e. |
355 // union) any update changes that have occurred on the main thread. | 353 // union) any update changes that have occurred on the main thread. |
356 update_rect_.Union(layer->update_rect()); | 354 update_rect_.Union(layer->update_rect()); |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 return; | 708 return; |
711 | 709 |
712 opacity_ = opacity; | 710 opacity_ = opacity; |
713 NoteLayerSurfacePropertyChanged(); | 711 NoteLayerSurfacePropertyChanged(); |
714 } | 712 } |
715 | 713 |
716 bool LayerImpl::OpacityIsAnimating() const { | 714 bool LayerImpl::OpacityIsAnimating() const { |
717 return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity); | 715 return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity); |
718 } | 716 } |
719 | 717 |
| 718 bool LayerImpl::OpacityIsAnimatingOnImplOnly() const { |
| 719 Animation* opacity_animation = |
| 720 layer_animation_controller_->GetAnimation(Animation::Opacity); |
| 721 return opacity_animation && opacity_animation->is_impl_only(); |
| 722 } |
| 723 |
720 void LayerImpl::SetPosition(gfx::PointF position) { | 724 void LayerImpl::SetPosition(gfx::PointF position) { |
721 if (position_ == position) | 725 if (position_ == position) |
722 return; | 726 return; |
723 | 727 |
724 position_ = position; | 728 position_ = position; |
725 NoteLayerPropertyChangedForSubtree(); | 729 NoteLayerPropertyChangedForSubtree(); |
726 } | 730 } |
727 | 731 |
728 void LayerImpl::SetPreserves3d(bool preserves3_d) { | 732 void LayerImpl::SetPreserves3d(bool preserves3_d) { |
729 if (preserves_3d_ == preserves3_d) | 733 if (preserves_3d_ == preserves3_d) |
(...skipping 18 matching lines...) Expand all Loading... |
748 return; | 752 return; |
749 | 753 |
750 transform_ = transform; | 754 transform_ = transform; |
751 NoteLayerSurfacePropertyChanged(); | 755 NoteLayerSurfacePropertyChanged(); |
752 } | 756 } |
753 | 757 |
754 bool LayerImpl::TransformIsAnimating() const { | 758 bool LayerImpl::TransformIsAnimating() const { |
755 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); | 759 return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); |
756 } | 760 } |
757 | 761 |
| 762 bool LayerImpl::TransformIsAnimatingOnImplOnly() const { |
| 763 Animation* transform_animation = |
| 764 layer_animation_controller_->GetAnimation(Animation::Transform); |
| 765 return transform_animation && transform_animation->is_impl_only(); |
| 766 } |
| 767 |
758 void LayerImpl::SetContentBounds(gfx::Size content_bounds) { | 768 void LayerImpl::SetContentBounds(gfx::Size content_bounds) { |
759 if (this->content_bounds() == content_bounds) | 769 if (this->content_bounds() == content_bounds) |
760 return; | 770 return; |
761 | 771 |
762 draw_properties_.content_bounds = content_bounds; | 772 draw_properties_.content_bounds = content_bounds; |
763 NoteLayerPropertyChanged(); | 773 NoteLayerPropertyChanged(); |
764 } | 774 } |
765 | 775 |
766 void LayerImpl::SetContentsScale(float contents_scale_x, | 776 void LayerImpl::SetContentsScale(float contents_scale_x, |
767 float contents_scale_y) { | 777 float contents_scale_y) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 | 952 |
943 } | 953 } |
944 | 954 |
945 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 955 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
946 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 956 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
947 AsValueInto(state.get()); | 957 AsValueInto(state.get()); |
948 return state.PassAs<base::Value>(); | 958 return state.PassAs<base::Value>(); |
949 } | 959 } |
950 | 960 |
951 } // namespace cc | 961 } // namespace cc |
OLD | NEW |