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

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

Issue 1179003002: Rebuild property_tree after LayerImpl::SetTransform() is called in tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8209 matching lines...) Expand 10 before | Expand all | Expand 10 after
8220 EXPECT_EQ( 8220 EXPECT_EQ(
8221 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); 8221 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale);
8222 8222
8223 child_raw->layer_animation_controller()->AbortAnimations( 8223 child_raw->layer_animation_controller()->AbortAnimations(
8224 Animation::TRANSFORM); 8224 Animation::TRANSFORM);
8225 8225
8226 gfx::Transform scale_matrix; 8226 gfx::Transform scale_matrix;
8227 scale_matrix.Scale(1.f, 2.f); 8227 scale_matrix.Scale(1.f, 2.f);
8228 grand_parent->SetTransform(scale_matrix); 8228 grand_parent->SetTransform(scale_matrix);
8229 parent_raw->SetTransform(scale_matrix); 8229 parent_raw->SetTransform(scale_matrix);
8230 grand_parent->layer_tree_impl()->property_trees()->needs_rebuild = true;
8230 AddAnimatedTransformToLayer(parent_raw, 1.0, TransformOperations(), scale); 8231 AddAnimatedTransformToLayer(parent_raw, 1.0, TransformOperations(), scale);
8231 ExecuteCalculateDrawProperties(grand_parent.get()); 8232 ExecuteCalculateDrawProperties(grand_parent.get());
8232 8233
8233 // |grand_parent| and |parent| each have scale 2.f. |parent| has a scale 8234 // |grand_parent| and |parent| each have scale 2.f. |parent| has a scale
8234 // animation with maximum scale 5.f. 8235 // animation with maximum scale 5.f.
8235 EXPECT_EQ(0.f, 8236 EXPECT_EQ(0.f,
8236 grand_parent->draw_properties().maximum_animation_contents_scale); 8237 grand_parent->draw_properties().maximum_animation_contents_scale);
8237 EXPECT_EQ(10.f, 8238 EXPECT_EQ(10.f,
8238 parent_raw->draw_properties().maximum_animation_contents_scale); 8239 parent_raw->draw_properties().maximum_animation_contents_scale);
8239 EXPECT_EQ(10.f, 8240 EXPECT_EQ(10.f,
8240 child_raw->draw_properties().maximum_animation_contents_scale); 8241 child_raw->draw_properties().maximum_animation_contents_scale);
8241 EXPECT_EQ( 8242 EXPECT_EQ(
8242 10.f, 8243 10.f,
8243 grand_child_raw->draw_properties().maximum_animation_contents_scale); 8244 grand_child_raw->draw_properties().maximum_animation_contents_scale);
8244 8245
8245 gfx::Transform perspective_matrix; 8246 gfx::Transform perspective_matrix;
8246 perspective_matrix.ApplyPerspectiveDepth(2.f); 8247 perspective_matrix.ApplyPerspectiveDepth(2.f);
8247 child_raw->SetTransform(perspective_matrix); 8248 child_raw->SetTransform(perspective_matrix);
8249 grand_parent->layer_tree_impl()->property_trees()->needs_rebuild = true;
8248 ExecuteCalculateDrawProperties(grand_parent.get()); 8250 ExecuteCalculateDrawProperties(grand_parent.get());
8249 8251
8250 // |child| has a transform that's neither a translation nor a scale. 8252 // |child| has a transform that's neither a translation nor a scale.
8251 EXPECT_EQ(0.f, 8253 EXPECT_EQ(0.f,
8252 grand_parent->draw_properties().maximum_animation_contents_scale); 8254 grand_parent->draw_properties().maximum_animation_contents_scale);
8253 EXPECT_EQ(10.f, 8255 EXPECT_EQ(10.f,
8254 parent_raw->draw_properties().maximum_animation_contents_scale); 8256 parent_raw->draw_properties().maximum_animation_contents_scale);
8255 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); 8257 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale);
8256 EXPECT_EQ( 8258 EXPECT_EQ(
8257 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); 8259 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale);
8258 8260
8259 parent_raw->SetTransform(perspective_matrix); 8261 parent_raw->SetTransform(perspective_matrix);
8262 grand_parent->layer_tree_impl()->property_trees()->needs_rebuild = true;
8260 ExecuteCalculateDrawProperties(grand_parent.get()); 8263 ExecuteCalculateDrawProperties(grand_parent.get());
8261 8264
8262 // |parent| and |child| have transforms that are neither translations nor 8265 // |parent| and |child| have transforms that are neither translations nor
8263 // scales. 8266 // scales.
8264 EXPECT_EQ(0.f, 8267 EXPECT_EQ(0.f,
8265 grand_parent->draw_properties().maximum_animation_contents_scale); 8268 grand_parent->draw_properties().maximum_animation_contents_scale);
8266 EXPECT_EQ(0.f, 8269 EXPECT_EQ(0.f,
8267 parent_raw->draw_properties().maximum_animation_contents_scale); 8270 parent_raw->draw_properties().maximum_animation_contents_scale);
8268 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); 8271 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale);
8269 EXPECT_EQ( 8272 EXPECT_EQ(
8270 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); 8273 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale);
8271 8274
8272 parent_raw->SetTransform(identity_matrix); 8275 parent_raw->SetTransform(identity_matrix);
8273 child_raw->SetTransform(identity_matrix); 8276 child_raw->SetTransform(identity_matrix);
8274 grand_parent->SetTransform(perspective_matrix); 8277 grand_parent->SetTransform(perspective_matrix);
8278 grand_parent->layer_tree_impl()->property_trees()->needs_rebuild = true;
8275 8279
8276 ExecuteCalculateDrawProperties(grand_parent.get()); 8280 ExecuteCalculateDrawProperties(grand_parent.get());
8277 8281
8278 // |grand_parent| has a transform that's neither a translation nor a scale. 8282 // |grand_parent| has a transform that's neither a translation nor a scale.
8279 EXPECT_EQ(0.f, 8283 EXPECT_EQ(0.f,
8280 grand_parent->draw_properties().maximum_animation_contents_scale); 8284 grand_parent->draw_properties().maximum_animation_contents_scale);
8281 EXPECT_EQ(0.f, 8285 EXPECT_EQ(0.f,
8282 parent_raw->draw_properties().maximum_animation_contents_scale); 8286 parent_raw->draw_properties().maximum_animation_contents_scale);
8283 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); 8287 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale);
8284 EXPECT_EQ( 8288 EXPECT_EQ(
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after
9708 EXPECT_FALSE(root->layer_or_descendant_is_drawn()); 9712 EXPECT_FALSE(root->layer_or_descendant_is_drawn());
9709 EXPECT_FALSE(root->visited()); 9713 EXPECT_FALSE(root->visited());
9710 EXPECT_FALSE(root->sorted_for_recursion()); 9714 EXPECT_FALSE(root->sorted_for_recursion());
9711 EXPECT_FALSE(child->layer_or_descendant_is_drawn()); 9715 EXPECT_FALSE(child->layer_or_descendant_is_drawn());
9712 EXPECT_FALSE(child->visited()); 9716 EXPECT_FALSE(child->visited());
9713 EXPECT_FALSE(child->sorted_for_recursion()); 9717 EXPECT_FALSE(child->sorted_for_recursion());
9714 } 9718 }
9715 9719
9716 } // namespace 9720 } // namespace
9717 } // namespace cc 9721 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698