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

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

Issue 994843002: Account for fixed positioning once when computing parent offset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compare rects, not strings. Created 5 years, 9 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_builder.cc » ('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 8836 matching lines...) Expand 10 before | Expand all | Expand 10 after
8847 rotated->AddChild(surface); 8847 rotated->AddChild(surface);
8848 surface->AddChild(container); 8848 surface->AddChild(container);
8849 surface->AddChild(box); 8849 surface->AddChild(box);
8850 8850
8851 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost()); 8851 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
8852 host->SetRootLayer(root); 8852 host->SetRootLayer(root);
8853 8853
8854 ExecuteCalculateDrawProperties(root.get()); 8854 ExecuteCalculateDrawProperties(root.get());
8855 } 8855 }
8856 8856
8857 TEST_F(LayerTreeHostCommonTest, OnlyApplyFixedPositioningOnce) {
8858 gfx::Transform identity;
8859 gfx::Transform translate_z;
8860 translate_z.Translate3d(0, 0, 10);
8861
8862 scoped_refptr<Layer> root = Layer::Create();
8863 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(),
8864 gfx::PointF(), gfx::Size(800, 800), true, false);
8865 root->SetIsContainerForFixedPositionLayers(true);
8866
8867 scoped_refptr<Layer> frame_clip = Layer::Create();
8868 SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(),
8869 gfx::PointF(500, 100), gfx::Size(100, 100), true,
8870 false);
8871 frame_clip->SetMasksToBounds(true);
8872
8873 scoped_refptr<LayerWithForcedDrawsContent> fixed =
8874 make_scoped_refptr(new LayerWithForcedDrawsContent());
8875 SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(),
8876 gfx::PointF(), gfx::Size(1000, 1000), true,
8877 false);
8878
8879 LayerPositionConstraint constraint;
8880 constraint.set_is_fixed_position(true);
8881 fixed->SetPositionConstraint(constraint);
8882
8883 root->AddChild(frame_clip);
8884 frame_clip->AddChild(fixed);
8885
8886 scoped_ptr<FakeLayerTreeHost> host(CreateFakeLayerTreeHost());
8887 host->SetRootLayer(root);
8888
8889 ExecuteCalculateDrawProperties(root.get());
8890
8891 gfx::Rect expected(0, 0, 100, 100);
8892 EXPECT_EQ(expected, fixed->visible_rect_from_property_trees());
8893 }
8894
8857 } // namespace 8895 } // namespace
8858 } // namespace cc 8896 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698