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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 double_sided_(true), | 44 double_sided_(true), |
45 layer_property_changed_(false), | 45 layer_property_changed_(false), |
46 layer_surface_property_changed_(false), | 46 layer_surface_property_changed_(false), |
47 masks_to_bounds_(false), | 47 masks_to_bounds_(false), |
48 contents_opaque_(false), | 48 contents_opaque_(false), |
49 opacity_(1.0), | 49 opacity_(1.0), |
50 preserves_3d_(false), | 50 preserves_3d_(false), |
51 use_parent_backface_visibility_(false), | 51 use_parent_backface_visibility_(false), |
52 draw_checkerboard_for_missing_tiles_(false), | 52 draw_checkerboard_for_missing_tiles_(false), |
53 draws_content_(false), | 53 draws_content_(false), |
| 54 hide_layer_and_subtree_(false), |
54 force_render_surface_(false), | 55 force_render_surface_(false), |
55 is_container_for_fixed_position_layers_(false), | 56 is_container_for_fixed_position_layers_(false), |
56 draw_depth_(0.f), | 57 draw_depth_(0.f), |
57 compositing_reasons_(kCompositingReasonUnknown), | 58 compositing_reasons_(kCompositingReasonUnknown), |
58 current_draw_mode_(DRAW_MODE_NONE), | 59 current_draw_mode_(DRAW_MODE_NONE), |
59 horizontal_scrollbar_layer_(NULL), | 60 horizontal_scrollbar_layer_(NULL), |
60 vertical_scrollbar_layer_(NULL) { | 61 vertical_scrollbar_layer_(NULL) { |
61 DCHECK_GT(layer_id_, 0); | 62 DCHECK_GT(layer_id_, 0); |
62 DCHECK(layer_tree_impl_); | 63 DCHECK(layer_tree_impl_); |
63 layer_tree_impl_->RegisterLayer(this); | 64 layer_tree_impl_->RegisterLayer(this); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 layer->SetBounds(bounds_); | 348 layer->SetBounds(bounds_); |
348 layer->SetContentBounds(content_bounds()); | 349 layer->SetContentBounds(content_bounds()); |
349 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); | 350 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); |
350 layer->SetDebugName(debug_name_); | 351 layer->SetDebugName(debug_name_); |
351 layer->SetCompositingReasons(compositing_reasons_); | 352 layer->SetCompositingReasons(compositing_reasons_); |
352 layer->SetDoubleSided(double_sided_); | 353 layer->SetDoubleSided(double_sided_); |
353 layer->SetDrawCheckerboardForMissingTiles( | 354 layer->SetDrawCheckerboardForMissingTiles( |
354 draw_checkerboard_for_missing_tiles_); | 355 draw_checkerboard_for_missing_tiles_); |
355 layer->SetForceRenderSurface(force_render_surface_); | 356 layer->SetForceRenderSurface(force_render_surface_); |
356 layer->SetDrawsContent(DrawsContent()); | 357 layer->SetDrawsContent(DrawsContent()); |
| 358 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
357 layer->SetFilters(filters()); | 359 layer->SetFilters(filters()); |
358 layer->SetFilter(filter()); | 360 layer->SetFilter(filter()); |
359 layer->SetBackgroundFilters(background_filters()); | 361 layer->SetBackgroundFilters(background_filters()); |
360 layer->SetMasksToBounds(masks_to_bounds_); | 362 layer->SetMasksToBounds(masks_to_bounds_); |
361 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); | 363 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); |
362 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); | 364 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); |
363 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); | 365 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); |
364 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); | 366 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); |
365 layer->SetContentsOpaque(contents_opaque_); | 367 layer->SetContentsOpaque(contents_opaque_); |
366 layer->SetOpacity(opacity_); | 368 layer->SetOpacity(opacity_); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 } | 664 } |
663 | 665 |
664 void LayerImpl::SetDrawsContent(bool draws_content) { | 666 void LayerImpl::SetDrawsContent(bool draws_content) { |
665 if (draws_content_ == draws_content) | 667 if (draws_content_ == draws_content) |
666 return; | 668 return; |
667 | 669 |
668 draws_content_ = draws_content; | 670 draws_content_ = draws_content; |
669 NoteLayerPropertyChanged(); | 671 NoteLayerPropertyChanged(); |
670 } | 672 } |
671 | 673 |
| 674 void LayerImpl::SetHideLayerAndSubtree(bool hide) { |
| 675 if (hide_layer_and_subtree_ == hide) |
| 676 return; |
| 677 |
| 678 hide_layer_and_subtree_ = hide; |
| 679 NoteLayerPropertyChangedForSubtree(); |
| 680 } |
| 681 |
672 void LayerImpl::SetAnchorPoint(gfx::PointF anchor_point) { | 682 void LayerImpl::SetAnchorPoint(gfx::PointF anchor_point) { |
673 if (anchor_point_ == anchor_point) | 683 if (anchor_point_ == anchor_point) |
674 return; | 684 return; |
675 | 685 |
676 anchor_point_ = anchor_point; | 686 anchor_point_ = anchor_point; |
677 NoteLayerPropertyChangedForSubtree(); | 687 NoteLayerPropertyChangedForSubtree(); |
678 } | 688 } |
679 | 689 |
680 void LayerImpl::SetAnchorPointZ(float anchor_point_z) { | 690 void LayerImpl::SetAnchorPointZ(float anchor_point_z) { |
681 if (anchor_point_z_ == anchor_point_z) | 691 if (anchor_point_z_ == anchor_point_z) |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 | 1178 |
1169 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } | 1179 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
1170 | 1180 |
1171 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1181 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
1172 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1182 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1173 AsValueInto(state.get()); | 1183 AsValueInto(state.get()); |
1174 return state.PassAs<base::Value>(); | 1184 return state.PassAs<base::Value>(); |
1175 } | 1185 } |
1176 | 1186 |
1177 } // namespace cc | 1187 } // namespace cc |
OLD | NEW |