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 <algorithm> | 10 #include <algorithm> |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 draw_blend_mode_(SkBlendMode::kSrcOver), | 73 draw_blend_mode_(SkBlendMode::kSrcOver), |
74 transform_tree_index_(TransformTree::kInvalidNodeId), | 74 transform_tree_index_(TransformTree::kInvalidNodeId), |
75 effect_tree_index_(EffectTree::kInvalidNodeId), | 75 effect_tree_index_(EffectTree::kInvalidNodeId), |
76 clip_tree_index_(ClipTree::kInvalidNodeId), | 76 clip_tree_index_(ClipTree::kInvalidNodeId), |
77 scroll_tree_index_(ScrollTree::kInvalidNodeId), | 77 scroll_tree_index_(ScrollTree::kInvalidNodeId), |
78 current_draw_mode_(DRAW_MODE_NONE), | 78 current_draw_mode_(DRAW_MODE_NONE), |
79 mutable_properties_(MutableProperty::kNone), | 79 mutable_properties_(MutableProperty::kNone), |
80 debug_info_(nullptr), | 80 debug_info_(nullptr), |
81 has_will_change_transform_hint_(false), | 81 has_will_change_transform_hint_(false), |
82 needs_push_properties_(false), | 82 needs_push_properties_(false), |
83 scrollbars_hidden_(false) { | 83 scrollbars_hidden_(false), |
| 84 needs_show_scrollbars_(false) { |
84 DCHECK_GT(layer_id_, 0); | 85 DCHECK_GT(layer_id_, 0); |
85 | 86 |
86 DCHECK(layer_tree_impl_); | 87 DCHECK(layer_tree_impl_); |
87 layer_tree_impl_->RegisterLayer(this); | 88 layer_tree_impl_->RegisterLayer(this); |
88 layer_tree_impl_->AddToElementMap(this); | 89 layer_tree_impl_->AddToElementMap(this); |
89 | 90 |
90 SetNeedsPushProperties(); | 91 SetNeedsPushProperties(); |
91 } | 92 } |
92 | 93 |
93 LayerImpl::~LayerImpl() { | 94 LayerImpl::~LayerImpl() { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 layer->background_color_ = background_color_; | 332 layer->background_color_ = background_color_; |
332 layer->safe_opaque_background_color_ = safe_opaque_background_color_; | 333 layer->safe_opaque_background_color_ = safe_opaque_background_color_; |
333 layer->draw_blend_mode_ = draw_blend_mode_; | 334 layer->draw_blend_mode_ = draw_blend_mode_; |
334 layer->position_ = position_; | 335 layer->position_ = position_; |
335 layer->transform_tree_index_ = transform_tree_index_; | 336 layer->transform_tree_index_ = transform_tree_index_; |
336 layer->effect_tree_index_ = effect_tree_index_; | 337 layer->effect_tree_index_ = effect_tree_index_; |
337 layer->clip_tree_index_ = clip_tree_index_; | 338 layer->clip_tree_index_ = clip_tree_index_; |
338 layer->scroll_tree_index_ = scroll_tree_index_; | 339 layer->scroll_tree_index_ = scroll_tree_index_; |
339 layer->has_will_change_transform_hint_ = has_will_change_transform_hint_; | 340 layer->has_will_change_transform_hint_ = has_will_change_transform_hint_; |
340 layer->scrollbars_hidden_ = scrollbars_hidden_; | 341 layer->scrollbars_hidden_ = scrollbars_hidden_; |
| 342 layer->needs_show_scrollbars_ = needs_show_scrollbars_; |
341 | 343 |
342 if (layer_property_changed_) { | 344 if (layer_property_changed_) { |
343 layer->layer_tree_impl()->set_needs_update_draw_properties(); | 345 layer->layer_tree_impl()->set_needs_update_draw_properties(); |
344 layer->layer_property_changed_ = true; | 346 layer->layer_property_changed_ = true; |
345 } | 347 } |
346 | 348 |
347 layer->SetBounds(bounds_); | 349 layer->SetBounds(bounds_); |
348 layer->SetScrollClipLayer(scroll_clip_layer_id_); | 350 layer->SetScrollClipLayer(scroll_clip_layer_id_); |
349 layer->SetElementId(element_id_); | 351 layer->SetElementId(element_id_); |
350 layer->SetMutableProperties(mutable_properties_); | 352 layer->SetMutableProperties(mutable_properties_); |
351 | 353 |
352 // If the main thread commits multiple times before the impl thread actually | 354 // 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 | 355 // draws, then damage tracking will become incorrect if we simply clobber the |
354 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. | 356 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. |
355 // union) any update changes that have occurred on the main thread. | 357 // union) any update changes that have occurred on the main thread. |
356 update_rect_.Union(layer->update_rect()); | 358 update_rect_.Union(layer->update_rect()); |
357 layer->SetUpdateRect(update_rect_); | 359 layer->SetUpdateRect(update_rect_); |
358 | 360 |
359 if (owned_debug_info_) | 361 if (owned_debug_info_) |
360 layer->SetDebugInfo(std::move(owned_debug_info_)); | 362 layer->SetDebugInfo(std::move(owned_debug_info_)); |
361 | 363 |
362 // Reset any state that should be cleared for the next update. | 364 // Reset any state that should be cleared for the next update. |
| 365 needs_show_scrollbars_ = false; |
363 layer_property_changed_ = false; | 366 layer_property_changed_ = false; |
364 needs_push_properties_ = false; | 367 needs_push_properties_ = false; |
365 update_rect_ = gfx::Rect(); | 368 update_rect_ = gfx::Rect(); |
366 layer_tree_impl()->RemoveLayerShouldPushProperties(this); | 369 layer_tree_impl()->RemoveLayerShouldPushProperties(this); |
367 } | 370 } |
368 | 371 |
369 bool LayerImpl::IsAffectedByPageScale() const { | 372 bool LayerImpl::IsAffectedByPageScale() const { |
370 TransformTree& transform_tree = GetTransformTree(); | 373 TransformTree& transform_tree = GetTransformTree(); |
371 return transform_tree.Node(transform_tree_index()) | 374 return transform_tree.Node(transform_tree_index()) |
372 ->in_subtree_of_page_scale_layer; | 375 ->in_subtree_of_page_scale_layer; |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 | 981 |
979 ScrollTree& LayerImpl::GetScrollTree() const { | 982 ScrollTree& LayerImpl::GetScrollTree() const { |
980 return GetPropertyTrees()->scroll_tree; | 983 return GetPropertyTrees()->scroll_tree; |
981 } | 984 } |
982 | 985 |
983 TransformTree& LayerImpl::GetTransformTree() const { | 986 TransformTree& LayerImpl::GetTransformTree() const { |
984 return GetPropertyTrees()->transform_tree; | 987 return GetPropertyTrees()->transform_tree; |
985 } | 988 } |
986 | 989 |
987 } // namespace cc | 990 } // namespace cc |
OLD | NEW |