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

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 957703004: cc: Fix animated filter render surface check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "cc/animation/layer_animation_controller.h" 10 #include "cc/animation/layer_animation_controller.h"
(...skipping 8729 matching lines...) Expand 10 before | Expand all | Expand 10 after
8740 8740
8741 root->SetBoundsDelta(gfx::Vector2dF(0.0, 50.0)); 8741 root->SetBoundsDelta(gfx::Vector2dF(0.0, 50.0));
8742 8742
8743 LayerTreeHostCommon::CalculateDrawProperties(&inputs); 8743 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
8744 8744
8745 gfx::Rect affected_by_delta(0, 0, root_size.width(), 8745 gfx::Rect affected_by_delta(0, 0, root_size.width(),
8746 root_size.height() + 50); 8746 root_size.height() + 50);
8747 EXPECT_EQ(affected_by_delta, sublayer->visible_content_rect()); 8747 EXPECT_EQ(affected_by_delta, sublayer->visible_content_rect());
8748 } 8748 }
8749 8749
8750 // Verify that having an animated filter (but no current filter, as these
8751 // are mutually exclusive) correctly creates a render surface.
8752 TEST_F(LayerTreeHostCommonTest, AnimatedFilterCreatesRenderSurface) {
8753 scoped_refptr<Layer> root = Layer::Create();
8754 scoped_refptr<Layer> child = Layer::Create();
8755 scoped_refptr<Layer> grandchild = Layer::Create();
8756 root->AddChild(child);
8757 child->AddChild(grandchild);
8758
8759 gfx::Transform identity_transform;
8760 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(),
8761 gfx::PointF(), gfx::Size(50, 50), true, false);
8762 SetLayerPropertiesForTesting(child.get(), identity_transform, gfx::Point3F(),
8763 gfx::PointF(), gfx::Size(50, 50), true, false);
8764 SetLayerPropertiesForTesting(grandchild.get(), identity_transform,
8765 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50),
8766 true, false);
8767 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
8768 host->SetRootLayer(root);
8769
8770 AddAnimatedFilterToLayer(child.get(), 10.0, 0.1f, 0.2f);
8771
8772 ExecuteCalculateDrawProperties(root.get());
8773
8774 EXPECT_TRUE(root->render_surface());
8775 EXPECT_TRUE(child->render_surface());
8776 EXPECT_FALSE(grandchild->render_surface());
8777
8778 EXPECT_TRUE(root->filters().IsEmpty());
8779 EXPECT_TRUE(child->filters().IsEmpty());
8780 EXPECT_TRUE(grandchild->filters().IsEmpty());
8781
8782 EXPECT_FALSE(root->FilterIsAnimating());
8783 EXPECT_TRUE(child->FilterIsAnimating());
8784 EXPECT_FALSE(grandchild->FilterIsAnimating());
8785 }
8786
8750 } // namespace 8787 } // namespace
8751 } // namespace cc 8788 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_common.cc ('K') | « cc/trees/layer_tree_host_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698