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

Unified Diff: cc/layers/layer_impl_test_properties.cc

Issue 2035863003: cc: Add mask and replica layer ids to the effect tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 4 years, 6 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
« no previous file with comments | « cc/layers/layer_impl_test_properties.h ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_impl_test_properties.cc
diff --git a/cc/layers/layer_impl_test_properties.cc b/cc/layers/layer_impl_test_properties.cc
index d4b946a46e2f91a6230eeb006541d82f96205248..631272d7f95e87c86b44b5be126437ec98e93647 100644
--- a/cc/layers/layer_impl_test_properties.cc
+++ b/cc/layers/layer_impl_test_properties.cc
@@ -4,12 +4,15 @@
#include "cc/layers/layer_impl_test_properties.h"
+#include "cc/layers/layer_impl.h"
#include "cc/output/copy_output_request.h"
+#include "cc/trees/layer_tree_impl.h"
namespace cc {
-LayerImplTestProperties::LayerImplTestProperties()
- : double_sided(true),
+LayerImplTestProperties::LayerImplTestProperties(LayerImpl* owning_layer)
+ : owning_layer(owning_layer),
+ double_sided(true),
force_render_surface(false),
is_container_for_fixed_position_layers(false),
should_flatten_transform(true),
@@ -19,8 +22,31 @@ LayerImplTestProperties::LayerImplTestProperties()
num_unclipped_descendants(0),
opacity(1.f),
scroll_parent(nullptr),
- clip_parent(nullptr) {}
+ clip_parent(nullptr),
+ mask_layer(nullptr),
+ replica_layer(nullptr) {}
LayerImplTestProperties::~LayerImplTestProperties() {}
+void LayerImplTestProperties::SetMaskLayer(std::unique_ptr<LayerImpl> mask) {
+ if (mask_layer)
+ owning_layer->layer_tree_impl()->RemoveLayer(mask_layer->id());
+ mask_layer = mask.get();
+ if (mask)
+ owning_layer->layer_tree_impl()->AddLayer(std::move(mask));
+}
+
+void LayerImplTestProperties::SetReplicaLayer(
+ std::unique_ptr<LayerImpl> replica) {
+ if (replica_layer) {
+ replica_layer->test_properties()->SetMaskLayer(nullptr);
+ owning_layer->layer_tree_impl()->RemoveLayer(replica_layer->id());
+ }
+ replica_layer = replica.get();
+ if (replica) {
+ replica->SetParent(owning_layer);
+ owning_layer->layer_tree_impl()->AddLayer(std::move(replica));
+ }
+}
+
} // namespace cc
« no previous file with comments | « cc/layers/layer_impl_test_properties.h ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698