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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 layer->SetBounds(bounds_); | 362 layer->SetBounds(bounds_); |
362 layer->SetContentBounds(content_bounds()); | 363 layer->SetContentBounds(content_bounds()); |
363 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); | 364 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); |
364 layer->SetDebugName(debug_name_); | 365 layer->SetDebugName(debug_name_); |
365 layer->SetCompositingReasons(compositing_reasons_); | 366 layer->SetCompositingReasons(compositing_reasons_); |
366 layer->SetDoubleSided(double_sided_); | 367 layer->SetDoubleSided(double_sided_); |
367 layer->SetDrawCheckerboardForMissingTiles( | 368 layer->SetDrawCheckerboardForMissingTiles( |
368 draw_checkerboard_for_missing_tiles_); | 369 draw_checkerboard_for_missing_tiles_); |
369 layer->SetForceRenderSurface(force_render_surface_); | 370 layer->SetForceRenderSurface(force_render_surface_); |
370 layer->SetDrawsContent(DrawsContent()); | 371 layer->SetDrawsContent(DrawsContent()); |
| 372 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
371 layer->SetFilters(filters()); | 373 layer->SetFilters(filters()); |
372 layer->SetFilter(filter()); | 374 layer->SetFilter(filter()); |
373 layer->SetBackgroundFilters(background_filters()); | 375 layer->SetBackgroundFilters(background_filters()); |
374 layer->SetMasksToBounds(masks_to_bounds_); | 376 layer->SetMasksToBounds(masks_to_bounds_); |
375 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); | 377 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); |
376 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); | 378 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); |
377 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); | 379 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); |
378 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); | 380 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); |
379 layer->SetContentsOpaque(contents_opaque_); | 381 layer->SetContentsOpaque(contents_opaque_); |
380 layer->SetOpacity(opacity_); | 382 layer->SetOpacity(opacity_); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 } | 599 } |
598 | 600 |
599 void LayerImpl::SetDrawsContent(bool draws_content) { | 601 void LayerImpl::SetDrawsContent(bool draws_content) { |
600 if (draws_content_ == draws_content) | 602 if (draws_content_ == draws_content) |
601 return; | 603 return; |
602 | 604 |
603 draws_content_ = draws_content; | 605 draws_content_ = draws_content; |
604 NoteLayerPropertyChanged(); | 606 NoteLayerPropertyChanged(); |
605 } | 607 } |
606 | 608 |
| 609 void LayerImpl::SetHideLayerAndSubtree(bool hide) { |
| 610 if (hide_layer_and_subtree_ == hide) |
| 611 return; |
| 612 |
| 613 hide_layer_and_subtree_ = hide; |
| 614 NoteLayerPropertyChangedForSubtree(); |
| 615 } |
| 616 |
607 void LayerImpl::SetAnchorPoint(gfx::PointF anchor_point) { | 617 void LayerImpl::SetAnchorPoint(gfx::PointF anchor_point) { |
608 if (anchor_point_ == anchor_point) | 618 if (anchor_point_ == anchor_point) |
609 return; | 619 return; |
610 | 620 |
611 anchor_point_ = anchor_point; | 621 anchor_point_ = anchor_point; |
612 NoteLayerPropertyChangedForSubtree(); | 622 NoteLayerPropertyChangedForSubtree(); |
613 } | 623 } |
614 | 624 |
615 void LayerImpl::SetAnchorPointZ(float anchor_point_z) { | 625 void LayerImpl::SetAnchorPointZ(float anchor_point_z) { |
616 if (anchor_point_z_ == anchor_point_z) | 626 if (anchor_point_z_ == anchor_point_z) |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 | 1113 |
1104 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } | 1114 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } |
1105 | 1115 |
1106 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1116 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
1107 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1117 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1108 AsValueInto(state.get()); | 1118 AsValueInto(state.get()); |
1109 return state.PassAs<base::Value>(); | 1119 return state.PassAs<base::Value>(); |
1110 } | 1120 } |
1111 | 1121 |
1112 } // namespace cc | 1122 } // namespace cc |
OLD | NEW |