Remove should_flatten_transform from cc::Layer and callsites.
This field is never used in cc now that Blink uses cc in layer list mode.
Bug: 1008483
Change-Id: Ib70850e91c76cd0613bdf4b24ab14d3b7d21d172
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1829950
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702535}
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 3c026141a..c799465 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -97,7 +97,6 @@
contents_opaque(false),
is_drawable(false),
double_sided(true),
- should_flatten_transform(true),
use_parent_backface_visibility(false),
is_fast_rounded_corner(false),
scrollable(false),
@@ -131,7 +130,6 @@
scroll_tree_index_(ScrollTree::kInvalidNodeId),
property_tree_sequence_number_(-1),
ignore_set_needs_commit_(false),
- should_flatten_screen_space_transform_from_property_tree_(false),
draws_content_(false),
should_check_backface_visibility_(false),
cache_render_surface_(false),
@@ -1215,16 +1213,6 @@
layer_tree_host_->property_trees()->needs_rebuild = true;
}
-void Layer::SetShouldFlattenTransform(bool should_flatten) {
- DCHECK(IsPropertyChangeAllowed());
- if (inputs_.should_flatten_transform == should_flatten)
- return;
- inputs_.should_flatten_transform = should_flatten;
- SetNeedsCommit();
- SetPropertyTreesNeedRebuild();
- SetSubtreePropertyChanged();
-}
-
#if DCHECK_IS_ON()
std::string Layer::DebugName() const {
if (inputs_.client) {
@@ -1363,8 +1351,6 @@
layer->SetWheelEventHandlerRegion(Region());
}
layer->SetContentsOpaque(inputs_.contents_opaque);
- layer->SetShouldFlattenScreenSpaceTransformFromPropertyTree(
- should_flatten_screen_space_transform_from_property_tree_);
layer->SetUseParentBackfaceVisibility(inputs_.use_parent_backface_visibility);
layer->SetShouldCheckBackfaceVisibility(should_check_backface_visibility_);
@@ -1481,15 +1467,6 @@
SetNeedsPushProperties();
}
-void Layer::SetShouldFlattenScreenSpaceTransformFromPropertyTree(
- bool should_flatten) {
- if (should_flatten_screen_space_transform_from_property_tree_ ==
- should_flatten)
- return;
- should_flatten_screen_space_transform_from_property_tree_ = should_flatten;
- SetNeedsPushProperties();
-}
-
void Layer::SetMayContainVideo(bool yes) {
if (may_contain_video_ == yes)
return;
diff --git a/cc/layers/layer.h b/cc/layers/layer.h
index 91ed5482..054f388 100644
--- a/cc/layers/layer.h
+++ b/cc/layers/layer.h
@@ -452,14 +452,6 @@
return inputs_.use_parent_backface_visibility;
}
- // Set or get if the subtree of this layer is composited in 3d-space, or if
- // the layers are flattened into the plane of this layer. This supports the
- // transform-style CSS property.
- void SetShouldFlattenTransform(bool flatten);
- bool should_flatten_transform() const {
- return inputs_.should_flatten_transform;
- }
-
// When true the layer may contribute to the compositor's output. When false,
// it does not. This property does not apply to children of the layer, they
// may contribute while this layer does not. The layer itself will determine
@@ -697,15 +689,6 @@
return should_check_backface_visibility_;
}
- // Internal to property tree construction. The value here derives from
- // should_flatten_transform() along with other state, and is for internal use
- // in order to flatten the layer's ScreenSpaceTransform() in cases where the
- // property tree did not handle it.
- void SetShouldFlattenScreenSpaceTransformFromPropertyTree(bool should);
- bool should_flatten_screen_space_transform_from_property_tree() const {
- return should_flatten_screen_space_transform_from_property_tree_;
- }
-
#if DCHECK_IS_ON()
// For debugging, containing information about the associated DOM, etc.
std::string DebugName() const;
@@ -849,7 +832,6 @@
bool is_drawable : 1;
bool double_sided : 1;
- bool should_flatten_transform : 1;
bool use_parent_backface_visibility : 1;
@@ -935,7 +917,6 @@
// because it's used in base::AutoReset.
bool ignore_set_needs_commit_;
- bool should_flatten_screen_space_transform_from_property_tree_ : 1;
bool draws_content_ : 1;
bool should_check_backface_visibility_ : 1;
// Force use of and cache render surface.
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index a84bcdc..6653d2cf 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -51,7 +51,6 @@
layer_tree_impl_(tree_impl),
will_always_push_properties_(will_always_push_properties),
scrollable_(false),
- should_flatten_screen_space_transform_from_property_tree_(false),
layer_property_changed_not_from_property_trees_(false),
layer_property_changed_from_property_trees_(false),
may_contain_video_(false),
@@ -353,8 +352,6 @@
layer->has_transform_node_ = has_transform_node_;
layer->offset_to_transform_parent_ = offset_to_transform_parent_;
- layer->should_flatten_screen_space_transform_from_property_tree_ =
- should_flatten_screen_space_transform_from_property_tree_;
layer->masks_to_bounds_ = masks_to_bounds_;
layer->contents_opaque_ = contents_opaque_;
layer->may_contain_video_ = may_contain_video_;
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index 303f61d..b054f7f 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -112,14 +112,6 @@
return offset_to_transform_parent_;
}
- void SetShouldFlattenScreenSpaceTransformFromPropertyTree(
- bool should_flatten) {
- should_flatten_screen_space_transform_from_property_tree_ = should_flatten;
- }
- bool should_flatten_screen_space_transform_from_property_tree() const {
- return should_flatten_screen_space_transform_from_property_tree_;
- }
-
bool is_clipped() const { return draw_properties_.is_clipped; }
LayerTreeImpl* layer_tree_impl() const { return layer_tree_impl_; }
@@ -487,8 +479,6 @@
// |scroll_container_bounds|).
bool scrollable_ : 1;
- bool should_flatten_screen_space_transform_from_property_tree_ : 1;
-
// Tracks if drawing-related properties have changed since last redraw.
// TODO(wutao): We want to distinquish the sources of change so that we can
// reuse the cache of render pass. For example, we can reuse the cache when
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc
index 5950682..9a8503b5 100644
--- a/cc/layers/layer_unittest.cc
+++ b/cc/layers/layer_unittest.cc
@@ -334,14 +334,6 @@
grand_child->PushPropertiesTo(grand_child_impl.get()));
EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
- EXECUTE_AND_VERIFY_SUBTREE_CHANGED(top->SetShouldFlattenTransform(false));
- EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
- top->PushPropertiesTo(top_impl.get());
- child->PushPropertiesTo(child_impl.get());
- child2->PushPropertiesTo(child2_impl.get());
- grand_child->PushPropertiesTo(grand_child_impl.get()));
-
- EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(1);
EXECUTE_AND_VERIFY_SUBTREE_CHANGED(top->SetTrilinearFiltering(true));
EXECUTE_AND_VERIFY_SUBTREE_CHANGES_RESET(
top->PushPropertiesTo(top_impl.get());
diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc
index ece807d..21028bf 100644
--- a/cc/trees/draw_property_utils.cc
+++ b/cc/trees/draw_property_utils.cc
@@ -542,8 +542,6 @@
layer->offset_to_transform_parent().y());
gfx::Transform ssxform = tree.ToScreen(layer->transform_tree_index());
xform.ConcatTransform(ssxform);
- if (layer->should_flatten_screen_space_transform_from_property_tree())
- xform.FlattenTo2d();
return xform;
}
@@ -1233,8 +1231,6 @@
transform_tree.property_trees()->GetToTarget(
layer->transform_tree_index(), layer->render_target_effect_tree_index(),
&xform);
- if (layer->should_flatten_screen_space_transform_from_property_tree())
- xform.FlattenTo2d();
xform.Translate(layer->offset_to_transform_parent().x(),
layer->offset_to_transform_parent().y());
return xform;
diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc
index ca32cf1b..0f04b6a 100644
--- a/cc/trees/property_tree_builder.cc
+++ b/cc/trees/property_tree_builder.cc
@@ -38,7 +38,6 @@
int closest_ancestor_with_cached_render_surface;
int closest_ancestor_with_copy_request;
SkColor safe_opaque_background_color;
- bool should_flatten;
bool animation_axis_aligned_since_render_target;
bool not_axis_aligned_since_last_clip;
gfx::Transform compound_transform_since_render_target;
@@ -250,12 +249,9 @@
}
if (!requires_node) {
- data_for_children->should_flatten |= layer->should_flatten_transform();
gfx::Vector2dF local_offset = layer->position().OffsetFromOrigin() +
layer->transform().To2dTranslation();
layer->SetOffsetToTransformParent(parent_offset + local_offset);
- layer->SetShouldFlattenScreenSpaceTransformFromPropertyTree(
- data_from_ancestor.should_flatten);
layer->SetTransformTreeIndex(parent_index);
return false;
}
@@ -275,7 +271,6 @@
node->scrolls = is_scrollable;
node->should_be_snapped = is_snapped;
- node->flattens_inherited_transform = data_for_children->should_flatten;
if (is_root) {
// Root layer and page scale layer should not have transform or offset.
@@ -292,10 +287,6 @@
parent_offset + layer->position().OffsetFromOrigin();
}
- // Surfaces inherently flatten transforms.
- data_for_children->should_flatten =
- layer->should_flatten_transform() || has_surface;
-
node->has_potential_animation = has_potentially_animated_transform;
node->is_currently_animating = TransformIsAnimating(mutator_host_, layer);
GetAnimationScales(mutator_host_, layer, &node->maximum_animation_scale,
@@ -308,9 +299,6 @@
layer->SetOffsetToTransformParent(gfx::Vector2dF());
- // Flattening (if needed) will be handled by |node|.
- layer->SetShouldFlattenScreenSpaceTransformFromPropertyTree(false);
-
return true;
}
@@ -381,8 +369,7 @@
bool may_have_transparency =
layer->EffectiveOpacity() != 1.f ||
HasPotentiallyRunningOpacityAnimation(mutator_host, layer);
- if (may_have_transparency && layer->should_flatten_transform() &&
- at_least_two_layers_in_subtree_draw_content) {
+ if (may_have_transparency && at_least_two_layers_in_subtree_draw_content) {
DCHECK(!is_root);
return RenderSurfaceReason::kOpacity;
}
@@ -618,8 +605,6 @@
node.bounds = layer->bounds();
node.container_bounds = layer->scroll_container_bounds();
node.offset_to_transform_parent = layer->offset_to_transform_parent();
- node.should_flatten =
- layer->should_flatten_screen_space_transform_from_property_tree();
node.user_scrollable_horizontal = layer->GetUserScrollableHorizontal();
node.user_scrollable_vertical = layer->GetUserScrollableVertical();
node.element_id = layer->element_id();
@@ -655,10 +640,8 @@
// In addition, we need to check if (1) there might be a local 3D transform
// on the layer that might turn it to the backface, or (2) it is not drawn
// into a flattened space.
- layer->SetShouldCheckBackfaceVisibility(
- !layer->double_sided() &&
- (created_transform_node ||
- !layer->parent()->should_flatten_transform()));
+ layer->SetShouldCheckBackfaceVisibility(!layer->double_sided() &&
+ created_transform_node);
}
}
@@ -746,7 +729,6 @@
EffectTree::kInvalidNodeId;
data_for_recursion.closest_ancestor_with_copy_request =
EffectTree::kInvalidNodeId;
- data_for_recursion.should_flatten = false;
data_for_recursion.compound_transform_since_render_target = gfx::Transform();
data_for_recursion.animation_axis_aligned_since_render_target = true;
data_for_recursion.not_axis_aligned_since_last_clip = false;
diff --git a/cc/trees/property_tree_builder_unittest.cc b/cc/trees/property_tree_builder_unittest.cc
index 563f11a3..9b4a5f3 100644
--- a/cc/trees/property_tree_builder_unittest.cc
+++ b/cc/trees/property_tree_builder_unittest.cc
@@ -88,79 +88,6 @@
EXPECT_LT(node->transform_id, transform_tree_size);
}
-TEST_F(PropertyTreeBuilderTest, TransformsForFlatteningLayer) {
- // For layers that flatten their subtree, there should be an orthographic
- // projection (for x and y values) in the middle of the transform sequence.
- // Note that the way the code is currently implemented, it is not expected to
- // use a canonical orthographic projection.
-
- auto root = Layer::Create();
- host()->SetRootLayer(root);
- auto child = Layer::Create();
- root->AddChild(child);
- child->SetIsDrawable(true);
- auto grand_child = Layer::Create();
- child->AddChild(grand_child);
- grand_child->SetIsDrawable(true);
- auto great_grand_child = Layer::Create();
- grand_child->AddChild(great_grand_child);
- great_grand_child->SetIsDrawable(true);
-
- gfx::Transform rotation_about_y_axis;
- rotation_about_y_axis.RotateAboutYAxis(30.0);
-
- root->SetBounds(gfx::Size(100, 100));
- child->SetTransform(rotation_about_y_axis);
- child->SetBounds(gfx::Size(10, 10));
- child->SetForceRenderSurfaceForTesting(true);
- grand_child->SetTransform(rotation_about_y_axis);
- grand_child->SetBounds(gfx::Size(10, 10));
- great_grand_child->SetBounds(gfx::Size(10, 10));
-
- // No layers in this test should preserve 3d.
- ASSERT_TRUE(root->should_flatten_transform());
- ASSERT_TRUE(child->should_flatten_transform());
- ASSERT_TRUE(grand_child->should_flatten_transform());
- ASSERT_TRUE(great_grand_child->should_flatten_transform());
-
- gfx::Transform expected_child_draw_transform = rotation_about_y_axis;
- gfx::Transform expected_child_screen_space_transform = rotation_about_y_axis;
- gfx::Transform expected_grand_child_draw_transform =
- rotation_about_y_axis; // draws onto child's render surface
- gfx::Transform flattened_rotation_about_y = rotation_about_y_axis;
- flattened_rotation_about_y.FlattenTo2d();
- gfx::Transform expected_grand_child_screen_space_transform =
- flattened_rotation_about_y * rotation_about_y_axis;
- gfx::Transform expected_great_grand_child_draw_transform =
- flattened_rotation_about_y;
- gfx::Transform expected_great_grand_child_screen_space_transform =
- flattened_rotation_about_y * flattened_rotation_about_y;
-
- CommitAndActivate();
-
- // The child's draw transform should have been taken by its surface.
- ASSERT_TRUE(GetRenderSurfaceImpl(child));
- EXPECT_TRANSFORMATION_MATRIX_EQ(
- expected_child_draw_transform,
- GetRenderSurfaceImpl(child)->draw_transform());
- EXPECT_TRANSFORMATION_MATRIX_EQ(
- expected_child_screen_space_transform,
- GetRenderSurfaceImpl(child)->screen_space_transform());
- EXPECT_TRANSFORMATION_MATRIX_EQ(gfx::Transform(),
- ImplOf(child)->DrawTransform());
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected_child_screen_space_transform,
- ImplOf(child)->ScreenSpaceTransform());
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected_grand_child_draw_transform,
- ImplOf(grand_child)->DrawTransform());
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected_grand_child_screen_space_transform,
- ImplOf(grand_child)->ScreenSpaceTransform());
- EXPECT_TRANSFORMATION_MATRIX_EQ(expected_great_grand_child_draw_transform,
- ImplOf(great_grand_child)->DrawTransform());
- EXPECT_TRANSFORMATION_MATRIX_EQ(
- expected_great_grand_child_screen_space_transform,
- ImplOf(great_grand_child)->ScreenSpaceTransform());
-}
-
TEST_F(PropertyTreeBuilderTest, RenderSurfaceForNonAxisAlignedClipping) {
auto root = Layer::Create();
host()->SetRootLayer(root);
@@ -387,54 +314,6 @@
EXPECT_EQ(GetRenderSurfaceImpl(render_surface1), GetRenderSurfaceImpl(root));
}
-TEST_F(PropertyTreeBuilderTest, RenderSurfacesFlattenScreenSpaceTransform) {
- // Render surfaces act as a flattening point for their subtree, so should
- // always flatten the target-to-screen space transform seen by descendants.
- auto root = Layer::Create();
- host()->SetRootLayer(root);
- auto parent = Layer::Create();
- root->AddChild(parent);
- auto child = Layer::Create();
- parent->AddChild(child);
- auto grand_child = Layer::Create();
- child->AddChild(grand_child);
-
- gfx::Transform rotation_about_y_axis;
- rotation_about_y_axis.RotateAboutYAxis(30.0);
-
- root->SetBounds(gfx::Size(100, 100));
- parent->SetTransform(rotation_about_y_axis);
- parent->SetBounds(gfx::Size(10, 10));
- parent->SetForceRenderSurfaceForTesting(true);
- child->SetBounds(gfx::Size(10, 10));
- child->SetIsDrawable(true);
- grand_child->SetBounds(gfx::Size(10, 10));
- grand_child->SetIsDrawable(true);
- grand_child->SetShouldFlattenTransform(false);
-
- CommitAndActivate();
-
- EXPECT_TRUE(GetRenderSurfaceImpl(parent));
- EXPECT_EQ(GetRenderSurfaceImpl(child), GetRenderSurfaceImpl(parent));
- EXPECT_EQ(GetRenderSurfaceImpl(grand_child), GetRenderSurfaceImpl(parent));
-
- EXPECT_TRANSFORMATION_MATRIX_EQ(gfx::Transform(),
- ImplOf(child)->DrawTransform());
- EXPECT_TRANSFORMATION_MATRIX_EQ(gfx::Transform(),
- ImplOf(grand_child)->DrawTransform());
-
- // The screen-space transform inherited by |child| and |grand_child|
- // should have been flattened at their render target. In particular, the fact
- // that |grand_child| happens to preserve 3d shouldn't affect this
- // flattening.
- gfx::Transform flattened_rotation_about_y = rotation_about_y_axis;
- flattened_rotation_about_y.FlattenTo2d();
- EXPECT_TRANSFORMATION_MATRIX_EQ(flattened_rotation_about_y,
- ImplOf(child)->ScreenSpaceTransform());
- EXPECT_TRANSFORMATION_MATRIX_EQ(flattened_rotation_about_y,
- ImplOf(grand_child)->ScreenSpaceTransform());
-}
-
TEST_F(PropertyTreeBuilderTest, VisibleRectWithClippingAndFilters) {
auto root = Layer::Create();
host()->SetRootLayer(root);
@@ -753,64 +632,6 @@
EXPECT_EQ(gfx::Rect(100, 100), ImplOf(child2)->visible_layer_rect());
}
-TEST_F(PropertyTreeBuilderTest, DoNotIncludeBackfaceInvisibleSurfaces) {
- auto root = Layer::Create();
- host()->SetRootLayer(root);
- auto back_facing = Layer::Create();
- root->AddChild(back_facing);
-
- auto render_surface1 = Layer::Create();
- back_facing->AddChild(render_surface1);
- auto child1 = Layer::Create();
- render_surface1->AddChild(child1);
-
- auto flattener = Layer::Create();
- back_facing->AddChild(flattener);
- auto render_surface2 = Layer::Create();
- flattener->AddChild(render_surface2);
- auto child2 = Layer::Create();
- render_surface2->AddChild(child2);
-
- child1->SetIsDrawable(true);
- child2->SetIsDrawable(true);
-
- root->SetBounds(gfx::Size(50, 50));
- back_facing->SetBounds(gfx::Size(50, 50));
- back_facing->SetShouldFlattenTransform(false);
-
- render_surface1->SetBounds(gfx::Size(30, 30));
- render_surface1->SetShouldFlattenTransform(false);
- render_surface1->SetForceRenderSurfaceForTesting(true);
- render_surface1->SetDoubleSided(false);
- child1->SetBounds(gfx::Size(20, 20));
-
- flattener->SetBounds(gfx::Size(30, 30));
- render_surface2->SetBounds(gfx::Size(30, 30));
- render_surface2->SetShouldFlattenTransform(false);
- render_surface2->SetForceRenderSurfaceForTesting(true);
- render_surface2->SetDoubleSided(false);
- child2->SetBounds(gfx::Size(20, 20));
-
- CommitAndActivate();
-
- EXPECT_EQ(3u, GetRenderSurfaceList().size());
- EXPECT_EQ(2, GetRenderSurfaceList().at(0)->num_contributors());
- EXPECT_EQ(1, GetRenderSurfaceList().at(1)->num_contributors());
-
- gfx::Transform rotation_transform;
- rotation_transform.RotateAboutXAxis(180.0);
- back_facing->SetTransform(rotation_transform);
-
- CommitAndActivate();
-
- // render_surface1 is in the same 3d rendering context as back_facing and is
- // not double sided, so it should not be in RSLL. render_surface2 is also not
- // double-sided, but will still be in RSLL as it's in a different 3d rendering
- // context.
- EXPECT_EQ(2u, GetRenderSurfaceList().size());
- EXPECT_EQ(1, GetRenderSurfaceList().at(0)->num_contributors());
-}
-
// Verify that having animated opacity but current opacity 1 still creates
// a render surface.
TEST_F(PropertyTreeBuilderTest, AnimatedOpacityCreatesRenderSurface) {
diff --git a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc
index 49084af..76ff1483 100644
--- a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc
+++ b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc
@@ -900,8 +900,6 @@
UpdateContentsOpaque();
UpdateRasterizationPolicy();
UpdateAfterPartResize();
- UpdateShouldFlattenTransform();
- UpdateChildrenTransform();
UpdateCompositingReasons();
}
@@ -1320,10 +1318,6 @@
mask_layer_->SetDrawsContent(true);
}
-void CompositedLayerMapping::UpdateChildrenTransform() {
- UpdateShouldFlattenTransform();
-}
-
bool CompositedLayerMapping::ToggleScrollbarLayerIfNeeded(
std::unique_ptr<GraphicsLayer>& layer,
bool needs_layer,
@@ -1535,29 +1529,6 @@
f(mapping->DecorationOutlineLayer());
}
-void CompositedLayerMapping::UpdateShouldFlattenTransform() {
- // TODO(trchen): Simplify logic here.
- //
- // The code here is equivalent to applying kApplyToLayersAffectedByPreserve3D
- // layer with the computed ShouldPreserve3D() value, then disable flattening
- // on kApplyToChildContainingLayers layers if the current layer has
- // perspective transform, then again disable flattening on main layer and
- // scrolling layer if we have scrolling layer. See crbug.com/521768.
- //
- // If we toggle flattening back and forth as said above, it will result in
- // unnecessary redrawing because the compositor doesn't have delayed
- // invalidation for this flag. See crbug.com/783614.
- bool is_flat = !owning_layer_.ShouldPreserve3D();
-
- if (GraphicsLayer* layer = ScrollingLayer())
- layer->SetShouldFlattenTransform(false);
- graphics_layer_->SetShouldFlattenTransform(is_flat && !HasScrollingLayer());
- if (GraphicsLayer* layer = ScrollingContentsLayer())
- layer->SetShouldFlattenTransform(is_flat);
- if (GraphicsLayer* layer = ForegroundLayer())
- layer->SetShouldFlattenTransform(is_flat);
-}
-
struct AnimatingData {
STACK_ALLOCATED();
@@ -1710,7 +1681,6 @@
if (!squashing_containment_layer_) {
squashing_containment_layer_ =
CreateGraphicsLayer(CompositingReason::kLayerForSquashingContainer);
- squashing_containment_layer_->SetShouldFlattenTransform(false);
layers_changed = true;
}
DCHECK(squashing_layer_);
diff --git a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h
index dc151f2..4f3974d 100644
--- a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h
+++ b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h
@@ -168,7 +168,6 @@
void FinishAccumulatingSquashingLayers(
wtf_size_t next_squashed_layer_index,
Vector<PaintLayer*>& layers_needing_paint_invalidation);
- void UpdateShouldFlattenTransform();
void UpdateElementId();
// GraphicsLayerClient interface
@@ -367,7 +366,6 @@
bool UpdateScrollingLayers(bool scrolling_layers);
bool UpdateSquashingLayers(bool needs_squashing_layers);
void UpdateDrawsContentAndPaintsHitTest();
- void UpdateChildrenTransform();
void UpdateCompositedBounds();
void UpdateSnapContainerData();
diff --git a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc
index daddc94..e4946a2 100644
--- a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc
+++ b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc
@@ -34,10 +34,6 @@
.ComputeInterestRect(graphics_layer, previous_interest_rect);
}
- bool ShouldFlattenTransform(const GraphicsLayer& layer) const {
- return layer.ShouldFlattenTransform();
- }
-
bool InterestRectChangedEnoughToRepaint(const IntRect& previous_interest_rect,
const IntRect& new_interest_rect,
const IntSize& layer_size) {
@@ -520,31 +516,6 @@
RecomputeInterestRect(paint_layer->GraphicsLayerBacking()));
}
-TEST_F(CompositedLayerMappingTest, ScrollContentsFlattenForScroller) {
- SetBodyInnerHTML(R"HTML(
- <style>div::-webkit-scrollbar{ width: 5px; }</style>
- <div id='scroller' style='width: 100px; height: 100px; overflow:
- scroll; will-change: transform'>
- <div style='width: 1000px; height: 1000px;'>Foo</div>Foo</div>
- )HTML");
-
- UpdateAllLifecyclePhasesForTest();
- Element* element = GetDocument().getElementById("scroller");
- PaintLayer* paint_layer =
- ToLayoutBoxModelObject(element->GetLayoutObject())->Layer();
- CompositedLayerMapping* composited_layer_mapping =
- paint_layer->GetCompositedLayerMapping();
-
- ASSERT_TRUE(composited_layer_mapping);
-
- EXPECT_FALSE(
- ShouldFlattenTransform(*composited_layer_mapping->MainGraphicsLayer()));
- EXPECT_FALSE(
- ShouldFlattenTransform(*composited_layer_mapping->ScrollingLayer()));
- EXPECT_TRUE(ShouldFlattenTransform(
- *composited_layer_mapping->ScrollingContentsLayer()));
-}
-
TEST_F(CompositedLayerMappingTest, InterestRectChangedEnoughToRepaintEmpty) {
IntSize layer_size(1000, 1000);
// Both empty means there is nothing to do.
diff --git a/third_party/blink/renderer/platform/animation/animated_layers_test.cc b/third_party/blink/renderer/platform/animation/animated_layers_test.cc
index 4ed2a36..10a1866 100644
--- a/third_party/blink/renderer/platform/animation/animated_layers_test.cc
+++ b/third_party/blink/renderer/platform/animation/animated_layers_test.cc
@@ -46,68 +46,4 @@
std::unique_ptr<CompositorAnimation> compositor_animation_;
};
-// TODO(bokan): This test doesn't yet work because cc::Layers can't set an
-// element id in that mode. We fail at AttachElement since the element id is
-// invalid. https://crbug.com/993386.
-TEST_F(AnimatedLayersTest,
- DISABLED_updateLayerShouldFlattenTransformWithAnimations) {
- cc::Layer* cc_layer = layers_.graphics_layer().CcLayer();
- cc::MutatorHost* mutator = layers_.layer_tree_host()->mutator_host();
- EXPECT_FALSE(
- mutator->HasTickingKeyframeModelForTesting(cc_layer->element_id()));
-
- auto curve = std::make_unique<CompositorFloatAnimationCurve>();
- curve->AddKeyframe(
- CompositorFloatKeyframe(0.0, 0.0,
- *CubicBezierTimingFunction::Preset(
- CubicBezierTimingFunction::EaseType::EASE)));
- auto float_keyframe_model(std::make_unique<CompositorKeyframeModel>(
- *curve, compositor_target_property::OPACITY, 0, 0));
- int keyframe_model_id = float_keyframe_model->Id();
-
- auto compositor_timeline = std::make_unique<CompositorAnimationTimeline>();
- AnimationForTesting animation;
-
- cc::AnimationHost* host = layers_.animation_host();
-
- host->AddAnimationTimeline(compositor_timeline->GetAnimationTimeline());
- compositor_timeline->AnimationAttached(animation);
-
- cc_layer->SetElementId(CompositorElementId(cc_layer->id()));
-
- animation.GetCompositorAnimation()->AttachElement(cc_layer->element_id());
- ASSERT_TRUE(animation.GetCompositorAnimation()->IsElementAttached());
-
- animation.GetCompositorAnimation()->AddKeyframeModel(
- std::move(float_keyframe_model));
-
- EXPECT_TRUE(
- mutator->HasTickingKeyframeModelForTesting(cc_layer->element_id()));
-
- layers_.graphics_layer().SetShouldFlattenTransform(false);
-
- cc_layer = layers_.graphics_layer().CcLayer();
- ASSERT_TRUE(cc_layer);
-
- EXPECT_TRUE(
- mutator->HasTickingKeyframeModelForTesting(cc_layer->element_id()));
- animation.GetCompositorAnimation()->RemoveKeyframeModel(keyframe_model_id);
- EXPECT_FALSE(
- mutator->HasTickingKeyframeModelForTesting(cc_layer->element_id()));
-
- layers_.graphics_layer().SetShouldFlattenTransform(true);
-
- cc_layer = layers_.graphics_layer().CcLayer();
- ASSERT_TRUE(cc_layer);
-
- EXPECT_FALSE(
- mutator->HasTickingKeyframeModelForTesting(cc_layer->element_id()));
-
- animation.GetCompositorAnimation()->DetachElement();
- ASSERT_FALSE(animation.GetCompositorAnimation()->IsElementAttached());
-
- compositor_timeline->AnimationDestroyed(animation);
- host->RemoveAnimationTimeline(compositor_timeline->GetAnimationTimeline());
-}
-
} // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/graphics_layer.cc b/third_party/blink/renderer/platform/graphics/graphics_layer.cc
index ad22b97..9a3febb 100644
--- a/third_party/blink/renderer/platform/graphics/graphics_layer.cc
+++ b/third_party/blink/renderer/platform/graphics/graphics_layer.cc
@@ -599,13 +599,6 @@
return CcLayer()->transform_origin();
}
-bool GraphicsLayer::ShouldFlattenTransform() const {
- return CcLayer()->should_flatten_transform();
-}
-
-void GraphicsLayer::SetShouldFlattenTransform(bool should_flatten) {
- CcLayer()->SetShouldFlattenTransform(should_flatten);
-}
bool GraphicsLayer::MasksToBounds() const {
return CcLayer()->masks_to_bounds();
diff --git a/third_party/blink/renderer/platform/graphics/graphics_layer.h b/third_party/blink/renderer/platform/graphics/graphics_layer.h
index c3b167bd..4b8e7ab 100644
--- a/third_party/blink/renderer/platform/graphics/graphics_layer.h
+++ b/third_party/blink/renderer/platform/graphics/graphics_layer.h
@@ -134,8 +134,6 @@
const TransformationMatrix& Transform() const { return transform_; }
void SetTransform(const TransformationMatrix&);
- bool ShouldFlattenTransform() const;
- void SetShouldFlattenTransform(bool);
void SetRenderingContext(int id);
bool MasksToBounds() const;