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

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

Issue 1252313004: Add ClipNode when Render Surface Inherits Clip (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a unit test Created 5 years, 4 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 8222 matching lines...) Expand 10 before | Expand all | Expand 10 after
8233 LayerTreeHostCommon::PreCalculateMetaInformationForTesting(root.get()); 8233 LayerTreeHostCommon::PreCalculateMetaInformationForTesting(root.get());
8234 8234
8235 EXPECT_FALSE(root->layer_or_descendant_is_drawn()); 8235 EXPECT_FALSE(root->layer_or_descendant_is_drawn());
8236 EXPECT_FALSE(root->visited()); 8236 EXPECT_FALSE(root->visited());
8237 EXPECT_FALSE(root->sorted_for_recursion()); 8237 EXPECT_FALSE(root->sorted_for_recursion());
8238 EXPECT_FALSE(child->layer_or_descendant_is_drawn()); 8238 EXPECT_FALSE(child->layer_or_descendant_is_drawn());
8239 EXPECT_FALSE(child->visited()); 8239 EXPECT_FALSE(child->visited());
8240 EXPECT_FALSE(child->sorted_for_recursion()); 8240 EXPECT_FALSE(child->sorted_for_recursion());
8241 } 8241 }
8242 8242
8243 TEST_F(LayerTreeHostCommonTest, RenderSurfaceClipsSubtree) {
jaydasika 2015/07/30 19:44:46 This unit test will crash without this patch.
8244 // Ensure that a Clip Node is added when a render surface applies clip.
8245 LayerImpl* root = root_layer();
8246 LayerImpl* significant_transform = AddChildToRoot<LayerImpl>();
8247 LayerImpl* layer_clips_subtree = AddChild<LayerImpl>(significant_transform);
8248 LayerImpl* render_surface = AddChild<LayerImpl>(layer_clips_subtree);
8249 LayerImpl* test_layer = AddChild<LayerImpl>(render_surface);
8250
8251 const gfx::Transform identity_matrix;
8252 gfx::Transform transform1(0.35, 0.0, -0.9, 0.0, 0.87, 0.35, 0.33, 0.0, 0.32,
8253 -0.93, 0.12, 0.0, 0.0, 0.0, -0.0025, 1);
8254 gfx::Transform transform2(-1.14, -0.09, +0.32, +7.98, -0.38, -0.19, -0.9366,
8255 +0.04, +0.15, -1.19, +0.12, +17.4304, 0, 0, 0, 1);
ajuma 2015/07/30 20:56:50 I assume these numbers come from an actual page wh
jaydasika 2015/07/31 00:46:29 I am still working on it. transform2 has to be suc
8256
8257 layer_clips_subtree->SetMasksToBounds(true);
8258 test_layer->SetDrawsContent(true);
8259
8260 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
8261 gfx::PointF(), gfx::Size(30, 30), true, false,
8262 true);
8263 SetLayerPropertiesForTesting(significant_transform, transform1,
8264 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
8265 true, false, false);
8266 SetLayerPropertiesForTesting(layer_clips_subtree, identity_matrix,
8267 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
8268 true, false, false);
8269 SetLayerPropertiesForTesting(render_surface, transform2, gfx::Point3F(),
8270 gfx::PointF(), gfx::Size(30, 30), true, false,
8271 true);
8272 SetLayerPropertiesForTesting(test_layer, identity_matrix, gfx::Point3F(),
8273 gfx::PointF(), gfx::Size(30, 30), true, false,
8274 false);
8275
8276 ExecuteCalculateDrawProperties(root);
8277
8278 ClipTree tree = root->layer_tree_impl()->property_trees()->clip_tree;
8279 ClipNode* node = tree.Node(3);
8280 EXPECT_EQ(node->owner_id, render_surface->id());
8281 EXPECT_TRUE(node->data.render_surface_applies_clip);
ajuma 2015/07/30 20:56:50 Please also add an expectation for the test_layer'
jaydasika 2015/07/31 00:46:29 Done.
8282 }
8283
8243 } // namespace 8284 } // namespace
8244 } // namespace cc 8285 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698