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/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "cc/animation/animation_registrar.h" | 9 #include "cc/animation/animation_registrar.h" |
10 #include "cc/animation/scrollbar_animation_controller.h" | 10 #include "cc/animation/scrollbar_animation_controller.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 should_scroll_on_main_thread_(false), | 43 should_scroll_on_main_thread_(false), |
44 have_wheel_event_handlers_(false), | 44 have_wheel_event_handlers_(false), |
45 background_color_(0), | 45 background_color_(0), |
46 stacking_order_changed_(false), | 46 stacking_order_changed_(false), |
47 double_sided_(true), | 47 double_sided_(true), |
48 layer_property_changed_(false), | 48 layer_property_changed_(false), |
49 layer_surface_property_changed_(false), | 49 layer_surface_property_changed_(false), |
50 masks_to_bounds_(false), | 50 masks_to_bounds_(false), |
51 contents_opaque_(false), | 51 contents_opaque_(false), |
52 opacity_(1.0), | 52 opacity_(1.0), |
| 53 blend_mode_(SkXfermode::kSrcOver_Mode), |
| 54 is_root_for_isolated_group_(false), |
53 preserves_3d_(false), | 55 preserves_3d_(false), |
54 use_parent_backface_visibility_(false), | 56 use_parent_backface_visibility_(false), |
55 draw_checkerboard_for_missing_tiles_(false), | 57 draw_checkerboard_for_missing_tiles_(false), |
56 draws_content_(false), | 58 draws_content_(false), |
57 hide_layer_and_subtree_(false), | 59 hide_layer_and_subtree_(false), |
58 force_render_surface_(false), | 60 force_render_surface_(false), |
59 is_container_for_fixed_position_layers_(false), | 61 is_container_for_fixed_position_layers_(false), |
60 draw_depth_(0.f), | 62 draw_depth_(0.f), |
61 compositing_reasons_(kCompositingReasonUnknown), | 63 compositing_reasons_(kCompositingReasonUnknown), |
62 current_draw_mode_(DRAW_MODE_NONE), | 64 current_draw_mode_(DRAW_MODE_NONE), |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 layer->SetFilters(filters()); | 504 layer->SetFilters(filters()); |
503 layer->SetFilter(filter()); | 505 layer->SetFilter(filter()); |
504 layer->SetBackgroundFilters(background_filters()); | 506 layer->SetBackgroundFilters(background_filters()); |
505 layer->SetMasksToBounds(masks_to_bounds_); | 507 layer->SetMasksToBounds(masks_to_bounds_); |
506 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); | 508 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); |
507 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); | 509 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); |
508 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); | 510 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); |
509 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); | 511 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); |
510 layer->SetContentsOpaque(contents_opaque_); | 512 layer->SetContentsOpaque(contents_opaque_); |
511 layer->SetOpacity(opacity_); | 513 layer->SetOpacity(opacity_); |
| 514 layer->SetBlendMode(blend_mode_); |
| 515 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_); |
512 layer->SetPosition(position_); | 516 layer->SetPosition(position_); |
513 layer->SetIsContainerForFixedPositionLayers( | 517 layer->SetIsContainerForFixedPositionLayers( |
514 is_container_for_fixed_position_layers_); | 518 is_container_for_fixed_position_layers_); |
515 layer->SetFixedContainerSizeDelta(fixed_container_size_delta_); | 519 layer->SetFixedContainerSizeDelta(fixed_container_size_delta_); |
516 layer->SetPositionConstraint(position_constraint_); | 520 layer->SetPositionConstraint(position_constraint_); |
517 layer->SetPreserves3d(preserves_3d()); | 521 layer->SetPreserves3d(preserves_3d()); |
518 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); | 522 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); |
519 layer->SetSublayerTransform(sublayer_transform_); | 523 layer->SetSublayerTransform(sublayer_transform_); |
520 layer->SetTransform(transform_); | 524 layer->SetTransform(transform_); |
521 | 525 |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 bool LayerImpl::OpacityIsAnimating() const { | 872 bool LayerImpl::OpacityIsAnimating() const { |
869 return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity); | 873 return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity); |
870 } | 874 } |
871 | 875 |
872 bool LayerImpl::OpacityIsAnimatingOnImplOnly() const { | 876 bool LayerImpl::OpacityIsAnimatingOnImplOnly() const { |
873 Animation* opacity_animation = | 877 Animation* opacity_animation = |
874 layer_animation_controller_->GetAnimation(Animation::Opacity); | 878 layer_animation_controller_->GetAnimation(Animation::Opacity); |
875 return opacity_animation && opacity_animation->is_impl_only(); | 879 return opacity_animation && opacity_animation->is_impl_only(); |
876 } | 880 } |
877 | 881 |
| 882 void LayerImpl::SetBlendMode(SkXfermode::Mode blendMode) { |
| 883 if (blend_mode_ == blendMode) |
| 884 return; |
| 885 |
| 886 blend_mode_ = blendMode; |
| 887 NoteLayerSurfacePropertyChanged(); |
| 888 } |
| 889 |
| 890 void LayerImpl::SetIsRootForIsolatedGroup(bool root) { |
| 891 if (is_root_for_isolated_group_ == root) |
| 892 return; |
| 893 |
| 894 is_root_for_isolated_group_ = root; |
| 895 NoteLayerSurfacePropertyChanged(); |
| 896 } |
| 897 |
878 void LayerImpl::SetPosition(gfx::PointF position) { | 898 void LayerImpl::SetPosition(gfx::PointF position) { |
879 if (position_ == position) | 899 if (position_ == position) |
880 return; | 900 return; |
881 | 901 |
882 position_ = position; | 902 position_ = position; |
883 NoteLayerPropertyChangedForSubtree(); | 903 NoteLayerPropertyChangedForSubtree(); |
884 } | 904 } |
885 | 905 |
886 void LayerImpl::SetPreserves3d(bool preserves3_d) { | 906 void LayerImpl::SetPreserves3d(bool preserves3_d) { |
887 if (preserves_3d_ == preserves3_d) | 907 if (preserves_3d_ == preserves3_d) |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 | 1279 |
1260 if (reasons & kCompositingReasonLayerForMask) | 1280 if (reasons & kCompositingReasonLayerForMask) |
1261 reason_list->AppendString("Is a mask layer"); | 1281 reason_list->AppendString("Is a mask layer"); |
1262 | 1282 |
1263 if (reasons & kCompositingReasonOverflowScrollingParent) | 1283 if (reasons & kCompositingReasonOverflowScrollingParent) |
1264 reason_list->AppendString("Scroll parent is not an ancestor"); | 1284 reason_list->AppendString("Scroll parent is not an ancestor"); |
1265 | 1285 |
1266 if (reasons & kCompositingReasonOutOfFlowClipping) | 1286 if (reasons & kCompositingReasonOutOfFlowClipping) |
1267 reason_list->AppendString("Has clipping ancestor"); | 1287 reason_list->AppendString("Has clipping ancestor"); |
1268 | 1288 |
| 1289 if (reasons & kCompositingReasonIsolateCompositedDescendants) |
| 1290 reason_list->AppendString("Should isolate composited dscendants"); |
| 1291 |
1269 return reason_list.PassAs<base::Value>(); | 1292 return reason_list.PassAs<base::Value>(); |
1270 } | 1293 } |
1271 | 1294 |
1272 void LayerImpl::AsValueInto(base::DictionaryValue* state) const { | 1295 void LayerImpl::AsValueInto(base::DictionaryValue* state) const { |
1273 TracedValue::MakeDictIntoImplicitSnapshot(state, LayerTypeAsString(), this); | 1296 TracedValue::MakeDictIntoImplicitSnapshot(state, LayerTypeAsString(), this); |
1274 state->SetInteger("layer_id", id()); | 1297 state->SetInteger("layer_id", id()); |
1275 state->SetString("layer_name", debug_name()); | 1298 state->SetString("layer_name", debug_name()); |
1276 state->Set("bounds", MathUtil::AsValue(bounds()).release()); | 1299 state->Set("bounds", MathUtil::AsValue(bounds()).release()); |
1277 state->SetInteger("draws_content", DrawsContent()); | 1300 state->SetInteger("draws_content", DrawsContent()); |
1278 state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); | 1301 state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 | 1342 |
1320 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } | 1343 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
1321 | 1344 |
1322 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1345 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
1323 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1346 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1324 AsValueInto(state.get()); | 1347 AsValueInto(state.get()); |
1325 return state.PassAs<base::Value>(); | 1348 return state.PassAs<base::Value>(); |
1326 } | 1349 } |
1327 | 1350 |
1328 } // namespace cc | 1351 } // namespace cc |
OLD | NEW |