Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: cc/layers/layer_impl.cc

Issue 1626513003: Add ScrollTree builder and unit test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 10 #include <utility>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 is_affected_by_page_scale_(true), 81 is_affected_by_page_scale_(true),
82 was_ever_ready_since_last_transform_animation_(true), 82 was_ever_ready_since_last_transform_animation_(true),
83 background_color_(0), 83 background_color_(0),
84 opacity_(1.0), 84 opacity_(1.0),
85 blend_mode_(SkXfermode::kSrcOver_Mode), 85 blend_mode_(SkXfermode::kSrcOver_Mode),
86 draw_blend_mode_(SkXfermode::kSrcOver_Mode), 86 draw_blend_mode_(SkXfermode::kSrcOver_Mode),
87 num_descendants_that_draw_content_(0), 87 num_descendants_that_draw_content_(0),
88 transform_tree_index_(-1), 88 transform_tree_index_(-1),
89 effect_tree_index_(-1), 89 effect_tree_index_(-1),
90 clip_tree_index_(-1), 90 clip_tree_index_(-1),
91 scroll_tree_index_(-1),
91 draw_depth_(0.f), 92 draw_depth_(0.f),
92 needs_push_properties_(false), 93 needs_push_properties_(false),
93 num_dependents_need_push_properties_(0), 94 num_dependents_need_push_properties_(0),
94 sorting_context_id_(0), 95 sorting_context_id_(0),
95 current_draw_mode_(DRAW_MODE_NONE), 96 current_draw_mode_(DRAW_MODE_NONE),
96 element_id_(0), 97 element_id_(0),
97 mutable_properties_(kMutablePropertyNone), 98 mutable_properties_(kMutablePropertyNone),
98 force_render_surface_(false), 99 force_render_surface_(false),
99 frame_timing_requests_dirty_(false), 100 frame_timing_requests_dirty_(false),
100 visited_(false), 101 visited_(false),
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 void LayerImpl::SetClipTreeIndex(int index) { 272 void LayerImpl::SetClipTreeIndex(int index) {
272 clip_tree_index_ = index; 273 clip_tree_index_ = index;
273 SetNeedsPushProperties(); 274 SetNeedsPushProperties();
274 } 275 }
275 276
276 void LayerImpl::SetEffectTreeIndex(int index) { 277 void LayerImpl::SetEffectTreeIndex(int index) {
277 effect_tree_index_ = index; 278 effect_tree_index_ = index;
278 SetNeedsPushProperties(); 279 SetNeedsPushProperties();
279 } 280 }
280 281
282 void LayerImpl::SetScrollTreeIndex(int index) {
283 scroll_tree_index_ = index;
284 SetNeedsPushProperties();
285 }
286
281 void LayerImpl::PassCopyRequests( 287 void LayerImpl::PassCopyRequests(
282 std::vector<scoped_ptr<CopyOutputRequest>>* requests) { 288 std::vector<scoped_ptr<CopyOutputRequest>>* requests) {
283 // In the case that a layer still has a copy request, this means that there's 289 // In the case that a layer still has a copy request, this means that there's
284 // a commit to the active tree without a draw. This only happens in some 290 // a commit to the active tree without a draw. This only happens in some
285 // edge cases during lost context or visibility changes, so don't try to 291 // edge cases during lost context or visibility changes, so don't try to
286 // handle preserving these output requests (and their surface). 292 // handle preserving these output requests (and their surface).
287 if (!copy_requests_.empty()) { 293 if (!copy_requests_.empty()) {
288 layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this); 294 layer_tree_impl()->RemoveLayerWithCopyOutputRequest(this);
289 // Destroying these will abort them. 295 // Destroying these will abort them.
290 copy_requests_.clear(); 296 copy_requests_.clear();
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 layer->SetScrollCompensationAdjustment(scroll_compensation_adjustment_); 657 layer->SetScrollCompensationAdjustment(scroll_compensation_adjustment_);
652 658
653 layer->PushScrollOffset(nullptr); 659 layer->PushScrollOffset(nullptr);
654 660
655 layer->Set3dSortingContextId(sorting_context_id_); 661 layer->Set3dSortingContextId(sorting_context_id_);
656 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); 662 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_);
657 663
658 layer->SetTransformTreeIndex(transform_tree_index_); 664 layer->SetTransformTreeIndex(transform_tree_index_);
659 layer->SetClipTreeIndex(clip_tree_index_); 665 layer->SetClipTreeIndex(clip_tree_index_);
660 layer->SetEffectTreeIndex(effect_tree_index_); 666 layer->SetEffectTreeIndex(effect_tree_index_);
667 layer->SetScrollTreeIndex(scroll_tree_index_);
661 layer->set_offset_to_transform_parent(offset_to_transform_parent_); 668 layer->set_offset_to_transform_parent(offset_to_transform_parent_);
662 layer->set_is_hidden_from_property_trees(is_hidden_from_property_trees_); 669 layer->set_is_hidden_from_property_trees(is_hidden_from_property_trees_);
663 670
664 LayerImpl* scroll_parent = nullptr; 671 LayerImpl* scroll_parent = nullptr;
665 if (scroll_parent_) { 672 if (scroll_parent_) {
666 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); 673 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id());
667 DCHECK(scroll_parent); 674 DCHECK(scroll_parent);
668 } 675 }
669 676
670 layer->SetScrollParent(scroll_parent); 677 layer->SetScrollParent(scroll_parent);
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 .layer_transforms_should_scale_layer_contents) { 1950 .layer_transforms_should_scale_layer_contents) {
1944 return default_scale; 1951 return default_scale;
1945 } 1952 }
1946 1953
1947 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1954 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1948 DrawTransform(), default_scale); 1955 DrawTransform(), default_scale);
1949 return std::max(transform_scales.x(), transform_scales.y()); 1956 return std::max(transform_scales.x(), transform_scales.y());
1950 } 1957 }
1951 1958
1952 } // namespace cc 1959 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698