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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1385123003: Delete scrollCompensationAdjustment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/proto/layer.proto ('k') | cc/trees/property_tree.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 054d3c935d9c44fe1a75961ef63b9fbfc99ce179..e2c7a31f3157a79f6004626bd9c4f55166939368 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -7181,107 +7181,6 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
}
TEST_F(LayerTreeHostCommonTest,
- ScrollCompensationMainScrollOffsetFractionalPart) {
- // This test verifies that a scrolling layer that has fractional scroll offset
- // from main doesn't move a fixed position child.
- //
- // + root
- // + container
- // + scroller
- // + fixed
- //
- FakeImplTaskRunnerProvider task_runner_provider;
- TestSharedBitmapManager shared_bitmap_manager;
- TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
- &task_graph_runner);
- host_impl.CreatePendingTree();
- scoped_ptr<LayerImpl> root_ptr =
- LayerImpl::Create(host_impl.active_tree(), 1);
- LayerImpl* root = root_ptr.get();
- scoped_ptr<LayerImpl> container =
- LayerImpl::Create(host_impl.active_tree(), 2);
- LayerImpl* container_layer = container.get();
- scoped_ptr<LayerImpl> scroller =
- LayerImpl::Create(host_impl.active_tree(), 3);
- LayerImpl* scroll_layer = scroller.get();
- scoped_ptr<LayerImpl> fixed = LayerImpl::Create(host_impl.active_tree(), 4);
- LayerImpl* fixed_layer = fixed.get();
-
- container->SetIsContainerForFixedPositionLayers(true);
-
- LayerPositionConstraint constraint;
- constraint.set_is_fixed_position(true);
- container->SetDrawsContent(true);
- fixed->SetDrawsContent(true);
- fixed->SetPositionConstraint(constraint);
-
- scroller->SetDrawsContent(true);
- scroller->SetScrollClipLayer(container->id());
-
- gfx::Transform identity_transform;
- gfx::Transform container_transform;
- container_transform.Translate3d(10.0, 20.0, 0.0);
- gfx::Vector2dF container_offset = container_transform.To2dTranslation();
-
- SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(),
- gfx::PointF(), gfx::Size(50, 50), true, false,
- true);
- SetLayerPropertiesForTesting(container.get(), container_transform,
- gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40),
- true, false, false);
- SetLayerPropertiesForTesting(scroller.get(), identity_transform,
- gfx::Point3F(), gfx::PointF(0.0, 0.0),
- gfx::Size(30, 30), true, false, false);
-
- gfx::ScrollOffset scroll_offset(3.3, 4.2);
- gfx::Vector2dF main_scroll_fractional_part(0.3f, 0.2f);
- gfx::Vector2dF scroll_delta(0.1f, 0.4f);
- // Blink only uses the integer part of the scroll_offset for fixed
- // position layer.
- SetLayerPropertiesForTesting(fixed.get(), identity_transform, gfx::Point3F(),
- gfx::PointF(3.0f, 4.0f), gfx::Size(50, 50), true,
- false, false);
- scroll_layer->layer_tree_impl()
- ->property_trees()
- ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(),
- scroll_offset);
-
- scroll_layer->SetScrollCompensationAdjustment(main_scroll_fractional_part);
-
- scroller->AddChild(std::move(fixed));
- container->AddChild(std::move(scroller));
- root->AddChild(std::move(container));
-
- root->layer_tree_impl()->SetRootLayer(std::move(root_ptr));
- root->layer_tree_impl()->BuildPropertyTreesForTesting();
-
- SetScrollOffsetDelta(scroll_layer, scroll_delta);
-
- LayerImplList render_surface_layer_list;
- root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting();
- LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
- root, root->bounds(), &render_surface_layer_list,
- root->layer_tree_impl()->current_render_surface_list_id());
- LayerTreeHostCommon::CalculateDrawProperties(&inputs);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(
- container_layer->draw_properties().screen_space_transform,
- fixed_layer->draw_properties().screen_space_transform);
- EXPECT_VECTOR_EQ(
- fixed_layer->draw_properties().screen_space_transform.To2dTranslation(),
- container_offset);
-
- gfx::ScrollOffset effective_scroll_offset =
- ScrollOffsetWithDelta(scroll_offset, scroll_delta);
- gfx::Vector2d rounded_effective_scroll_offset =
- ToRoundedVector2d(ScrollOffsetToVector2dF(effective_scroll_offset));
- EXPECT_VECTOR_EQ(
- scroll_layer->draw_properties().screen_space_transform.To2dTranslation(),
- container_offset - rounded_effective_scroll_offset);
-}
-
-TEST_F(LayerTreeHostCommonTest,
ScrollSnappingWithAnimatedScreenSpaceTransform) {
// This test verifies that a scrolling layer whose screen space transform is
// animating doesn't get snapped to integer coordinates.
@@ -8630,65 +8529,6 @@ TEST_F(LayerTreeHostCommonTest, OnlyApplyFixedPositioningOnce) {
EXPECT_EQ(expected, fixed->visible_layer_rect());
}
-TEST_F(LayerTreeHostCommonTest,
- PropertyTreesAccountForScrollCompensationAdjustment) {
- gfx::Transform identity;
- gfx::Transform translate_z;
- translate_z.Translate3d(0, 0, 10);
-
- scoped_refptr<Layer> root = Layer::Create();
- SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(),
- gfx::PointF(), gfx::Size(800, 800), true, false);
- root->SetIsContainerForFixedPositionLayers(true);
-
- scoped_refptr<Layer> frame_clip = Layer::Create();
- SetLayerPropertiesForTesting(frame_clip.get(), translate_z, gfx::Point3F(),
- gfx::PointF(500, 100), gfx::Size(100, 100), true,
- false);
- frame_clip->SetMasksToBounds(true);
-
- scoped_refptr<LayerWithForcedDrawsContent> scroller =
- make_scoped_refptr(new LayerWithForcedDrawsContent());
- SetLayerPropertiesForTesting(scroller.get(), identity, gfx::Point3F(),
- gfx::PointF(), gfx::Size(1000, 1000), true,
- false);
-
- scroller->SetScrollCompensationAdjustment(gfx::Vector2dF(0.3f, 0.7f));
- scroller->SetScrollOffset(gfx::ScrollOffset(0.3, 0.7));
- scroller->SetScrollClipLayerId(frame_clip->id());
-
- scoped_refptr<LayerWithForcedDrawsContent> fixed =
- make_scoped_refptr(new LayerWithForcedDrawsContent());
- SetLayerPropertiesForTesting(fixed.get(), identity, gfx::Point3F(),
- gfx::PointF(), gfx::Size(50, 50), true, false);
-
- LayerPositionConstraint constraint;
- constraint.set_is_fixed_position(true);
- fixed->SetPositionConstraint(constraint);
-
- scoped_refptr<LayerWithForcedDrawsContent> fixed_child =
- make_scoped_refptr(new LayerWithForcedDrawsContent());
- SetLayerPropertiesForTesting(fixed_child.get(), identity, gfx::Point3F(),
- gfx::PointF(), gfx::Size(10, 10), true, false);
-
- fixed_child->SetPositionConstraint(constraint);
-
- root->AddChild(frame_clip);
- frame_clip->AddChild(scroller);
- scroller->AddChild(fixed);
- fixed->AddChild(fixed_child);
-
- host()->SetRootLayer(root);
-
- ExecuteCalculateDrawPropertiesWithPropertyTrees(root.get());
-
- gfx::Rect expected(0, 0, 50, 50);
- EXPECT_EQ(expected, fixed->visible_layer_rect());
-
- expected = gfx::Rect(0, 0, 10, 10);
- EXPECT_EQ(expected, fixed_child->visible_layer_rect());
-}
-
TEST_F(LayerTreeHostCommonTest, FixedClipsShouldBeAssociatedWithTheRightNode) {
gfx::Transform identity;
« no previous file with comments | « cc/proto/layer.proto ('k') | cc/trees/property_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698