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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2874083002: Apply filter mutation to effect tree directly for SPv2. (Closed)
Patch Set: Sync to head. Created 3 years, 7 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/trees/layer_tree_host.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 46f45d591f636bd2b6e60df26e23b4485c0cfe70..a08d6584c20d7a384b83f0613efcfe1ec032470c 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -1180,6 +1180,95 @@ class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest {
SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync);
+class LayerTreeHostTestAnimationFilterMutatedNotUsingLayerLists
+ : public LayerTreeHostTest {
+ public:
+ void InitializeSettings(LayerTreeSettings* settings) override {
+ settings->use_layer_lists = false;
+ }
+
+ protected:
+ void SetupTree() override {
+ root_ = Layer::Create();
+ layer_tree_host()->SetRootLayer(root_);
+ LayerTreeHostTest::SetupTree();
+ }
+
+ void BeginTest() override {
+ FilterOperations filters;
+ EXPECT_EQ(FilterOperations(), root_->filters());
+ filters.Append(FilterOperation::CreateOpacityFilter(0.5f));
+ layer_tree_host()->SetElementFilterMutated(
+ root_->element_id(), ElementListType::ACTIVE, filters);
+ // When not using layer lists, filters are just stored directly on the
+ // layer.
+ EXPECT_EQ(filters, root_->filters());
+ EndTest();
+ }
+
+ void AfterTest() override {}
+
+ private:
+ scoped_refptr<Layer> root_;
+};
+
+SINGLE_THREAD_TEST_F(LayerTreeHostTestAnimationFilterMutatedNotUsingLayerLists);
+
+class LayerTreeHostTestAnimationFilterMutatedUsingLayerLists
+ : public LayerTreeHostTest {
+ public:
+ void InitializeSettings(LayerTreeSettings* settings) override {
+ settings->use_layer_lists = true;
+ }
+
+ protected:
+ void SetupTree() override {
+ root_ = Layer::Create();
+ layer_tree_host()->SetRootLayer(root_);
+ LayerTreeHostTest::SetupTree();
+ }
+
+ void BeginTest() override {
+ // Insert a dummy effect node to observe its mutation. This would
+ // normally have been created by PaintArtifactCompositor.
+ int effect_node_id =
+ layer_tree_host()->property_trees()->effect_tree.Insert(
+ EffectNode(), EffectTree::kInvalidNodeId);
+ layer_tree_host()
+ ->property_trees()
+ ->element_id_to_effect_node_index[root_->element_id()] = effect_node_id;
+
+ EXPECT_EQ(FilterOperations(), root_->filters());
+ EXPECT_EQ(FilterOperations(),
+ layer_tree_host()
+ ->property_trees()
+ ->effect_tree.FindNodeFromElementId(root_->element_id())
+ ->filters);
+
+ FilterOperations filters;
+ filters.Append(FilterOperation::CreateOpacityFilter(0.5f));
+ layer_tree_host()->SetElementFilterMutated(
+ root_->element_id(), ElementListType::ACTIVE, filters);
+
+ // When using layer lists, we don't have to store the filters on the layer.
+ EXPECT_EQ(FilterOperations(), root_->filters());
+ // The filter should have been set directly on the effect node instead.
+ EXPECT_EQ(filters,
+ layer_tree_host()
+ ->property_trees()
+ ->effect_tree.FindNodeFromElementId(root_->element_id())
+ ->filters);
+ EndTest();
+ }
+
+ void AfterTest() override {}
+
+ private:
+ scoped_refptr<Layer> root_;
+};
+
+SINGLE_THREAD_TEST_F(LayerTreeHostTestAnimationFilterMutatedUsingLayerLists);
+
class LayerTreeHostTestEffectTreeSync : public LayerTreeHostTest {
protected:
void SetupTree() override {
@@ -1377,7 +1466,7 @@ class LayerTreeHostTestTransformTreeDamageIsUpdated : public LayerTreeHostTest {
root_->SetBounds(gfx::Size(50, 50));
- // Make sure child is registerd for animation.
+ // Make sure child is registered for animation.
child_->SetElementId(ElementId(2));
// Make sure child and grand_child have transform nodes.
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698