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

Side by Side Diff: cc/layers/layer_position_constraint_unittest.cc

Issue 1912893002: cc : Stop pushing properties not used by LayerImpl to LayerImpl. (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « cc/layers/layer_iterator_unittest.cc ('k') | cc/layers/layer_unittest.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/layer_position_constraint.h" 5 #include "cc/layers/layer_position_constraint.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "cc/layers/layer.h" 9 #include "cc/layers/layer.h"
10 #include "cc/layers/layer_impl.h" 10 #include "cc/layers/layer_impl.h"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 } 428 }
429 429
430 TEST_F(LayerPositionConstraintTest, 430 TEST_F(LayerPositionConstraintTest,
431 ScrollCompensationForFixedPositionWithIntermediateSurfaceAndTransforms) { 431 ScrollCompensationForFixedPositionWithIntermediateSurfaceAndTransforms) {
432 // This test checks for correct scroll compensation when the fixed-position 432 // This test checks for correct scroll compensation when the fixed-position
433 // container contributes to a different render surface than the fixed-position 433 // container contributes to a different render surface than the fixed-position
434 // layer. In this case, the surface draw transforms also have to be accounted 434 // layer. In this case, the surface draw transforms also have to be accounted
435 // for when checking the scroll delta. 435 // for when checking the scroll delta.
436 child_->SetIsContainerForFixedPositionLayers(true); 436 child_->SetIsContainerForFixedPositionLayers(true);
437 grand_child_->SetPosition(gfx::PointF(8.f, 6.f)); 437 grand_child_->SetPosition(gfx::PointF(8.f, 6.f));
438 grand_child_->SetForceRenderSurface(true); 438 grand_child_->SetForceRenderSurfaceForTesting(true);
439 great_grand_child_->SetPositionConstraint(fixed_to_top_left_); 439 great_grand_child_->SetPositionConstraint(fixed_to_top_left_);
440 440
441 gfx::Transform rotation_about_z; 441 gfx::Transform rotation_about_z;
442 rotation_about_z.RotateAboutZAxis(90.0); 442 rotation_about_z.RotateAboutZAxis(90.0);
443 great_grand_child_->SetTransform(rotation_about_z); 443 great_grand_child_->SetTransform(rotation_about_z);
444 444
445 CommitAndUpdateImplPointers(); 445 CommitAndUpdateImplPointers();
446 446
447 // Case 1: scroll delta of 0, 0 447 // Case 1: scroll delta of 0, 0
448 SetScrollOffsetDelta(child_impl_, gfx::Vector2d(0, 0)); 448 SetScrollOffsetDelta(child_impl_, gfx::Vector2d(0, 0));
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 scoped_refptr<Layer> fixed_position_child = 552 scoped_refptr<Layer> fixed_position_child =
553 make_scoped_refptr(new LayerWithForcedDrawsContent()); 553 make_scoped_refptr(new LayerWithForcedDrawsContent());
554 SetLayerPropertiesForTesting(fixed_position_child.get(), gfx::Transform(), 554 SetLayerPropertiesForTesting(fixed_position_child.get(), gfx::Transform(),
555 gfx::Point3F(), gfx::PointF(), 555 gfx::Point3F(), gfx::PointF(),
556 gfx::Size(100, 100), true); 556 gfx::Size(100, 100), true);
557 great_grand_child_->AddChild(fixed_position_child); 557 great_grand_child_->AddChild(fixed_position_child);
558 558
559 // Actually set up the scenario here. 559 // Actually set up the scenario here.
560 child_->SetIsContainerForFixedPositionLayers(true); 560 child_->SetIsContainerForFixedPositionLayers(true);
561 grand_child_->SetPosition(gfx::PointF(8.f, 6.f)); 561 grand_child_->SetPosition(gfx::PointF(8.f, 6.f));
562 grand_child_->SetForceRenderSurface(true); 562 grand_child_->SetForceRenderSurfaceForTesting(true);
563 great_grand_child_->SetPosition(gfx::PointF(40.f, 60.f)); 563 great_grand_child_->SetPosition(gfx::PointF(40.f, 60.f));
564 great_grand_child_->SetForceRenderSurface(true); 564 great_grand_child_->SetForceRenderSurfaceForTesting(true);
565 fixed_position_child->SetPositionConstraint(fixed_to_top_left_); 565 fixed_position_child->SetPositionConstraint(fixed_to_top_left_);
566 566
567 // The additional rotation, which is non-commutative with translations, helps 567 // The additional rotation, which is non-commutative with translations, helps
568 // to verify that we have correct order-of-operations in the final scroll 568 // to verify that we have correct order-of-operations in the final scroll
569 // compensation. Note that rotating about the center of the layer ensures we 569 // compensation. Note that rotating about the center of the layer ensures we
570 // do not accidentally clip away layers that we want to test. 570 // do not accidentally clip away layers that we want to test.
571 gfx::Transform rotation_about_z; 571 gfx::Transform rotation_about_z;
572 rotation_about_z.Translate(50.0, 50.0); 572 rotation_about_z.Translate(50.0, 50.0);
573 rotation_about_z.RotateAboutZAxis(90.0); 573 rotation_about_z.RotateAboutZAxis(90.0);
574 rotation_about_z.Translate(-50.0, -50.0); 574 rotation_about_z.Translate(-50.0, -50.0);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 scoped_refptr<Layer> fixed_position_child = 708 scoped_refptr<Layer> fixed_position_child =
709 make_scoped_refptr(new LayerWithForcedDrawsContent()); 709 make_scoped_refptr(new LayerWithForcedDrawsContent());
710 SetLayerPropertiesForTesting(fixed_position_child.get(), gfx::Transform(), 710 SetLayerPropertiesForTesting(fixed_position_child.get(), gfx::Transform(),
711 gfx::Point3F(), gfx::PointF(), 711 gfx::Point3F(), gfx::PointF(),
712 gfx::Size(100, 100), true); 712 gfx::Size(100, 100), true);
713 great_grand_child_->AddChild(fixed_position_child); 713 great_grand_child_->AddChild(fixed_position_child);
714 714
715 // Actually set up the scenario here. 715 // Actually set up the scenario here.
716 child_transform_layer_->SetIsContainerForFixedPositionLayers(true); 716 child_transform_layer_->SetIsContainerForFixedPositionLayers(true);
717 grand_child_->SetPosition(gfx::PointF(8.f, 6.f)); 717 grand_child_->SetPosition(gfx::PointF(8.f, 6.f));
718 grand_child_->SetForceRenderSurface(true); 718 grand_child_->SetForceRenderSurfaceForTesting(true);
719 great_grand_child_->SetPosition(gfx::PointF(40.f, 60.f)); 719 great_grand_child_->SetPosition(gfx::PointF(40.f, 60.f));
720 great_grand_child_->SetForceRenderSurface(true); 720 great_grand_child_->SetForceRenderSurfaceForTesting(true);
721 fixed_position_child->SetPositionConstraint(fixed_to_top_left_); 721 fixed_position_child->SetPositionConstraint(fixed_to_top_left_);
722 722
723 // The additional rotations, which are non-commutative with translations, help 723 // The additional rotations, which are non-commutative with translations, help
724 // to verify that we have correct order-of-operations in the final scroll 724 // to verify that we have correct order-of-operations in the final scroll
725 // compensation. Note that rotating about the center of the layer ensures we 725 // compensation. Note that rotating about the center of the layer ensures we
726 // do not accidentally clip away layers that we want to test. 726 // do not accidentally clip away layers that we want to test.
727 gfx::Transform rotation_about_z; 727 gfx::Transform rotation_about_z;
728 rotation_about_z.Translate(50.0, 50.0); 728 rotation_about_z.Translate(50.0, 50.0);
729 rotation_about_z.RotateAboutZAxis(30.0); 729 rotation_about_z.RotateAboutZAxis(30.0);
730 rotation_about_z.Translate(-50.0, -50.0); 730 rotation_about_z.Translate(-50.0, -50.0);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 } 821 }
822 822
823 TEST_F(LayerPositionConstraintTest, 823 TEST_F(LayerPositionConstraintTest,
824 ScrollCompensationForFixedPositionLayerWithContainerLayerThatHasSurface) { 824 ScrollCompensationForFixedPositionLayerWithContainerLayerThatHasSurface) {
825 // This test checks for correct scroll compensation when the fixed-position 825 // This test checks for correct scroll compensation when the fixed-position
826 // container itself has a render surface. In this case, the container layer 826 // container itself has a render surface. In this case, the container layer
827 // should be treated like a layer that contributes to a render target, and 827 // should be treated like a layer that contributes to a render target, and
828 // that render target is completely irrelevant; it should not affect the 828 // that render target is completely irrelevant; it should not affect the
829 // scroll compensation. 829 // scroll compensation.
830 child_->SetIsContainerForFixedPositionLayers(true); 830 child_->SetIsContainerForFixedPositionLayers(true);
831 child_->SetForceRenderSurface(true); 831 child_->SetForceRenderSurfaceForTesting(true);
832 grand_child_->SetPositionConstraint(fixed_to_top_left_); 832 grand_child_->SetPositionConstraint(fixed_to_top_left_);
833 833
834 CommitAndUpdateImplPointers(); 834 CommitAndUpdateImplPointers();
835 835
836 // Case 1: scroll delta of 0, 0 836 // Case 1: scroll delta of 0, 0
837 SetScrollOffsetDelta(child_impl_, gfx::Vector2d(0, 0)); 837 SetScrollOffsetDelta(child_impl_, gfx::Vector2d(0, 0));
838 ExecuteCalculateDrawProperties(root_impl_); 838 ExecuteCalculateDrawProperties(root_impl_);
839 839
840 gfx::Transform expected_surface_draw_transform; 840 gfx::Transform expected_surface_draw_transform;
841 gfx::Transform expected_child_transform; 841 gfx::Transform expected_child_transform;
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 VerifySerializeAndDeserializeProto(true, false, true); 1158 VerifySerializeAndDeserializeProto(true, false, true);
1159 VerifySerializeAndDeserializeProto(true, false, false); 1159 VerifySerializeAndDeserializeProto(true, false, false);
1160 VerifySerializeAndDeserializeProto(false, true, true); 1160 VerifySerializeAndDeserializeProto(false, true, true);
1161 VerifySerializeAndDeserializeProto(false, true, false); 1161 VerifySerializeAndDeserializeProto(false, true, false);
1162 VerifySerializeAndDeserializeProto(false, false, true); 1162 VerifySerializeAndDeserializeProto(false, false, true);
1163 VerifySerializeAndDeserializeProto(false, false, false); 1163 VerifySerializeAndDeserializeProto(false, false, false);
1164 } 1164 }
1165 1165
1166 } // namespace 1166 } // namespace
1167 } // namespace cc 1167 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_iterator_unittest.cc ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698