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

Unified Diff: cc/layers/layer_position_constraint_unittest.cc

Issue 15579002: Implement transform/clip support for Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests Created 7 years, 7 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
Index: cc/layers/layer_position_constraint_unittest.cc
diff --git a/cc/layers/layer_position_constraint_unittest.cc b/cc/layers/layer_position_constraint_unittest.cc
index af1af4ead0f3d44c518c1f8b76353b52fa05a533..37f38afb28c38b387660a83077ab8c02b74d29ea 100644
--- a/cc/layers/layer_position_constraint_unittest.cc
+++ b/cc/layers/layer_position_constraint_unittest.cc
@@ -50,6 +50,7 @@ void ExecuteCalculateDrawProperties(LayerImpl* root_layer,
LayerTreeHostCommon::CalculateDrawProperties(
root_layer,
device_viewport_size,
+ gfx::Transform(),
device_scale_factor,
page_scale_factor,
page_scale_application_layer,
@@ -1030,70 +1031,5 @@ TEST_F(LayerPositionConstraintTest,
grand_child->draw_transform());
}
-TEST_F(LayerPositionConstraintTest,
- ScrollCompensationForFixedPositionLayerThatHasNoContainer) {
enne (OOO) 2013/06/04 17:26:03 What do you mean by "we don't ever plan to structu
aelias_OOO_until_Jul13 2013/06/04 17:54:20 A fixed-pos layer will always have a clip layer ab
danakj 2013/06/04 18:02:50 Until the UI compositor does it? Should that be a
aelias_OOO_until_Jul13 2013/06/04 22:18:27 Anyway, since all we care about is some kind of co
- // This test checks scroll compensation when a fixed-position layer does not
- // find any ancestor that is a "containerForFixedPositionLayers". In this
- // situation, the layer should be fixed to the viewport -- not the root_layer,
- // which may have transforms of its own.
- LayerImpl* child = root_->children()[0];
- LayerImpl* grand_child = child->children()[0];
-
- gfx::Transform rotation_by_z;
- rotation_by_z.RotateAboutZAxis(90.0);
-
- root_->SetTransform(rotation_by_z);
- grand_child->SetPositionConstraint(fixed_to_top_left_);
-
- // Case 1: root scroll delta of 0, 0
- root_->SetScrollDelta(gfx::Vector2d(0, 0));
- ExecuteCalculateDrawProperties(root_.get());
-
- gfx::Transform identity_matrix;
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform());
- EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix,
- grand_child->draw_transform());
-
- // Case 2: root scroll delta of 10, 10
- root_->SetScrollDelta(gfx::Vector2d(10, 20));
- ExecuteCalculateDrawProperties(root_.get());
-
- // The child is affected by scroll delta, but it is already implcitly
- // accounted for by the child's target surface (i.e. the root render surface).
- // The grand_child is not affected by the scroll delta, so its draw transform
- // needs to explicitly inverse-compensate for the scroll that's embedded in
- // the target surface.
- gfx::Transform expected_grand_child_transform;
- expected_grand_child_transform.PreconcatTransform(Inverse(rotation_by_z));
- // explicit cancelling out the scroll delta that gets embedded in the fixed
- // position layer's surface.
- expected_grand_child_transform.Translate(10.0, 20.0);
- expected_grand_child_transform.PreconcatTransform(rotation_by_z);
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform());
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected_grand_child_transform,
- grand_child->draw_transform());
-
-
- // Case 3: fixed-container size delta of 20, 20
- root_->SetFixedContainerSizeDelta(gfx::Vector2d(20, 20));
- ExecuteCalculateDrawProperties(root_.get());
-
- // Top-left fixed-position layer should not be affected by container size.
- EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform());
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected_grand_child_transform,
- grand_child->draw_transform());
-
- // Case 4: Bottom-right fixed-position layer.
- grand_child->SetPositionConstraint(fixed_to_bottom_right_);
- ExecuteCalculateDrawProperties(root_.get());
-
- // Root layer is not the fixed-container anyway.
- EXPECT_TRANSFORMATION_MATRIX_EQ(identity_matrix, child->draw_transform());
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected_grand_child_transform,
- grand_child->draw_transform());
-}
-
} // namespace
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698