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

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

Issue 1832663002: cc : Determine if a layer is root by using the value in LayerTreeImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 <algorithm> 10 #include <algorithm>
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 145
146 void LayerImpl::ClearChildList() { 146 void LayerImpl::ClearChildList() {
147 if (children_.empty()) 147 if (children_.empty())
148 return; 148 return;
149 for (auto* child : children_) 149 for (auto* child : children_)
150 layer_tree_impl_->RemoveLayer(child->id()); 150 layer_tree_impl_->RemoveLayer(child->id());
151 children_.clear(); 151 children_.clear();
152 } 152 }
153 153
154 bool LayerImpl::HasAncestor(const LayerImpl* ancestor) const {
155 if (!ancestor)
156 return false;
157
158 for (const LayerImpl* layer = this; layer; layer = layer->parent()) {
159 if (layer == ancestor)
160 return true;
161 }
162
163 return false;
164 }
165
166 void LayerImpl::SetScrollParent(LayerImpl* parent) { 154 void LayerImpl::SetScrollParent(LayerImpl* parent) {
167 if (scroll_parent_ == parent) 155 if (scroll_parent_ == parent)
168 return; 156 return;
169 157
170 if (parent) 158 if (parent)
171 DCHECK_EQ(layer_tree_impl()->LayerById(parent->id()), parent); 159 DCHECK_EQ(layer_tree_impl()->LayerById(parent->id()), parent);
172 160
173 scroll_parent_ = parent; 161 scroll_parent_ = parent;
174 SetNeedsPushProperties(); 162 SetNeedsPushProperties();
175 } 163 }
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 .layer_transforms_should_scale_layer_contents) { 1584 .layer_transforms_should_scale_layer_contents) {
1597 return default_scale; 1585 return default_scale;
1598 } 1586 }
1599 1587
1600 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1588 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1601 DrawTransform(), default_scale); 1589 DrawTransform(), default_scale);
1602 return std::max(transform_scales.x(), transform_scales.y()); 1590 return std::max(transform_scales.x(), transform_scales.y());
1603 } 1591 }
1604 1592
1605 } // namespace cc 1593 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698