summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorjaydasika <jaydasika@chromium.org>2015-10-21 16:28:21 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-21 23:29:05 +0000
commit2c8c2879553dea07b8d9c2b05655e7ae58aeab04 (patch)
tree89801eb9376216ac7d553ecc4424f7036cd79282 /cc
parentf715b1695cf753932f07b0ff54737fee7aff96c6 (diff)
downloadchromium_src-2c8c2879553dea07b8d9c2b05655e7ae58aeab04.zip
chromium_src-2c8c2879553dea07b8d9c2b05655e7ae58aeab04.tar.gz
chromium_src-2c8c2879553dea07b8d9c2b05655e7ae58aeab04.tar.bz2
Remove multiple application of sublayer scale in property trees.
In CalculateVisibleRects we apply destination sublayer scale while calculating transform from clip parent target space to current target space. We should not do that, as we already account for the subalyer scale in ComputeClips. BUG=546117 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1407273005 Cr-Commit-Position: refs/heads/master@{#355430}
Diffstat (limited to 'cc')
-rw-r--r--cc/trees/draw_property_utils.cc2
-rw-r--r--cc/trees/layer_tree_host_common_unittest.cc43
2 files changed, 44 insertions, 1 deletions
diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc
index 3854b4b..5537852 100644
--- a/cc/trees/draw_property_utils.cc
+++ b/cc/trees/draw_property_utils.cc
@@ -64,7 +64,7 @@ void CalculateVisibleRects(const std::vector<LayerType*>& visible_layer_list,
continue;
}
gfx::Transform clip_to_target;
- success = transform_tree.ComputeTransformWithDestinationSublayerScale(
+ success = transform_tree.ComputeTransform(
clip_node->data.target_id, target_node->id, &clip_to_target);
if (!success) {
// An animated singular transform may become non-singular during the
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index ed1a804..62222a6 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -8924,6 +8924,49 @@ TEST_F(LayerTreeHostCommonTest, ClipBetweenClipChildTargetAndClipParentTarget) {
unclipped_desc_surface->render_surface()->content_rect());
}
+TEST_F(LayerTreeHostCommonTest, VisibleRectForDescendantOfScaledSurface) {
+ LayerImpl* root = root_layer();
+ LayerImpl* surface = AddChildToRoot<LayerImpl>();
+ LayerImpl* clip_layer = AddChild<LayerImpl>(surface);
+ LayerImpl* clip_parent = AddChild<LayerImpl>(clip_layer);
+ LayerImpl* unclipped_desc_surface = AddChild<LayerImpl>(clip_parent);
+ LayerImpl* clip_child = AddChild<LayerImpl>(unclipped_desc_surface);
+
+ clip_child->SetDrawsContent(true);
+ unclipped_desc_surface->SetDrawsContent(true);
+ clip_child->SetClipParent(clip_parent);
+ scoped_ptr<std::set<LayerImpl*>> clip_children(new std::set<LayerImpl*>);
+ clip_children->insert(clip_child);
+ clip_parent->SetClipChildren(clip_children.release());
+
+ gfx::Transform identity_matrix;
+ gfx::Transform scale;
+ scale.Scale(2, 2);
+ SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(100, 100), true, false,
+ true);
+ SetLayerPropertiesForTesting(surface, scale, gfx::Point3F(), gfx::PointF(),
+ gfx::Size(100, 100), true, false, true);
+ SetLayerPropertiesForTesting(clip_layer, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(20, 20), true, false,
+ false);
+ SetLayerPropertiesForTesting(clip_parent, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(50, 50), true, false,
+ false);
+ SetLayerPropertiesForTesting(unclipped_desc_surface, identity_matrix,
+ gfx::Point3F(), gfx::PointF(),
+ gfx::Size(100, 100), true, false, true);
+ SetLayerPropertiesForTesting(clip_child, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(100, 100), true, false,
+ false);
+ surface->SetMasksToBounds(true);
+ clip_layer->SetMasksToBounds(true);
+
+ ExecuteCalculateDrawProperties(root);
+
+ EXPECT_EQ(gfx::Rect(20, 20), clip_child->visible_layer_rect());
+}
+
TEST_F(LayerTreeHostCommonTest, LayerWithInputHandlerAndZeroOpacity) {
LayerImpl* root = root_layer();
LayerImpl* render_surface = AddChild<LayerImpl>(root);