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

Unified Diff: cc/layers/layer.cc

Issue 1626513003: Add ScrollTree builder and unit test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename other_criteria, remove is_root in GetScrollParent and fixed a previous mistake in unit test. 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 side-by-side diff with in-line comments
Download patch
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 68e153f982b8a1d8e9c5efa910c630a23d201994..27d54a05854f3b9b8a48197fe2f3846da05d5721 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -64,6 +64,7 @@ Layer::Layer(const LayerSettings& settings)
transform_tree_index_(-1),
effect_tree_index_(-1),
clip_tree_index_(-1),
+ scroll_tree_index_(-1),
property_tree_sequence_number_(-1),
element_id_(0),
mutable_properties_(kMutablePropertyNone),
@@ -1085,6 +1086,23 @@ int Layer::effect_tree_index() const {
return effect_tree_index_;
}
+void Layer::SetScrollTreeIndex(int index) {
+ DCHECK(IsPropertyChangeAllowed());
+ if (scroll_tree_index_ == index)
+ return;
+ scroll_tree_index_ = index;
+ SetNeedsPushProperties();
+}
+
+int Layer::scroll_tree_index() const {
+ if (!layer_tree_host_ ||
+ layer_tree_host_->property_trees()->sequence_number !=
+ property_tree_sequence_number_) {
+ return -1;
+ }
+ return scroll_tree_index_;
+}
+
void Layer::InvalidatePropertyTreesIndices() {
int invalid_property_tree_index = -1;
SetTransformTreeIndex(invalid_property_tree_index);
@@ -1198,6 +1216,7 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
layer->SetTransformTreeIndex(transform_tree_index());
layer->SetEffectTreeIndex(effect_tree_index());
layer->SetClipTreeIndex(clip_tree_index());
+ layer->SetScrollTreeIndex(scroll_tree_index());
layer->set_offset_to_transform_parent(offset_to_transform_parent_);
layer->SetDoubleSided(double_sided_);
layer->SetDrawsContent(DrawsContent());
@@ -1469,6 +1488,7 @@ void Layer::LayerSpecificPropertiesToProto(proto::LayerProperties* proto) {
base->set_transform_free_index(transform_tree_index_);
base->set_effect_tree_index(effect_tree_index_);
base->set_clip_tree_index(clip_tree_index_);
+ base->set_scroll_tree_index(scroll_tree_index_);
Vector2dFToProto(offset_to_transform_parent_,
base->mutable_offset_to_transform_parent());
base->set_double_sided(double_sided_);
@@ -1559,6 +1579,7 @@ void Layer::FromLayerSpecificPropertiesProto(
transform_tree_index_ = base.transform_free_index();
effect_tree_index_ = base.effect_tree_index();
clip_tree_index_ = base.clip_tree_index();
+ scroll_tree_index_ = base.scroll_tree_index();
offset_to_transform_parent_ =
ProtoToVector2dF(base.offset_to_transform_parent());
double_sided_ = base.double_sided();

Powered by Google App Engine
This is Rietveld 408576698