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

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

Issue 1106013002: cc: Fix property tree position updates when rebuilding is skipped (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test Created 5 years, 8 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 | cc/trees/property_tree.h » ('j') | 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 9203 matching lines...) Expand 10 before | Expand all | Expand 10 after
9214 9214
9215 ExecuteCalculateDrawProperties(root.get()); 9215 ExecuteCalculateDrawProperties(root.get());
9216 EXPECT_EQ(gfx::Rect(10, 10), child->visible_rect_from_property_trees()); 9216 EXPECT_EQ(gfx::Rect(10, 10), child->visible_rect_from_property_trees());
9217 9217
9218 child->SetTransformOrigin(gfx::Point3F(10.f, 10.f, 10.f)); 9218 child->SetTransformOrigin(gfx::Point3F(10.f, 10.f, 10.f));
9219 9219
9220 ExecuteCalculateDrawProperties(root.get()); 9220 ExecuteCalculateDrawProperties(root.get());
9221 EXPECT_EQ(gfx::Rect(5, 5, 5, 5), child->visible_rect_from_property_trees()); 9221 EXPECT_EQ(gfx::Rect(5, 5, 5, 5), child->visible_rect_from_property_trees());
9222 } 9222 }
9223 9223
9224 TEST_F(LayerTreeHostCommonTest, UpdateScrollChildPosition) {
9225 scoped_refptr<Layer> root = Layer::Create();
9226 scoped_refptr<LayerWithForcedDrawsContent> scroll_parent =
9227 make_scoped_refptr(new LayerWithForcedDrawsContent);
9228 scoped_refptr<LayerWithForcedDrawsContent> scroll_child =
9229 make_scoped_refptr(new LayerWithForcedDrawsContent);
9230
9231 root->AddChild(scroll_child);
9232 root->AddChild(scroll_parent);
9233 scroll_child->SetScrollParent(scroll_parent.get());
9234 scroll_parent->SetScrollClipLayerId(root->id());
9235
9236 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
9237 host->SetRootLayer(root);
9238
9239 gfx::Transform identity_transform;
9240 gfx::Transform scale;
9241 scale.Scale(2.f, 2.f);
9242 SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(),
9243 gfx::PointF(), gfx::Size(50, 50), true, false);
9244 SetLayerPropertiesForTesting(scroll_child.get(), scale, gfx::Point3F(),
9245 gfx::PointF(), gfx::Size(40, 40), true, false);
9246 SetLayerPropertiesForTesting(scroll_parent.get(), identity_transform,
9247 gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
9248 true, false);
9249
9250 ExecuteCalculateDrawProperties(root.get());
9251 EXPECT_EQ(gfx::Rect(25, 25),
9252 scroll_child->visible_rect_from_property_trees());
9253
9254 scroll_child->SetPosition(gfx::PointF(0, -10.f));
9255 scroll_parent->SetScrollOffset(gfx::ScrollOffset(0.f, 10.f));
9256 ExecuteCalculateDrawProperties(root.get());
9257 EXPECT_EQ(gfx::Rect(0, 5, 25, 25),
9258 scroll_child->visible_rect_from_property_trees());
9259 }
9260
9224 } // namespace 9261 } // namespace
9225 } // namespace cc 9262 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/property_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698