summaryrefslogtreecommitdiffstats
path: root/cc/trees
diff options
context:
space:
mode:
Diffstat (limited to 'cc/trees')
-rw-r--r--cc/trees/damage_tracker_unittest.cc30
-rw-r--r--cc/trees/layer_tree_host_common.cc118
-rw-r--r--cc/trees/layer_tree_host_common.h8
-rw-r--r--cc/trees/layer_tree_host_common_unittest.cc389
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc114
-rw-r--r--cc/trees/layer_tree_host_unittest.cc12
-rw-r--r--cc/trees/layer_tree_impl_unittest.cc578
-rw-r--r--cc/trees/occlusion_tracker_unittest.cc28
8 files changed, 493 insertions, 784 deletions
diff --git a/cc/trees/damage_tracker_unittest.cc b/cc/trees/damage_tracker_unittest.cc
index 90b5b8a..95609d3 100644
--- a/cc/trees/damage_tracker_unittest.cc
+++ b/cc/trees/damage_tracker_unittest.cc
@@ -86,7 +86,7 @@ class DamageTrackerTest : public testing::Test {
root->SetBounds(gfx::Size(500, 500));
root->SetContentBounds(gfx::Size(500, 500));
root->SetDrawsContent(true);
- root->CreateRenderSurface();
+ root->SetHasRenderSurface(true);
root->render_surface()->SetContentRect(gfx::Rect(0, 0, 500, 500));
child->SetPosition(gfx::PointF(100.f, 100.f));
@@ -118,7 +118,7 @@ class DamageTrackerTest : public testing::Test {
root->SetBounds(gfx::Size(500, 500));
root->SetContentBounds(gfx::Size(500, 500));
root->SetDrawsContent(true);
- root->CreateRenderSurface();
+ root->SetHasRenderSurface(true);
root->render_surface()->SetContentRect(gfx::Rect(0, 0, 500, 500));
child1->SetPosition(gfx::PointF(100.f, 100.f));
@@ -126,11 +126,9 @@ class DamageTrackerTest : public testing::Test {
child1->SetContentBounds(gfx::Size(30, 30));
// With a child that draws_content, opacity will cause the layer to create
// its own RenderSurface. This layer does not draw, but is intended to
- // create its own RenderSurface. TODO: setting opacity and
- // ForceRenderSurface may be redundant here.
- child1->SetOpacity(0.5f);
+ // create its own RenderSurface.
child1->SetDrawsContent(false);
- child1->SetForceRenderSurface(true);
+ child1->SetHasRenderSurface(true);
child2->SetPosition(gfx::PointF(11.f, 11.f));
child2->SetBounds(gfx::Size(18, 18));
@@ -542,6 +540,7 @@ TEST_F(DamageTrackerTest, VerifyDamageForImageFilter) {
// Setting the filter will damage the whole surface.
ClearDamageForAllSurfaces(root.get());
+ child->SetHasRenderSurface(true);
child->SetFilters(filters);
EmulateDrawingOneFrame(root.get());
root_damage_rect =
@@ -926,8 +925,7 @@ TEST_F(DamageTrackerTest, VerifyDamageForAddingAndRemovingRenderSurfaces) {
// CASE 1: If a descendant surface disappears, its entire old area becomes
// exposed.
ClearDamageForAllSurfaces(root.get());
- child1->SetOpacity(1.f);
- child1->SetForceRenderSurface(false);
+ child1->SetHasRenderSurface(false);
EmulateDrawingOneFrame(root.get());
// Sanity check that there is only one surface now.
@@ -952,8 +950,8 @@ TEST_F(DamageTrackerTest, VerifyDamageForAddingAndRemovingRenderSurfaces) {
// Then change the tree so that the render surface is added back.
ClearDamageForAllSurfaces(root.get());
- child1->SetOpacity(0.5f);
- child1->SetForceRenderSurface(true);
+ child1->SetHasRenderSurface(true);
+
EmulateDrawingOneFrame(root.get());
// Sanity check that there is a new surface now.
@@ -1056,6 +1054,7 @@ TEST_F(DamageTrackerTest, VerifyDamageForReplica) {
reflection.Scale3d(-1.0, 1.0, 1.0);
grand_child1_replica->SetTransform(reflection);
grand_child1->SetReplicaLayer(grand_child1_replica.Pass());
+ grand_child1->SetHasRenderSurface(true);
}
EmulateDrawingOneFrame(root.get());
@@ -1106,6 +1105,7 @@ TEST_F(DamageTrackerTest, VerifyDamageForReplica) {
// reflection to damage the target surface.
ClearDamageForAllSurfaces(root.get());
grand_child1->SetReplicaLayer(nullptr);
+ grand_child1->SetHasRenderSurface(false);
EmulateDrawingOneFrame(root.get());
ASSERT_EQ(old_content_rect.width(),
child1->render_surface()->content_rect().width());
@@ -1140,12 +1140,12 @@ TEST_F(DamageTrackerTest, VerifyDamageForMask) {
mask_layer->SetBounds(child->bounds());
mask_layer->SetContentBounds(child->bounds());
child->SetMaskLayer(mask_layer.Pass());
+ child->SetHasRenderSurface(true);
}
LayerImpl* mask_layer = child->mask_layer();
// Add opacity and a grand_child so that the render surface persists even
// after we remove the mask.
- child->SetOpacity(0.5f);
{
scoped_ptr<LayerImpl> grand_child =
LayerImpl::Create(host_impl_.active_tree(), 4);
@@ -1157,9 +1157,6 @@ TEST_F(DamageTrackerTest, VerifyDamageForMask) {
}
EmulateDrawingOneFrame(root.get());
- // Sanity check that a new surface was created for the child.
- ASSERT_TRUE(child->render_surface());
-
// CASE 1: the update_rect on a mask layer should damage the entire target
// surface.
ClearDamageForAllSurfaces(root.get());
@@ -1233,6 +1230,7 @@ TEST_F(DamageTrackerTest, VerifyDamageForReplicaMask) {
reflection.Scale3d(-1.0, 1.0, 1.0);
grand_child1_replica->SetTransform(reflection);
grand_child1->SetReplicaLayer(grand_child1_replica.Pass());
+ grand_child1->SetHasRenderSurface(true);
}
LayerImpl* grand_child1_replica = grand_child1->replica_layer();
@@ -1310,6 +1308,7 @@ TEST_F(DamageTrackerTest, VerifyDamageForReplicaMaskWithTransformOrigin) {
reflection.Scale3d(-1.0, 1.0, 1.0);
grand_child1_replica->SetTransform(reflection);
grand_child1->SetReplicaLayer(grand_child1_replica.Pass());
+ grand_child1->SetHasRenderSurface(true);
}
LayerImpl* grand_child1_replica = grand_child1->replica_layer();
@@ -1377,7 +1376,8 @@ TEST_F(DamageTrackerTest, VerifyDamageForEmptyLayerList) {
// tracker does not crash when it receives an empty layer_list.
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_.active_tree(), 1);
- root->CreateRenderSurface();
+ root->SetHasRenderSurface(true);
+ root->draw_properties().render_target = root.get();
ASSERT_TRUE(root == root->render_target());
RenderSurfaceImpl* target_surface = root->render_surface();
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 2022f46..b33d633 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -553,9 +553,8 @@ static inline void SavePaintPropertiesLayer(Layer* layer) {
layer->replica_layer()->mask_layer()->SavePaintProperties();
}
-template <typename LayerType>
static bool SubtreeShouldRenderToSeparateSurface(
- LayerType* layer,
+ Layer* layer,
bool axis_aligned_with_respect_to_parent) {
//
// A layer and its descendants should render onto a new RenderSurfaceImpl if
@@ -1111,18 +1110,6 @@ static inline void CalculateAnimationContentsScale(
std::max(ancestor_transform_scales.x(), ancestor_transform_scales.y());
}
-template <typename LayerType>
-static inline typename LayerType::RenderSurfaceType* CreateOrReuseRenderSurface(
- LayerType* layer) {
- if (!layer->render_surface()) {
- layer->CreateRenderSurface();
- return layer->render_surface();
- }
-
- layer->render_surface()->ClearLayerLists();
- return layer->render_surface();
-}
-
template <typename LayerTypePtr>
static inline void MarkLayerWithRenderSurfaceLayerListId(
LayerTypePtr layer,
@@ -1206,12 +1193,29 @@ struct PreCalculateMetaInformationRecursiveData {
}
};
+static bool ValidateRenderSurface(LayerImpl* layer) {
+ // There are a few cases in which it is incorrect to not have a
+ // render_surface.
+ if (layer->render_surface())
+ return true;
+
+ return layer->filters().IsEmpty() && layer->background_filters().IsEmpty() &&
+ !layer->mask_layer() && !layer->replica_layer() &&
+ !IsRootLayer(layer) && !layer->is_root_for_isolated_group() &&
+ !layer->HasCopyRequest();
+}
+
+static bool ValidateRenderSurface(Layer* layer) {
+ return true;
+}
+
// Recursively walks the layer tree to compute any information that is needed
// before doing the main recursion.
template <typename LayerType>
static void PreCalculateMetaInformation(
LayerType* layer,
PreCalculateMetaInformationRecursiveData* recursive_data) {
+ DCHECK(ValidateRenderSurface(layer));
layer->draw_properties().sorted_for_recursion = false;
layer->draw_properties().has_child_with_a_scroll_parent = false;
@@ -1609,6 +1613,7 @@ static void CalculateDrawPropertiesInternal(
if (!IsRootLayer(layer) && SubtreeShouldBeSkipped(layer, layer_is_drawn)) {
if (layer->render_surface())
layer->ClearRenderSurfaceLayerList();
+ layer->draw_properties().render_target = nullptr;
return;
}
@@ -1834,28 +1839,26 @@ static void CalculateDrawPropertiesInternal(
? combined_transform_scales
: gfx::Vector2dF(layer_scale_factors, layer_scale_factors);
- bool render_to_separate_surface;
- if (globals.can_render_to_separate_surface) {
- render_to_separate_surface = SubtreeShouldRenderToSeparateSurface(
- layer, combined_transform.Preserves2dAxisAlignment());
- } else {
- render_to_separate_surface = IsRootLayer(layer);
- }
-
- layer->SetHasRenderSurface(render_to_separate_surface);
+ bool render_to_separate_surface =
+ IsRootLayer(layer) ||
+ (globals.can_render_to_separate_surface && layer->render_surface());
if (render_to_separate_surface) {
+ DCHECK(layer->render_surface());
// Check back-face visibility before continuing with this surface and its
// subtree
if (!layer->double_sided() && TransformToParentIsKnown(layer) &&
IsSurfaceBackFaceVisible(layer, combined_transform)) {
layer->ClearRenderSurfaceLayerList();
+ layer->draw_properties().render_target = nullptr;
return;
}
typename LayerType::RenderSurfaceType* render_surface =
- CreateOrReuseRenderSurface(layer);
+ layer->render_surface();
+ layer->ClearRenderSurfaceLayerList();
+ layer_draw_properties.render_target = layer;
if (IsRootLayer(layer)) {
// The root layer's render surface size is predetermined and so the root
// layer can't directly support non-identity transforms. It should just
@@ -2035,8 +2038,6 @@ static void CalculateDrawPropertiesInternal(
animating_opacity_to_screen;
data_for_children.parent_matrix = combined_transform;
- layer->ClearRenderSurface();
-
// Layers without render_surfaces directly inherit the ancestor's clip
// status.
layer_or_ancestor_clips_descendants = ancestor_clips_subtree;
@@ -2077,7 +2078,7 @@ static void CalculateDrawPropertiesInternal(
if (LayerClipsSubtree(layer)) {
layer_or_ancestor_clips_descendants = true;
- if (ancestor_clips_subtree && !layer->render_surface()) {
+ if (ancestor_clips_subtree && !render_to_separate_surface) {
// A layer without render surface shares the same target as its ancestor.
clip_rect_in_target_space =
ancestor_clip_rect_in_target_space;
@@ -2102,8 +2103,8 @@ static void CalculateDrawPropertiesInternal(
}
typename LayerType::LayerListType& descendants =
- (layer->render_surface() ? layer->render_surface()->layer_list()
- : *layer_list);
+ (render_to_separate_surface ? layer->render_surface()->layer_list()
+ : *layer_list);
// Any layers that are appended after this point are in the layer's subtree
// and should be included in the sorting process.
@@ -2185,7 +2186,8 @@ static void CalculateDrawPropertiesInternal(
&descendants,
accumulated_surface_state,
current_render_surface_layer_list_id);
- if (child->render_surface() &&
+ // If the child is its own render target, then it has a render surface.
+ if (child->render_target() == child &&
!child->render_surface()->layer_list().empty() &&
!child->render_surface()->content_rect().IsEmpty()) {
// This child will contribute its render surface, which means
@@ -2224,12 +2226,12 @@ static void CalculateDrawPropertiesInternal(
// target surface space).
gfx::Rect local_drawable_content_rect_of_subtree =
accumulated_surface_state->back().drawable_content_rect;
- if (layer->render_surface()) {
+ if (render_to_separate_surface) {
DCHECK(accumulated_surface_state->back().render_target == layer);
accumulated_surface_state->pop_back();
}
- if (layer->render_surface() && !IsRootLayer(layer) &&
+ if (render_to_separate_surface && !IsRootLayer(layer) &&
layer->render_surface()->layer_list().empty()) {
RemoveSurfaceForEarlyExit(layer, render_surface_layer_list);
return;
@@ -2255,10 +2257,10 @@ static void CalculateDrawPropertiesInternal(
// one.
if (IsRootLayer(layer)) {
// The root layer's surface's content_rect is always the entire viewport.
- DCHECK(layer->render_surface());
+ DCHECK(render_to_separate_surface);
layer->render_surface()->SetContentRect(
ancestor_clip_rect_in_target_space);
- } else if (layer->render_surface()) {
+ } else if (render_to_separate_surface) {
typename LayerType::RenderSurfaceType* render_surface =
layer->render_surface();
gfx::Rect clipped_content_rect = local_drawable_content_rect_of_subtree;
@@ -2352,7 +2354,7 @@ static void CalculateDrawPropertiesInternal(
// If neither this layer nor any of its children were added, early out.
if (sorting_start_index == descendants.size()) {
- DCHECK(!layer->render_surface() || IsRootLayer(layer));
+ DCHECK(!render_to_separate_surface || IsRootLayer(layer));
return;
}
@@ -2435,6 +2437,49 @@ static void ProcessCalcDrawPropsInputs(
data_for_recursion->subtree_is_visible_from_ancestor = true;
}
+void LayerTreeHostCommon::UpdateRenderSurface(
+ Layer* layer,
+ bool can_render_to_separate_surface,
+ gfx::Transform* transform,
+ bool* draw_transform_is_axis_aligned) {
+ bool preserves_2d_axis_alignment =
+ transform->Preserves2dAxisAlignment() && *draw_transform_is_axis_aligned;
+ if (IsRootLayer(layer) || (can_render_to_separate_surface &&
+ SubtreeShouldRenderToSeparateSurface(
+ layer, preserves_2d_axis_alignment))) {
+ // We reset the transform here so that any axis-changing transforms
+ // will now be relative to this RenderSurface.
+ transform->MakeIdentity();
+ *draw_transform_is_axis_aligned = true;
+ if (!layer->render_surface()) {
+ layer->CreateRenderSurface();
+ }
+ layer->SetHasRenderSurface(true);
+ return;
+ }
+ layer->SetHasRenderSurface(false);
+ if (layer->render_surface())
+ layer->ClearRenderSurface();
+}
+
+void LayerTreeHostCommon::UpdateRenderSurfaces(
+ Layer* layer,
+ bool can_render_to_separate_surface,
+ const gfx::Transform& parent_transform,
+ bool draw_transform_is_axis_aligned) {
+ gfx::Transform transform_for_children = layer->transform();
+ transform_for_children *= parent_transform;
+ draw_transform_is_axis_aligned &= layer->AnimationsPreserveAxisAlignment();
+ UpdateRenderSurface(layer, can_render_to_separate_surface,
+ &transform_for_children, &draw_transform_is_axis_aligned);
+
+ for (size_t i = 0; i < layer->children().size(); ++i) {
+ UpdateRenderSurfaces(layer->children()[i].get(),
+ can_render_to_separate_surface, transform_for_children,
+ draw_transform_is_axis_aligned);
+ }
+}
+
static bool ApproximatelyEqual(const gfx::Rect& r1, const gfx::Rect& r2) {
static const int tolerance = 1;
return std::abs(r1.x() - r2.x()) <= tolerance &&
@@ -2445,6 +2490,9 @@ static bool ApproximatelyEqual(const gfx::Rect& r1, const gfx::Rect& r2) {
void LayerTreeHostCommon::CalculateDrawProperties(
CalcDrawPropsMainInputs* inputs) {
+ UpdateRenderSurfaces(inputs->root_layer,
+ inputs->can_render_to_separate_surface, gfx::Transform(),
+ false);
LayerList dummy_layer_list;
SubtreeGlobals<Layer> globals;
DataForRecursion<Layer> data_for_recursion;
diff --git a/cc/trees/layer_tree_host_common.h b/cc/trees/layer_tree_host_common.h
index 678ed75..0955b9a 100644
--- a/cc/trees/layer_tree_host_common.h
+++ b/cc/trees/layer_tree_host_common.h
@@ -106,6 +106,14 @@ class CC_EXPORT LayerTreeHostCommon {
CalcDrawPropsMainInputs;
typedef CalcDrawPropsInputsForTesting<Layer, RenderSurfaceLayerList>
CalcDrawPropsMainInputsForTesting;
+ static void UpdateRenderSurfaces(Layer* root_layer,
+ bool can_render_to_separate_surface,
+ const gfx::Transform& transform,
+ bool preserves_2d_axis_alignment);
+ static void UpdateRenderSurface(Layer* layer,
+ bool can_render_to_separate_surface,
+ gfx::Transform* transform,
+ bool* animation_preserves_axis_alignment);
static void CalculateDrawProperties(CalcDrawPropsMainInputs* inputs);
typedef CalcDrawPropsInputs<LayerImpl, LayerImplList> CalcDrawPropsImplInputs;
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 6581a71..72eb287 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -323,23 +323,15 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
LayerImpl* sublayer = sublayer_scoped_ptr.get();
sublayer->SetContentsScale(kPageScale * kDeviceScale,
kPageScale * kDeviceScale);
- SetLayerPropertiesForTesting(sublayer,
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(500, 500),
- true,
+ SetLayerPropertiesForTesting(sublayer, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(500, 500), true, false,
false);
scoped_ptr<LayerImpl> scroll_layer_scoped_ptr(
LayerImpl::Create(host_impl.active_tree(), 2));
LayerImpl* scroll_layer = scroll_layer_scoped_ptr.get();
- SetLayerPropertiesForTesting(scroll_layer,
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(10, 20),
- true,
+ SetLayerPropertiesForTesting(scroll_layer, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(10, 20), true, false,
false);
scoped_ptr<LayerImpl> clip_layer_scoped_ptr(
LayerImpl::Create(host_impl.active_tree(), 4));
@@ -358,14 +350,11 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
scroll_layer_raw_ptr->SetScrollOffset(kScrollOffset);
scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3));
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(3, 4),
- true,
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(3, 4), true, false,
false);
root->AddChild(clip_layer_scoped_ptr.Pass());
+ root->SetHasRenderSurface(true);
ExecuteCalculateDrawProperties(
root.get(), kDeviceScale, kPageScale, scroll_layer->parent());
@@ -383,13 +372,9 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) {
const float kTranslateX = 10.6f;
const float kTranslateY = 20.6f;
arbitrary_translate.Translate(kTranslateX, kTranslateY);
- SetLayerPropertiesForTesting(scroll_layer,
- arbitrary_translate,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(10, 20),
- true,
- false);
+ SetLayerPropertiesForTesting(scroll_layer, arbitrary_translate,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(10, 20),
+ true, false, false);
ExecuteCalculateDrawProperties(
root.get(), kDeviceScale, kPageScale, scroll_layer->parent());
expected_transform.MakeIdentity();
@@ -3794,11 +3779,13 @@ TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithPreserves3d) {
inputs.can_adjust_raster_scales = true;
LayerTreeHostCommon::CalculateDrawProperties(&inputs);
- // Verify which render surfaces were created.
+ // Verify which render surfaces were created and used.
EXPECT_FALSE(front_facing_child->render_surface());
EXPECT_FALSE(back_facing_child->render_surface());
EXPECT_TRUE(front_facing_surface->render_surface());
- EXPECT_FALSE(back_facing_surface->render_surface());
+ EXPECT_NE(back_facing_surface->render_target(), back_facing_surface);
+ // We expect that a render_surface was created but not used.
+ EXPECT_TRUE(back_facing_surface->render_surface());
EXPECT_FALSE(front_facing_child_of_front_facing_surface->render_surface());
EXPECT_FALSE(back_facing_child_of_front_facing_surface->render_surface());
EXPECT_FALSE(front_facing_child_of_back_facing_surface->render_surface());
@@ -4062,10 +4049,13 @@ TEST_F(LayerTreeHostCommonTest,
inputs.can_adjust_raster_scales = true;
LayerTreeHostCommon::CalculateDrawProperties(&inputs);
- // Verify which render surfaces were created.
+ // Verify which render surfaces were created and used.
EXPECT_TRUE(front_facing_surface->render_surface());
- EXPECT_FALSE(
- back_facing_surface->render_surface()); // because it should be culled
+
+ // We expect the render surface to have been created, but remain unused.
+ EXPECT_TRUE(back_facing_surface->render_surface());
+ EXPECT_NE(back_facing_surface->render_target(),
+ back_facing_surface); // because it should be culled
EXPECT_FALSE(child1->render_surface());
EXPECT_FALSE(child2->render_surface());
@@ -5646,22 +5636,14 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
const gfx::Transform identity_matrix;
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(100, 100),
- true,
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(100, 100), true, false,
false);
root->SetDrawsContent(true);
scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2);
- SetLayerPropertiesForTesting(child.get(),
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(50, 50),
- true,
+ SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(50, 50), true, false,
false);
child->SetDrawsContent(true);
child->SetOpacity(0.0f);
@@ -5671,6 +5653,7 @@ TEST_F(LayerTreeHostCommonTest, OpacityAnimatingOnPendingTree) {
child->layer_animation_controller(), 10.0, 0.0f, 1.0f, false);
root->AddChild(child.Pass());
+ root->SetHasRenderSurface(true);
LayerImplList render_surface_layer_list;
LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
@@ -5933,39 +5916,28 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_SingleLayerImpl) {
const gfx::Transform identity_matrix;
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(50, 50),
- true,
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(50, 50), true, false,
false);
root->SetDrawsContent(true);
scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2);
- SetLayerPropertiesForTesting(child.get(),
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(40, 40),
- true,
+ SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(40, 40), true, false,
false);
child->SetDrawsContent(true);
scoped_ptr<LayerImpl> grand_child =
LayerImpl::Create(host_impl.pending_tree(), 3);
- SetLayerPropertiesForTesting(grand_child.get(),
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(30, 30),
- true,
- false);
+ SetLayerPropertiesForTesting(grand_child.get(), identity_matrix,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
+ true, false, false);
grand_child->SetDrawsContent(true);
grand_child->SetHideLayerAndSubtree(true);
child->AddChild(grand_child.Pass());
root->AddChild(child.Pass());
+ root->SetHasRenderSurface(true);
LayerImplList render_surface_layer_list;
LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
@@ -6046,35 +6018,23 @@ TEST_F(LayerTreeHostCommonTest, SubtreeHidden_TwoLayersImpl) {
const gfx::Transform identity_matrix;
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.pending_tree(), 1);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(50, 50),
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(50, 50), true, false,
+ true);
root->SetDrawsContent(true);
scoped_ptr<LayerImpl> child = LayerImpl::Create(host_impl.pending_tree(), 2);
- SetLayerPropertiesForTesting(child.get(),
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(40, 40),
- true,
+ SetLayerPropertiesForTesting(child.get(), identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(40, 40), true, false,
false);
child->SetDrawsContent(true);
child->SetHideLayerAndSubtree(true);
scoped_ptr<LayerImpl> grand_child =
LayerImpl::Create(host_impl.pending_tree(), 3);
- SetLayerPropertiesForTesting(grand_child.get(),
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(30, 30),
- true,
- false);
+ SetLayerPropertiesForTesting(grand_child.get(), identity_matrix,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
+ true, false, false);
grand_child->SetDrawsContent(true);
child->AddChild(grand_child.Pass());
@@ -6945,40 +6905,20 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) {
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, true);
root->SetDrawsContent(true);
// This layer structure normally forces render surface due to preserves3d
// behavior.
- SetLayerPropertiesForTesting(child1.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- false,
- true);
+ SetLayerPropertiesForTesting(child1.get(), identity_matrix, transform_origin,
+ position, bounds, false, true, true);
child1->SetDrawsContent(true);
- SetLayerPropertiesForTesting(child2.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(child2.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, false);
child2->SetDrawsContent(true);
- SetLayerPropertiesForTesting(child3.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(child3.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, false);
child3->SetDrawsContent(true);
child2->Set3dSortingContextId(1);
@@ -7620,55 +7560,27 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) {
gfx::Transform bottom_transform;
bottom_transform.Translate3d(0.0, 0.0, 3.0);
- SetLayerPropertiesForTesting(root.get(),
- identity_transform,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(50, 50),
- true,
- false);
- SetLayerPropertiesForTesting(scroll_parent_border.get(),
- identity_transform,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(40, 40),
- true,
- false);
- SetLayerPropertiesForTesting(scroll_parent_clip.get(),
- identity_transform,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(30, 30),
- true,
- false);
- SetLayerPropertiesForTesting(scroll_parent.get(),
- identity_transform,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(50, 50),
- true,
- false);
- SetLayerPropertiesForTesting(scroll_child.get(),
- identity_transform,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(50, 50),
- true,
- false);
- SetLayerPropertiesForTesting(top_content.get(),
- top_transform,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(50, 50),
- false,
+ SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(50, 50), true, false,
true);
- SetLayerPropertiesForTesting(bottom_content.get(),
- bottom_transform,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(50, 50),
- false,
+ SetLayerPropertiesForTesting(scroll_parent_border.get(), identity_transform,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(40, 40),
+ true, false, false);
+ SetLayerPropertiesForTesting(scroll_parent_clip.get(), identity_transform,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(30, 30),
+ true, false, false);
+ SetLayerPropertiesForTesting(scroll_parent.get(), identity_transform,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50),
+ true, false, false);
+ SetLayerPropertiesForTesting(scroll_child.get(), identity_transform,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50),
+ true, false, false);
+ SetLayerPropertiesForTesting(top_content.get(), top_transform, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(50, 50), false, true,
true);
+ SetLayerPropertiesForTesting(bottom_content.get(), bottom_transform,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50),
+ false, true, true);
scroll_child->SetShouldFlattenTransform(false);
scroll_child->Set3dSortingContextId(1);
@@ -7738,33 +7650,17 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) {
container_transform.Translate3d(10.0, 20.0, 0.0);
gfx::Vector2dF container_offset = container_transform.To2dTranslation();
- SetLayerPropertiesForTesting(root.get(),
- identity_transform,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(50, 50),
- true,
- false);
- SetLayerPropertiesForTesting(container.get(),
- container_transform,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(40, 40),
- true,
- false);
- SetLayerPropertiesForTesting(scroller.get(),
- identity_transform,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(30, 30),
- true,
- false);
- SetLayerPropertiesForTesting(fixed.get(),
- identity_transform,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(50, 50),
- true,
+ SetLayerPropertiesForTesting(root.get(), 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(), gfx::Size(30, 30),
+ true, false, false);
+ SetLayerPropertiesForTesting(fixed.get(), identity_transform, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(50, 50), true, false,
false);
scroller->AddChild(fixed.Pass());
@@ -7902,33 +7798,18 @@ TEST_F(LayerTreeHostCommonTest, MaximumAnimationScaleFactor) {
parent->AddChild(child.Pass());
grand_parent->AddChild(parent.Pass());
- SetLayerPropertiesForTesting(grand_parent.get(),
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(1, 2),
- true,
+ SetLayerPropertiesForTesting(grand_parent.get(), identity_matrix,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(1, 2),
+ true, false, true);
+ SetLayerPropertiesForTesting(parent_raw, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(1, 2), true, false,
false);
- SetLayerPropertiesForTesting(parent_raw,
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(1, 2),
- true,
- false);
- SetLayerPropertiesForTesting(child_raw,
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(1, 2),
- true,
+ SetLayerPropertiesForTesting(child_raw, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(1, 2), true, false,
false);
- SetLayerPropertiesForTesting(grand_child_raw,
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(1, 2),
- true,
+
+ SetLayerPropertiesForTesting(grand_child_raw, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(1, 2), true, false,
false);
ExecuteCalculateDrawProperties(grand_parent.get());
@@ -8138,42 +8019,25 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
parent->AddChild(child.Pass());
grand_parent->AddChild(parent.Pass());
- SetLayerPropertiesForTesting(grand_parent_raw,
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(1, 2),
- true,
- false);
- SetLayerPropertiesForTesting(parent_raw,
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(1, 2),
- true,
- false);
- SetLayerPropertiesForTesting(child_raw,
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(1, 2),
- true,
- false);
- SetLayerPropertiesForTesting(grand_child1_raw,
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(1, 2),
- true,
+ SetLayerPropertiesForTesting(grand_parent_raw, identity_matrix,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(1, 2),
+ true, false, true);
+ SetLayerPropertiesForTesting(parent_raw, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(1, 2), true, false,
false);
- SetLayerPropertiesForTesting(grand_child2_raw,
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(1, 2),
- true,
+
+ SetLayerPropertiesForTesting(child_raw, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(1, 2), true, false,
false);
+ SetLayerPropertiesForTesting(grand_child1_raw, identity_matrix,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(1, 2),
+ true, false, false);
+
+ SetLayerPropertiesForTesting(grand_child2_raw, identity_matrix,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(1, 2),
+ true, false, false);
+
// Start with nothing being drawn.
ExecuteCalculateDrawProperties(grand_parent_raw);
int member_id = render_surface_layer_list_count();
@@ -8191,7 +8055,7 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
// If we force render surface, but none of the layers are in the layer list,
// then this layer should not appear in RSLL.
- grand_child1_raw->SetForceRenderSurface(true);
+ grand_child1_raw->SetHasRenderSurface(true);
ExecuteCalculateDrawProperties(grand_parent_raw);
member_id = render_surface_layer_list_count();
@@ -8230,8 +8094,8 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
// Now child is forced to have a render surface, and one if its children draws
// content.
grand_child1_raw->SetDrawsContent(false);
- grand_child1_raw->SetForceRenderSurface(false);
- child_raw->SetForceRenderSurface(true);
+ grand_child1_raw->SetHasRenderSurface(false);
+ child_raw->SetHasRenderSurface(true);
grand_child2_raw->SetDrawsContent(true);
ExecuteCalculateDrawProperties(grand_parent_raw);
@@ -8386,34 +8250,29 @@ TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) {
root->AddChild(child1.Pass());
root->AddChild(child2.Pass());
+ root->SetHasRenderSurface(true);
gfx::Transform identity_matrix, scale_transform_child1,
scale_transform_child2;
scale_transform_child1.Scale(2, 3);
scale_transform_child2.Scale(4, 5);
- SetLayerPropertiesForTesting(root_layer,
- identity_matrix,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(1, 1),
- true,
- false);
- SetLayerPropertiesForTesting(child1_layer,
- scale_transform_child1,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(),
- true,
- false);
+ SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(),
+ gfx::PointF(), gfx::Size(1, 1), true, false,
+ true);
+ SetLayerPropertiesForTesting(child1_layer, scale_transform_child1,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(), true,
+ false, false);
child1_layer->SetMaskLayer(
LayerImpl::Create(host_impl.active_tree(), 4).Pass());
scoped_ptr<LayerImpl> replica_layer =
LayerImpl::Create(host_impl.active_tree(), 5);
+ replica_layer->SetHasRenderSurface(true);
replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 6));
child1_layer->SetReplicaLayer(replica_layer.Pass());
+ child1_layer->SetHasRenderSurface(true);
ExecuteCalculateDrawProperties(root_layer);
@@ -8421,13 +8280,9 @@ TEST_F(LayerTreeHostCommonTest, DrawPropertyScales) {
scale.AppendScale(5.f, 8.f, 3.f);
AddAnimatedTransformToLayer(child2_layer, 1.0, TransformOperations(), scale);
- SetLayerPropertiesForTesting(child2_layer,
- scale_transform_child2,
- gfx::Point3F(),
- gfx::PointF(),
- gfx::Size(),
- true,
- false);
+ SetLayerPropertiesForTesting(child2_layer, scale_transform_child2,
+ gfx::Point3F(), gfx::PointF(), gfx::Size(), true,
+ false, false);
ExecuteCalculateDrawProperties(root_layer);
@@ -8688,7 +8543,8 @@ TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) {
gfx::PointF(),
root_size,
false,
- false);
+ false,
+ true);
root->SetContentBounds(root_size);
root->SetMasksToBounds(true);
@@ -8702,6 +8558,7 @@ TEST_F(LayerTreeHostCommonTest, BoundsDeltaAffectVisibleContentRect) {
gfx::PointF(),
sublayer_size,
false,
+ false,
false);
sublayer->SetContentBounds(sublayer_size);
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index b536173..fb2fdb6 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -50,6 +50,7 @@
#include "cc/test/fake_video_frame_provider.h"
#include "cc/test/geometry_test_utils.h"
#include "cc/test/layer_test_common.h"
+#include "cc/test/layer_tree_test.h"
#include "cc/test/render_pass_test_common.h"
#include "cc/test/test_gpu_memory_buffer_manager.h"
#include "cc/test/test_shared_bitmap_manager.h"
@@ -180,6 +181,7 @@ class LayerTreeHostImplTest : public testing::Test,
root->SetContentBounds(gfx::Size(10, 10));
root->SetDrawsContent(true);
root->draw_properties().visible_content_rect = gfx::Rect(0, 0, 10, 10);
+ root->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(root.Pass());
}
@@ -226,6 +228,7 @@ class LayerTreeHostImplTest : public testing::Test,
root->SetBounds(content_size);
root->SetContentBounds(content_size);
root->SetPosition(gfx::PointF());
+ root->SetHasRenderSurface(true);
scoped_ptr<LayerImpl> scroll =
LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId);
@@ -567,20 +570,6 @@ TEST_F(LayerTreeHostImplTest, ReplaceTreeWhileScrolling) {
ExpectContains(*scroll_info, scroll_layer->id(), scroll_delta);
}
-TEST_F(LayerTreeHostImplTest, ClearRootRenderSurfaceAndScroll) {
- SetupScrollAndContentsLayers(gfx::Size(100, 100));
- host_impl_->SetViewportSize(gfx::Size(50, 50));
- DrawFrame();
-
- // We should be able to scroll even if the root layer loses its render surface
- // after the most recent render.
- host_impl_->active_tree()->root_layer()->ClearRenderSurface();
- host_impl_->active_tree()->set_needs_update_draw_properties();
-
- EXPECT_EQ(InputHandler::ScrollStarted,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
-}
-
TEST_F(LayerTreeHostImplTest, WheelEventHandlers) {
SetupScrollAndContentsLayers(gfx::Size(100, 100));
host_impl_->SetViewportSize(gfx::Size(50, 50));
@@ -896,20 +885,6 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) {
EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 20), overflow->TotalScrollOffset());
}
-TEST_F(LayerTreeHostImplTest,
- ClearRootRenderSurfaceAndHitTestTouchHandlerRegion) {
- SetupScrollAndContentsLayers(gfx::Size(100, 100));
- host_impl_->SetViewportSize(gfx::Size(50, 50));
- DrawFrame();
-
- // We should be able to hit test for touch event handlers even if the root
- // layer loses its render surface after the most recent render.
- host_impl_->active_tree()->root_layer()->ClearRenderSurface();
- host_impl_->active_tree()->set_needs_update_draw_properties();
-
- EXPECT_EQ(host_impl_->HaveTouchEventHandlersAt(gfx::Point()), false);
-}
-
TEST_F(LayerTreeHostImplTest, ImplPinchZoom) {
LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100));
host_impl_->SetViewportSize(gfx::Size(50, 50));
@@ -1438,6 +1413,7 @@ class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl {
\
scroll->AddChild(contents.Pass()); \
root->AddChild(scroll.Pass()); \
+ root->SetHasRenderSurface(true); \
scrollbar->SetScrollLayerAndClipLayerByIds(2, 1); \
root->AddChild(scrollbar.Pass()); \
\
@@ -1582,6 +1558,7 @@ void LayerTreeHostImplTest::SetupMouseMoveAtWithDeviceScale(
scoped_ptr<LayerImpl> root =
LayerImpl::Create(host_impl_->active_tree(), 1);
root->SetBounds(viewport_size);
+ root->SetHasRenderSurface(true);
scoped_ptr<LayerImpl> scroll =
LayerImpl::Create(host_impl_->active_tree(), 2);
@@ -1787,6 +1764,7 @@ TEST_F(LayerTreeHostImplTest, WillDrawReturningFalseDoesNotCall) {
host_impl_->active_tree()->root_layer());
root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2));
+ root->SetHasRenderSurface(true);
DidDrawCheckLayer* layer =
static_cast<DidDrawCheckLayer*>(root->children()[0]);
@@ -1827,7 +1805,7 @@ TEST_F(LayerTreeHostImplTest, DidDrawNotCalledOnHiddenLayer) {
DidDrawCheckLayer* root = static_cast<DidDrawCheckLayer*>(
host_impl_->active_tree()->root_layer());
root->SetMasksToBounds(true);
-
+ root->SetHasRenderSurface(true);
root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2));
DidDrawCheckLayer* layer =
static_cast<DidDrawCheckLayer*>(root->children()[0]);
@@ -1880,6 +1858,7 @@ TEST_F(LayerTreeHostImplTest, WillDrawNotCalledOnOccludedLayer) {
static_cast<DidDrawCheckLayer*>(root->children()[0]);
root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 3));
+ root->SetHasRenderSurface(true);
DidDrawCheckLayer* top_layer =
static_cast<DidDrawCheckLayer*>(root->children()[1]);
// This layer covers the occluded_layer above. Make this layer large so it can
@@ -1912,6 +1891,7 @@ TEST_F(LayerTreeHostImplTest, DidDrawCalledOnAllLayers) {
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
root->AddChild(DidDrawCheckLayer::Create(host_impl_->active_tree(), 2));
+ root->SetHasRenderSurface(true);
DidDrawCheckLayer* layer1 =
static_cast<DidDrawCheckLayer*>(root->children()[0]);
@@ -1919,7 +1899,7 @@ TEST_F(LayerTreeHostImplTest, DidDrawCalledOnAllLayers) {
DidDrawCheckLayer* layer2 =
static_cast<DidDrawCheckLayer*>(layer1->children()[0]);
- layer1->SetOpacity(0.3f);
+ layer1->SetHasRenderSurface(true);
layer1->SetShouldFlattenTransform(true);
EXPECT_FALSE(root->did_draw_called());
@@ -1991,7 +1971,7 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsOnDefault) {
DidDrawCheckLayer::Create(host_impl_->active_tree(), 1));
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
-
+ root->SetHasRenderSurface(true);
bool tile_missing = false;
bool had_incomplete_tile = false;
bool is_animating = false;
@@ -2015,6 +1995,7 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithAnimatedLayer) {
DidDrawCheckLayer::Create(host_impl_->active_tree(), 1));
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
+ root->SetHasRenderSurface(true);
bool tile_missing = false;
bool had_incomplete_tile = false;
bool is_animating = true;
@@ -2038,6 +2019,7 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithMissingTiles) {
DidDrawCheckLayer::Create(host_impl_->active_tree(), 3));
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
+ root->SetHasRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -2066,6 +2048,7 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithIncompleteTile) {
DidDrawCheckLayer::Create(host_impl_->active_tree(), 3));
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
+ root->SetHasRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -2095,6 +2078,7 @@ TEST_F(LayerTreeHostImplTest,
DidDrawCheckLayer::Create(host_impl_->active_tree(), 5));
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
+ root->SetHasRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -2125,6 +2109,7 @@ TEST_F(LayerTreeHostImplTest,
DidDrawCheckLayer::Create(host_impl_->active_tree(), 5));
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
+ root->SetHasRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -2153,6 +2138,7 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWhenHighResRequired) {
DidDrawCheckLayer::Create(host_impl_->active_tree(), 7));
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
+ root->SetHasRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -2183,6 +2169,7 @@ TEST_F(LayerTreeHostImplTest,
DidDrawCheckLayer::Create(host_impl_->active_tree(), 7));
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
+ root->SetHasRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -2214,6 +2201,7 @@ TEST_F(LayerTreeHostImplTest,
DidDrawCheckLayer::Create(host_impl_->active_tree(), 7));
DidDrawCheckLayer* root =
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer());
+ root->SetHasRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
@@ -2242,6 +2230,7 @@ TEST_F(LayerTreeHostImplTest,
TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) {
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1);
root->SetScrollClipLayer(Layer::INVALID_ID);
+ root->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(root.Pass());
DrawFrame();
@@ -2296,7 +2285,9 @@ class LayerTreeHostImplTopControlsTest : public LayerTreeHostImplTest {
root->SetIsContainerForFixedPositionLayers(true);
int inner_viewport_scroll_layer_id = root->id();
int page_scale_layer_id = root_clip->id();
+ root_clip->SetHasRenderSurface(true);
root_clip->AddChild(root.Pass());
+ root_clip->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(root_clip.Pass());
host_impl_->active_tree()->SetViewportLayersFromIds(
Layer::INVALID_ID, page_scale_layer_id, inner_viewport_scroll_layer_id,
@@ -2361,7 +2352,7 @@ class LayerTreeHostImplTopControlsTest : public LayerTreeHostImplTest {
root->SetPosition(gfx::PointF());
root->SetDrawsContent(false);
root->SetIsContainerForFixedPositionLayers(true);
-
+ root_clip->SetHasRenderSurface(true);
outer_clip->SetBounds(outer_viewport_size);
outer_scroll->SetScrollClipLayer(outer_clip->id());
outer_scroll->SetBounds(scroll_layer_size);
@@ -2934,6 +2925,7 @@ TEST_F(LayerTreeHostImplTest, ScrollNonCompositedRoot) {
scroll_layer->AddChild(content_layer.Pass());
scroll_clip_layer->AddChild(scroll_layer.Pass());
+ scroll_clip_layer->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(scroll_clip_layer.Pass());
host_impl_->SetViewportSize(surface_size);
DrawFrame();
@@ -2954,6 +2946,7 @@ TEST_F(LayerTreeHostImplTest, ScrollChildCallsCommitAndRedraw) {
root->SetBounds(surface_size);
root->SetContentBounds(contents_size);
root->AddChild(CreateScrollableLayer(2, contents_size, root.get()));
+ root->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(root.Pass());
host_impl_->SetViewportSize(surface_size);
DrawFrame();
@@ -2971,6 +2964,7 @@ TEST_F(LayerTreeHostImplTest, ScrollMissesChild) {
gfx::Size surface_size(10, 10);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1);
root->AddChild(CreateScrollableLayer(2, surface_size, root.get()));
+ root->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(root.Pass());
host_impl_->SetViewportSize(surface_size);
DrawFrame();
@@ -2987,6 +2981,7 @@ TEST_F(LayerTreeHostImplTest, ScrollMissesChild) {
TEST_F(LayerTreeHostImplTest, ScrollMissesBackfacingChild) {
gfx::Size surface_size(10, 10);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1);
+ root->SetHasRenderSurface(true);
scoped_ptr<LayerImpl> child =
CreateScrollableLayer(2, surface_size, root.get());
host_impl_->SetViewportSize(surface_size);
@@ -3024,6 +3019,7 @@ TEST_F(LayerTreeHostImplTest, ScrollBlockedByContentLayer) {
CreateScrollableLayer(2, surface_size, clip_layer.get());
scroll_layer->AddChild(content_layer.Pass());
clip_layer->AddChild(scroll_layer.Pass());
+ clip_layer->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(clip_layer.Pass());
host_impl_->SetViewportSize(surface_size);
@@ -3049,6 +3045,7 @@ TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnMainThread) {
root_scrolling->SetIsContainerForFixedPositionLayers(true);
root_clip->AddChild(root_scrolling.Pass());
root->AddChild(root_clip.Pass());
+ root->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(root.Pass());
// The behaviour in this test assumes the page scale is applied at a layer
// above the clip layer.
@@ -3099,6 +3096,7 @@ TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnImplThread) {
root_scrolling->SetIsContainerForFixedPositionLayers(true);
root_clip->AddChild(root_scrolling.Pass());
root->AddChild(root_clip.Pass());
+ root->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(root.Pass());
// The behaviour in this test assumes the page scale is applied at a layer
// above the clip layer.
@@ -3204,6 +3202,7 @@ TEST_F(LayerTreeHostImplTest, ScrollChildAndChangePageScaleOnMainThread) {
gfx::Size surface_size(30, 30);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1);
root->SetBounds(gfx::Size(5, 5));
+ root->SetHasRenderSurface(true);
scoped_ptr<LayerImpl> root_scrolling =
LayerImpl::Create(host_impl_->active_tree(), 2);
root_scrolling->SetBounds(surface_size);
@@ -3259,7 +3258,7 @@ TEST_F(LayerTreeHostImplTest, ScrollChildBeyondLimit) {
gfx::Size content_size(20, 20);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1);
root->SetBounds(surface_size);
-
+ root->SetHasRenderSurface(true);
scoped_ptr<LayerImpl> grand_child =
CreateScrollableLayer(3, content_size, root.get());
@@ -3304,6 +3303,7 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
gfx::Size surface_size(20, 20);
gfx::Size viewport_size(10, 10);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1);
+ root->SetHasRenderSurface(true);
scoped_ptr<LayerImpl> root_scrolling =
CreateScrollableLayer(2, surface_size, root.get());
root_scrolling->SetIsContainerForFixedPositionLayers(true);
@@ -3413,6 +3413,7 @@ TEST_F(LayerTreeHostImplTest, ScrollEventBubbling) {
gfx::Size content_size(20, 20);
scoped_ptr<LayerImpl> root_clip =
LayerImpl::Create(host_impl_->active_tree(), 3);
+ root_clip->SetHasRenderSurface(true);
scoped_ptr<LayerImpl> root =
CreateScrollableLayer(1, content_size, root_clip.get());
// Make 'root' the clip layer for child: since they have the same sizes the
@@ -3456,6 +3457,7 @@ TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) {
scoped_ptr<LayerImpl> root_scroll =
CreateScrollableLayer(2, surface_size, root_clip.get());
root_scroll->SetIsContainerForFixedPositionLayers(true);
+ root_clip->SetHasRenderSurface(true);
root_clip->AddChild(root_scroll.Pass());
host_impl_->active_tree()->SetRootLayer(root_clip.Pass());
host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 2,
@@ -3473,6 +3475,7 @@ TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) {
CreateScrollableLayer(4, surface_size, root_clip2.get());
root_scroll2->SetIsContainerForFixedPositionLayers(true);
root_clip2->AddChild(root_scroll2.Pass());
+ root_clip2->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(root_clip2.Pass());
host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 3, 4,
Layer::INVALID_ID);
@@ -3987,6 +3990,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) {
gfx::Size surface_size(10, 10);
scoped_ptr<LayerImpl> root_clip =
LayerImpl::Create(host_impl_->active_tree(), 4);
+ root_clip->SetHasRenderSurface(true);
+
scoped_ptr<LayerImpl> root =
CreateScrollableLayer(1, surface_size, root_clip.get());
@@ -4051,6 +4056,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildEventBubbling) {
gfx::Size content_size(20, 20);
scoped_ptr<LayerImpl> root_clip =
LayerImpl::Create(host_impl_->active_tree(), 3);
+ root_clip->SetHasRenderSurface(true);
+
scoped_ptr<LayerImpl> root =
CreateScrollableLayer(1, content_size, root_clip.get());
root->SetIsContainerForFixedPositionLayers(true);
@@ -4107,6 +4114,8 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollOnFractionalDeviceScale) {
float device_scale_factor = 1.5f;
scoped_ptr<LayerImpl> root_clip =
LayerImpl::Create(host_impl_->active_tree(), 3);
+ root_clip->SetHasRenderSurface(true);
+
scoped_ptr<LayerImpl> root =
CreateScrollableLayer(1, content_size, root_clip.get());
root->SetIsContainerForFixedPositionLayers(true);
@@ -4146,6 +4155,8 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) {
gfx::Size content_size(200, 200);
scoped_ptr<LayerImpl> root_clip =
LayerImpl::Create(host_impl_->active_tree(), 3);
+ root_clip->SetHasRenderSurface(true);
+
scoped_ptr<LayerImpl> root =
CreateScrollableLayer(1, content_size, root_clip.get());
root->SetIsContainerForFixedPositionLayers(true);
@@ -4292,6 +4303,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
root->SetBounds(gfx::Size(10, 10));
root->SetContentBounds(root->bounds());
root->SetDrawsContent(false);
+ root->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(root.Pass());
}
LayerImpl* root = host_impl_->active_tree()->root_layer();
@@ -4401,6 +4413,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
// carries the inherited opacity).
layer1->SetContentsOpaque(true);
layer1->SetOpacity(0.5f);
+ layer1->SetHasRenderSurface(true);
layer1->SetExpectation(false, true);
layer1->SetUpdateRect(gfx::Rect(layer1->content_bounds()));
layer2->SetExpectation(false, false);
@@ -4412,6 +4425,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) {
EXPECT_TRUE(layer1->quads_appended());
EXPECT_TRUE(layer2->quads_appended());
host_impl_->DidDrawAllLayers(frame);
+ layer1->SetHasRenderSurface(false);
// Draw again, but with child non-opaque, to make sure
// layer1 not culled.
@@ -4528,6 +4542,7 @@ class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest {
host_impl_->active_tree()->set_background_color(SK_ColorGRAY);
host_impl_->active_tree()->SetRootLayer(
LayerImpl::Create(host_impl_->active_tree(), 1));
+ host_impl_->active_tree()->root_layer()->SetHasRenderSurface(true);
host_impl_->active_tree()->root_layer()->AddChild(
BlendStateCheckLayer::Create(host_impl_->active_tree(),
2,
@@ -4818,6 +4833,7 @@ TEST_F(LayerTreeHostImplTest, ReshapeNotCalledUntilDraw) {
root->SetBounds(gfx::Size(10, 10));
root->SetContentBounds(gfx::Size(10, 10));
root->SetDrawsContent(true);
+ root->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(root.Pass());
EXPECT_FALSE(provider->TestContext3d()->reshape_called());
provider->TestContext3d()->clear_reshape_called();
@@ -4886,6 +4902,7 @@ TEST_F(LayerTreeHostImplTest, PartialSwapReceivesDamageRect) {
scoped_ptr<LayerImpl> root =
FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 1);
+ root->SetHasRenderSurface(true);
scoped_ptr<LayerImpl> child =
FakeDrawableLayerImpl::Create(layer_tree_host_impl->active_tree(), 2);
child->SetPosition(gfx::PointF(12.f, 13.f));
@@ -4952,7 +4969,7 @@ TEST_F(LayerTreeHostImplTest, RootLayerDoesntCreateExtraSurface) {
root->SetBounds(gfx::Size(10, 10));
root->SetContentBounds(gfx::Size(10, 10));
root->SetDrawsContent(true);
- root->SetForceRenderSurface(true);
+ root->SetHasRenderSurface(true);
root->AddChild(child.Pass());
host_impl_->active_tree()->SetRootLayer(root.Pass());
@@ -5201,7 +5218,7 @@ static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity(
gfx::Rect child_rect(10, 10, 50, 50);
gfx::Rect grand_child_rect(5, 5, 150, 150);
- root->CreateRenderSurface();
+ root->SetHasRenderSurface(true);
root->SetPosition(root_rect.origin());
root->SetBounds(root_rect.size());
root->SetContentBounds(root->bounds());
@@ -5215,7 +5232,7 @@ static scoped_ptr<LayerTreeHostImpl> SetupLayersForOpacity(
child->SetContentBounds(child->bounds());
child->draw_properties().visible_content_rect = child_rect;
child->SetDrawsContent(false);
- child->SetForceRenderSurface(true);
+ child->SetHasRenderSurface(true);
grand_child->SetPosition(grand_child_rect.origin());
grand_child->SetBounds(grand_child_rect.size());
@@ -5295,6 +5312,7 @@ TEST_F(LayerTreeHostImplTest, LayersFreeTextures) {
scoped_ptr<LayerImpl> root_layer =
LayerImpl::Create(host_impl_->active_tree(), 1);
root_layer->SetBounds(gfx::Size(10, 10));
+ root_layer->SetHasRenderSurface(true);
scoped_refptr<VideoFrame> softwareFrame =
media::VideoFrame::CreateColorFrame(
@@ -5469,6 +5487,7 @@ TEST_F(LayerTreeHostImplTestWithDelegatingRenderer, FrameIncludesDamageRect) {
root->SetBounds(gfx::Size(10, 10));
root->SetContentBounds(gfx::Size(10, 10));
root->SetDrawsContent(true);
+ root->SetHasRenderSurface(true);
// Child layer is in the bottom right corner.
scoped_ptr<SolidColorLayerImpl> child =
@@ -5535,6 +5554,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerWithScaling) {
scoped_ptr<LayerImpl> scoped_root =
LayerImpl::Create(host_impl_->active_tree(), 1);
LayerImpl* root = scoped_root.get();
+ root->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(scoped_root.Pass());
scoped_ptr<LayerImpl> scoped_scaling_layer =
@@ -5550,6 +5570,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerWithScaling) {
scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer =
FakeMaskLayerImpl::Create(host_impl_->active_tree(), 4);
FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get();
+ content_layer->SetHasRenderSurface(true);
content_layer->SetMaskLayer(scoped_mask_layer.Pass());
gfx::Size root_size(100, 100);
@@ -5675,6 +5696,8 @@ TEST_F(LayerTreeHostImplTest, MaskLayerWithDifferentBounds) {
scoped_ptr<LayerImpl> scoped_root =
LayerImpl::Create(host_impl_->active_tree(), 1);
LayerImpl* root = scoped_root.get();
+ root->SetHasRenderSurface(true);
+
host_impl_->active_tree()->SetRootLayer(scoped_root.Pass());
scoped_ptr<LayerImpl> scoped_content_layer =
@@ -5686,6 +5709,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerWithDifferentBounds) {
FakeMaskLayerImpl::Create(host_impl_->active_tree(), 4);
FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get();
content_layer->SetMaskLayer(scoped_mask_layer.Pass());
+ content_layer->SetHasRenderSurface(true);
gfx::Size root_size(100, 100);
root->SetBounds(root_size);
@@ -5829,6 +5853,8 @@ TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerWithDifferentBounds) {
scoped_ptr<LayerImpl> scoped_root =
LayerImpl::Create(host_impl_->active_tree(), 1);
LayerImpl* root = scoped_root.get();
+ root->SetHasRenderSurface(true);
+
host_impl_->active_tree()->SetRootLayer(scoped_root.Pass());
scoped_ptr<LayerImpl> scoped_content_layer =
@@ -5840,11 +5866,13 @@ TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerWithDifferentBounds) {
LayerImpl::Create(host_impl_->active_tree(), 2);
LayerImpl* replica_layer = scoped_replica_layer.get();
content_layer->SetReplicaLayer(scoped_replica_layer.Pass());
+ content_layer->SetHasRenderSurface(true);
scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer =
FakeMaskLayerImpl::Create(host_impl_->active_tree(), 4);
FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get();
replica_layer->SetMaskLayer(scoped_mask_layer.Pass());
+ replica_layer->SetHasRenderSurface(true);
gfx::Size root_size(100, 100);
root->SetBounds(root_size);
@@ -5984,6 +6012,7 @@ TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerForSurfaceWithUnclippedChild) {
scoped_ptr<LayerImpl> scoped_root =
LayerImpl::Create(host_impl_->active_tree(), 1);
LayerImpl* root = scoped_root.get();
+ root->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(scoped_root.Pass());
scoped_ptr<LayerImpl> scoped_content_layer =
@@ -6000,11 +6029,13 @@ TEST_F(LayerTreeHostImplTest, ReflectionMaskLayerForSurfaceWithUnclippedChild) {
LayerImpl::Create(host_impl_->active_tree(), 4);
LayerImpl* replica_layer = scoped_replica_layer.get();
content_layer->SetReplicaLayer(scoped_replica_layer.Pass());
+ content_layer->SetHasRenderSurface(true);
scoped_ptr<FakeMaskLayerImpl> scoped_mask_layer =
FakeMaskLayerImpl::Create(host_impl_->active_tree(), 5);
FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get();
replica_layer->SetMaskLayer(scoped_mask_layer.Pass());
+ replica_layer->SetHasRenderSurface(true);
gfx::Size root_size(100, 100);
root->SetBounds(root_size);
@@ -6108,6 +6139,8 @@ TEST_F(LayerTreeHostImplTest, MaskLayerForSurfaceWithClippedLayer) {
scoped_ptr<LayerImpl> scoped_root =
LayerImpl::Create(host_impl_->active_tree(), 1);
LayerImpl* root = scoped_root.get();
+ root->SetHasRenderSurface(true);
+
host_impl_->active_tree()->SetRootLayer(scoped_root.Pass());
scoped_ptr<LayerImpl> scoped_clipping_layer =
@@ -6129,6 +6162,7 @@ TEST_F(LayerTreeHostImplTest, MaskLayerForSurfaceWithClippedLayer) {
FakeMaskLayerImpl::Create(host_impl_->active_tree(), 6);
FakeMaskLayerImpl* mask_layer = scoped_mask_layer.get();
content_layer->SetMaskLayer(scoped_mask_layer.Pass());
+ content_layer->SetHasRenderSurface(true);
gfx::Size root_size(100, 100);
root->SetBounds(root_size);
@@ -6214,6 +6248,7 @@ TEST_F(LayerTreeHostImplTest, FarAwayQuadsDontNeedAA) {
scoped_ptr<LayerImpl> scoped_root =
LayerImpl::Create(host_impl_->pending_tree(), 1);
LayerImpl* root = scoped_root.get();
+ root->SetHasRenderSurface(true);
host_impl_->pending_tree()->SetRootLayer(scoped_root.Pass());
@@ -6715,6 +6750,8 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldNotBubble) {
gfx::Size content_size(20, 20);
scoped_ptr<LayerImpl> root_clip =
LayerImpl::Create(host_impl_->active_tree(), 3);
+ root_clip->SetHasRenderSurface(true);
+
scoped_ptr<LayerImpl> root =
CreateScrollableLayer(1, content_size, root_clip.get());
root->SetIsContainerForFixedPositionLayers(true);
@@ -6759,6 +6796,7 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldLockToFirstScrolledLayer) {
// the scroll doesn't bubble up to the parent layer.
gfx::Size surface_size(10, 10);
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1);
+ root->SetHasRenderSurface(true);
scoped_ptr<LayerImpl> root_scrolling =
CreateScrollableLayer(2, surface_size, root.get());
@@ -6829,6 +6867,7 @@ TEST_F(LayerTreeHostImplTest, WheelFlingShouldBubble) {
gfx::Size content_size(20, 20);
scoped_ptr<LayerImpl> root_clip =
LayerImpl::Create(host_impl_->active_tree(), 3);
+ root_clip->SetHasRenderSurface(true);
scoped_ptr<LayerImpl> root_scroll =
CreateScrollableLayer(1, content_size, root_clip.get());
int root_scroll_id = root_scroll->id();
@@ -7032,6 +7071,7 @@ TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) {
root->SetBounds(gfx::Size(10, 10));
root->SetContentBounds(gfx::Size(10, 10));
root->SetDrawsContent(true);
+ root->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(root.Pass());
@@ -7072,6 +7112,7 @@ TEST_F(LayerTreeHostImplTest, SelectionBoundsPassedToCompositorFrameMetadata) {
root->SetBounds(gfx::Size(10, 10));
root->SetContentBounds(gfx::Size(10, 10));
root->SetDrawsContent(true);
+ root->SetHasRenderSurface(true);
host_impl_->active_tree()->SetRootLayer(root.Pass());
@@ -7597,6 +7638,7 @@ class LayerTreeHostImplVirtualViewportTest : public LayerTreeHostImplTest {
page_scale->AddChild(inner_scroll.Pass());
inner_clip->AddChild(page_scale.Pass());
+ inner_clip->SetHasRenderSurface(true);
layer_tree_impl->SetRootLayer(inner_clip.Pass());
layer_tree_impl->SetViewportLayersFromIds(
Layer::INVALID_ID, kPageScaleLayerId, kInnerViewportScrollLayerId,
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 26eb513..f188260 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -290,6 +290,7 @@ class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest {
protected:
void SetupTree() override {
scoped_refptr<Layer> root = Layer::Create();
+ root->CreateRenderSurface();
root->SetBounds(gfx::Size(10, 10));
layer_tree_host()->SetRootLayer(root);
LayerTreeHostTest::SetupTree();
@@ -483,6 +484,7 @@ class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
void SetupTree() override {
root_layer_ = Layer::Create();
root_layer_->SetBounds(gfx::Size(10, 20));
+ root_layer_->CreateRenderSurface();
if (layer_tree_host()->settings().impl_side_painting)
scaled_layer_ = FakePictureLayer::Create(&client_);
@@ -544,6 +546,7 @@ class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate
void SetupTree() override {
root_layer_ = Layer::Create();
root_layer_->SetBounds(gfx::Size(10, 20));
+ root_layer_->CreateRenderSurface();
bool paint_scrollbar = true;
bool has_thumb = false;
@@ -795,6 +798,7 @@ class LayerTreeHostTestUndrawnLayersPushContentBoundsLater
: root_layer_(Layer::Create()) {}
void SetupTree() override {
+ root_layer_->CreateRenderSurface();
root_layer_->SetIsDrawable(true);
root_layer_->SetBounds(gfx::Size(20, 20));
layer_tree_host()->SetRootLayer(root_layer_);
@@ -3178,6 +3182,7 @@ class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest {
void SetupTree() override {
root_ = PushPropertiesCountingLayer::Create();
+ root_->CreateRenderSurface();
child_ = PushPropertiesCountingLayer::Create();
child2_ = PushPropertiesCountingLayer::Create();
grandchild_ = PushPropertiesCountingLayer::Create();
@@ -3190,6 +3195,7 @@ class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest {
child2_->AddChild(leaf_always_pushing_layer_);
other_root_ = PushPropertiesCountingLayer::Create();
+ other_root_->CreateRenderSurface();
// Don't set the root layer here.
LayerTreeHostTest::SetupTree();
@@ -3562,6 +3568,7 @@ class LayerTreeHostTestPropertyChangesDuringUpdateArePushed
void SetupTree() override {
root_ = Layer::Create();
+ root_->CreateRenderSurface();
root_->SetBounds(gfx::Size(1, 1));
bool paint_scrollbar = true;
@@ -3618,6 +3625,7 @@ class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest {
void SetupTree() override {
root_ = PushPropertiesCountingLayer::Create();
+ root_->CreateRenderSurface();
child_ = PushPropertiesCountingLayer::Create();
root_->AddChild(child_);
@@ -3679,6 +3687,7 @@ class LayerTreeHostTestCasePushPropertiesThreeGrandChildren
void SetupTree() override {
root_ = PushPropertiesCountingLayer::Create();
+ root_->CreateRenderSurface();
child_ = PushPropertiesCountingLayer::Create();
grandchild1_ = PushPropertiesCountingLayer::Create();
grandchild2_ = PushPropertiesCountingLayer::Create();
@@ -4232,6 +4241,7 @@ class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest {
protected:
void SetupTree() override {
root_layer_ = Layer::Create();
+ root_layer_->CreateRenderSurface();
root_layer_->SetPosition(gfx::Point());
root_layer_->SetBounds(gfx::Size(10, 10));
@@ -4340,6 +4350,7 @@ class LayerTreeHostTestAbortEvictedTextures : public LayerTreeHostTest {
scoped_refptr<SolidColorLayer> root_layer = SolidColorLayer::Create();
root_layer->SetBounds(gfx::Size(200, 200));
root_layer->SetIsDrawable(true);
+ root_layer->CreateRenderSurface();
layer_tree_host()->SetRootLayer(root_layer);
LayerTreeHostTest::SetupTree();
@@ -5199,6 +5210,7 @@ class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest {
void SetupTree() override {
scoped_refptr<Layer> root_layer = Layer::Create();
root_layer->SetBounds(bounds_);
+ root_layer->CreateRenderSurface();
if (layer_tree_host()->settings().impl_side_painting) {
picture_layer_ = FakePictureLayer::Create(&client_);
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index 78d72de..2c5dd05 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -50,13 +50,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayer) {
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, true);
root->SetDrawsContent(true);
host_impl().SetViewportSize(root->bounds());
@@ -102,24 +97,14 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayerAndHud) {
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, true);
root->SetDrawsContent(true);
// Create hud and add it as a child of root.
gfx::Size hud_bounds(200, 200);
- SetLayerPropertiesForTesting(hud.get(),
- identity_matrix,
- transform_origin,
- position,
- hud_bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(hud.get(), identity_matrix, transform_origin,
+ position, hud_bounds, true, false, false);
hud->SetDrawsContent(true);
host_impl().active_tree()->set_hud_layer(hud.get());
@@ -174,13 +159,9 @@ TEST_F(LayerTreeImplTest, HitTestingForUninvertibleTransform) {
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- uninvertible_transform,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), uninvertible_transform,
+ transform_origin, position, bounds, true, false,
+ true);
root->SetDrawsContent(true);
host_impl().SetViewportSize(root->bounds());
@@ -240,13 +221,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSinglePositionedLayer) {
// layer is located.
gfx::PointF position(50.f, 50.f);
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, true);
root->SetDrawsContent(true);
host_impl().SetViewportSize(root->bounds());
@@ -296,13 +272,9 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleRotatedLayer) {
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- rotation45_degrees_about_center,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), rotation45_degrees_about_center,
+ transform_origin, position, bounds, true, false,
+ true);
root->SetDrawsContent(true);
host_impl().SetViewportSize(root->bounds());
@@ -365,13 +337,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSinglePerspectiveLayer) {
gfx::PointF position;
gfx::Size bounds(100, 100);
SetLayerPropertiesForTesting(
- root.get(),
- perspective_projection_about_center * translation_by_z,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ root.get(), perspective_projection_about_center * translation_by_z,
+ transform_origin, position, bounds, true, false, true);
root->SetDrawsContent(true);
host_impl().SetViewportSize(root->bounds());
@@ -426,25 +393,17 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayerWithScaledContents) {
gfx::Transform identity_matrix;
gfx::Point3F transform_origin;
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- gfx::PointF(),
- gfx::Size(100, 100),
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ gfx::PointF(), gfx::Size(100, 100), true, false,
+ true);
{
gfx::PointF position(25.f, 25.f);
gfx::Size bounds(50, 50);
scoped_ptr<LayerImpl> test_layer =
LayerImpl::Create(host_impl().active_tree(), 12345);
- SetLayerPropertiesForTesting(test_layer.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(test_layer.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
// override content bounds and contents scale
test_layer->SetContentBounds(gfx::Size(100, 100));
@@ -506,13 +465,9 @@ TEST_F(LayerTreeImplTest, HitTestingForSimpleClippedLayer) {
gfx::Point3F transform_origin;
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- gfx::PointF(),
- gfx::Size(100, 100),
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ gfx::PointF(), gfx::Size(100, 100), true, false,
+ true);
{
scoped_ptr<LayerImpl> clipping_layer =
LayerImpl::Create(host_impl().active_tree(), 123);
@@ -520,26 +475,17 @@ TEST_F(LayerTreeImplTest, HitTestingForSimpleClippedLayer) {
// layer is located.
gfx::PointF position(25.f, 25.f);
gfx::Size bounds(50, 50);
- SetLayerPropertiesForTesting(clipping_layer.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(clipping_layer.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
clipping_layer->SetMasksToBounds(true);
scoped_ptr<LayerImpl> child =
LayerImpl::Create(host_impl().active_tree(), 456);
position = gfx::PointF(-50.f, -50.f);
bounds = gfx::Size(300, 300);
- SetLayerPropertiesForTesting(child.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, false);
child->SetDrawsContent(true);
clipping_layer->AddChild(child.Pass());
root->AddChild(clipping_layer.Pass());
@@ -601,13 +547,8 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) {
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, true);
root->SetMasksToBounds(true);
{
scoped_ptr<LayerImpl> child =
@@ -619,13 +560,8 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) {
position = gfx::PointF(10.f, 10.f);
bounds = gfx::Size(80, 80);
- SetLayerPropertiesForTesting(child.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, false);
child->SetMasksToBounds(true);
gfx::Transform rotation45_degrees_about_corner;
@@ -636,13 +572,9 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) {
position = gfx::PointF();
bounds =
gfx::Size(200, 200); // to ensure it covers at least sqrt(2) * 100.
- SetLayerPropertiesForTesting(grand_child.get(),
- rotation45_degrees_about_corner,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(
+ grand_child.get(), rotation45_degrees_about_corner, transform_origin,
+ position, bounds, true, false, false);
grand_child->SetMasksToBounds(true);
// Rotates about the center of the layer
@@ -656,13 +588,9 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) {
rotated_leaf_transform.Translate(-50.0, -50.0);
position = gfx::PointF();
bounds = gfx::Size(100, 100);
- SetLayerPropertiesForTesting(rotated_leaf.get(),
- rotated_leaf_transform,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(rotated_leaf.get(), rotated_leaf_transform,
+ transform_origin, position, bounds, true,
+ false, false);
rotated_leaf->SetDrawsContent(true);
grand_child->AddChild(rotated_leaf.Pass());
@@ -674,27 +602,6 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) {
host_impl().active_tree()->SetRootLayer(root.Pass());
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
- // Sanity check the scenario we just created.
- // The grand_child is expected to create a render surface because it
- // MasksToBounds and is not axis aligned.
- ASSERT_EQ(2u, RenderSurfaceLayerList().size());
- ASSERT_EQ(
- 1u,
- RenderSurfaceLayerList().at(0)->render_surface()->layer_list().size());
- ASSERT_EQ(789,
- RenderSurfaceLayerList()
- .at(0)
- ->render_surface()
- ->layer_list()
- .at(0)
- ->id()); // grand_child's surface.
- ASSERT_EQ(
- 1u,
- RenderSurfaceLayerList().at(1)->render_surface()->layer_list().size());
- ASSERT_EQ(
- 2468,
- RenderSurfaceLayerList()[1]->render_surface()->layer_list().at(0)->id());
-
// (11, 89) is close to the the bottom left corner within the clip, but it is
// not inside the layer.
gfx::Point test_point(11, 89);
@@ -749,13 +656,9 @@ TEST_F(LayerTreeImplTest, HitTestingForNonClippingIntermediateLayer) {
gfx::Point3F transform_origin;
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- gfx::PointF(),
- gfx::Size(100, 100),
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ gfx::PointF(), gfx::Size(100, 100), true, false,
+ true);
{
scoped_ptr<LayerImpl> intermediate_layer =
LayerImpl::Create(host_impl().active_tree(), 123);
@@ -763,13 +666,9 @@ TEST_F(LayerTreeImplTest, HitTestingForNonClippingIntermediateLayer) {
// layer is located.
gfx::PointF position(10.f, 10.f);
gfx::Size bounds(50, 50);
- SetLayerPropertiesForTesting(intermediate_layer.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(intermediate_layer.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
// Sanity check the intermediate layer should not clip.
ASSERT_FALSE(intermediate_layer->masks_to_bounds());
ASSERT_FALSE(intermediate_layer->mask_layer());
@@ -781,13 +680,8 @@ TEST_F(LayerTreeImplTest, HitTestingForNonClippingIntermediateLayer) {
LayerImpl::Create(host_impl().active_tree(), 456);
position = gfx::PointF(60.f, 60.f); // 70, 70 in screen space
bounds = gfx::Size(20, 20);
- SetLayerPropertiesForTesting(child.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, false);
child->SetDrawsContent(true);
intermediate_layer->AddChild(child.Pass());
root->AddChild(intermediate_layer.Pass());
@@ -834,13 +728,8 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayers) {
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, true);
root->SetDrawsContent(true);
{
// child 1 and child2 are initialized to overlap between x=50 and x=60.
@@ -858,24 +747,16 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayers) {
position = gfx::PointF(10.f, 10.f);
bounds = gfx::Size(50, 50);
- SetLayerPropertiesForTesting(child1.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(child1.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
child1->SetDrawsContent(true);
position = gfx::PointF(50.f, 10.f);
bounds = gfx::Size(50, 50);
- SetLayerPropertiesForTesting(child2.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(child2.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
child2->SetDrawsContent(true);
// Remember that grand_child is positioned with respect to its parent (i.e.
@@ -883,13 +764,9 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayers) {
// 100 x 50.
position = gfx::PointF(0.f, 40.f);
bounds = gfx::Size(100, 50);
- SetLayerPropertiesForTesting(grand_child1.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
grand_child1->SetDrawsContent(true);
child1->AddChild(grand_child1.Pass());
@@ -973,13 +850,8 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, true);
root->SetDrawsContent(true);
root->SetShouldFlattenTransform(false);
root->Set3dSortingContextId(1);
@@ -999,13 +871,9 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
position = gfx::PointF(10.f, 10.f);
bounds = gfx::Size(50, 50);
- SetLayerPropertiesForTesting(child1.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(child1.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
child1->SetDrawsContent(true);
child1->SetShouldFlattenTransform(false);
child1->Set3dSortingContextId(1);
@@ -1014,13 +882,8 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
bounds = gfx::Size(50, 50);
gfx::Transform translate_z;
translate_z.Translate3d(0, 0, -10.f);
- SetLayerPropertiesForTesting(child2.get(),
- translate_z,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(child2.get(), translate_z, transform_origin,
+ position, bounds, true, false, false);
child2->SetDrawsContent(true);
child2->SetShouldFlattenTransform(false);
child2->Set3dSortingContextId(1);
@@ -1030,13 +893,9 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
// 100 x 50.
position = gfx::PointF(0.f, 40.f);
bounds = gfx::Size(100, 50);
- SetLayerPropertiesForTesting(grand_child1.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
grand_child1->SetDrawsContent(true);
grand_child1->SetShouldFlattenTransform(false);
@@ -1122,13 +981,8 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsClipParents) {
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, true);
root->SetDrawsContent(true);
{
scoped_ptr<LayerImpl> child =
@@ -1138,27 +992,18 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsClipParents) {
position = gfx::PointF(10.f, 10.f);
bounds = gfx::Size(1, 1);
- SetLayerPropertiesForTesting(child.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, false);
child->SetDrawsContent(true);
child->SetMasksToBounds(true);
position = gfx::PointF(0.f, 40.f);
bounds = gfx::Size(100, 50);
- SetLayerPropertiesForTesting(grand_child.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(grand_child.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
grand_child->SetDrawsContent(true);
- grand_child->SetForceRenderSurface(true);
+ grand_child->SetHasRenderSurface(true);
// This should let |grand_child| "escape" |child|'s clip.
grand_child->SetClipParent(root.get());
@@ -1184,13 +1029,8 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsScrollParents) {
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, true);
root->SetDrawsContent(true);
{
scoped_ptr<LayerImpl> child =
@@ -1202,40 +1042,27 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsScrollParents) {
position = gfx::PointF(10.f, 10.f);
bounds = gfx::Size(1, 1);
- SetLayerPropertiesForTesting(child.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, false);
child->SetDrawsContent(true);
child->SetMasksToBounds(true);
position = gfx::PointF();
bounds = gfx::Size(200, 200);
- SetLayerPropertiesForTesting(scroll_child.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(scroll_child.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
scroll_child->SetDrawsContent(true);
// This should cause scroll child and its descendants to be affected by
// |child|'s clip.
scroll_child->SetScrollParent(child.get());
- SetLayerPropertiesForTesting(grand_child.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(grand_child.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
grand_child->SetDrawsContent(true);
- grand_child->SetForceRenderSurface(true);
+ grand_child->SetHasRenderSurface(true);
scroll_child->AddChild(grand_child.Pass());
root->AddChild(scroll_child.Pass());
@@ -1265,13 +1092,8 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) {
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, true);
root->SetDrawsContent(true);
{
// child 1 and child2 are initialized to overlap between x=50 and x=60.
@@ -1289,42 +1111,30 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) {
position = gfx::PointF(10.f, 10.f);
bounds = gfx::Size(50, 50);
- SetLayerPropertiesForTesting(child1.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(child1.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
child1->SetDrawsContent(true);
- child1->SetForceRenderSurface(true);
+ child1->SetHasRenderSurface(true);
position = gfx::PointF(50.f, 10.f);
bounds = gfx::Size(50, 50);
- SetLayerPropertiesForTesting(child2.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(child2.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
child2->SetDrawsContent(true);
- child2->SetForceRenderSurface(true);
+ child2->SetHasRenderSurface(true);
// Remember that grand_child is positioned with respect to its parent (i.e.
// child1). In screen space, the intended position is (10, 50), with size
// 100 x 50.
position = gfx::PointF(0.f, 40.f);
bounds = gfx::Size(100, 50);
- SetLayerPropertiesForTesting(grand_child1.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
grand_child1->SetDrawsContent(true);
- grand_child1->SetForceRenderSurface(true);
+ grand_child1->SetHasRenderSurface(true);
child1->AddChild(grand_child1.Pass());
root->AddChild(child1.Pass());
@@ -1416,13 +1226,8 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, true);
root->SetDrawsContent(true);
host_impl().SetViewportSize(root->bounds());
@@ -1504,13 +1309,9 @@ TEST_F(LayerTreeImplTest,
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- uninvertible_transform,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), uninvertible_transform,
+ transform_origin, position, bounds, true, false,
+ true);
root->SetDrawsContent(true);
root->SetTouchEventHandlerRegion(touch_handler_region);
@@ -1582,13 +1383,8 @@ TEST_F(LayerTreeImplTest,
// layer is located.
gfx::PointF position(50.f, 50.f);
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, true);
root->SetDrawsContent(true);
root->SetTouchEventHandlerRegion(touch_handler_region);
@@ -1658,26 +1454,18 @@ TEST_F(LayerTreeImplTest,
gfx::Transform identity_matrix;
gfx::Point3F transform_origin;
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- gfx::PointF(),
- gfx::Size(100, 100),
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ gfx::PointF(), gfx::Size(100, 100), true, false,
+ true);
{
Region touch_handler_region(gfx::Rect(10, 10, 30, 30));
gfx::PointF position(25.f, 25.f);
gfx::Size bounds(50, 50);
scoped_ptr<LayerImpl> test_layer =
LayerImpl::Create(host_impl().active_tree(), 12345);
- SetLayerPropertiesForTesting(test_layer.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(test_layer.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
// override content bounds and contents scale
test_layer->SetContentBounds(gfx::Size(100, 100));
@@ -1762,26 +1550,18 @@ TEST_F(LayerTreeImplTest,
gfx::Transform identity_matrix;
gfx::Point3F transform_origin;
// Set the bounds of the root layer big enough to fit the child when scaled.
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- gfx::PointF(),
- gfx::Size(100, 100),
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ gfx::PointF(), gfx::Size(100, 100), true, false,
+ true);
{
Region touch_handler_region(gfx::Rect(10, 10, 30, 30));
gfx::PointF position(25.f, 25.f);
gfx::Size bounds(50, 50);
scoped_ptr<LayerImpl> test_layer =
LayerImpl::Create(host_impl().active_tree(), 12345);
- SetLayerPropertiesForTesting(test_layer.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(test_layer.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
test_layer->SetDrawsContent(true);
test_layer->SetTouchEventHandlerRegion(touch_handler_region);
@@ -1888,13 +1668,9 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSimpleClippedLayer) {
gfx::Point3F transform_origin;
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- gfx::PointF(),
- gfx::Size(100, 100),
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ gfx::PointF(), gfx::Size(100, 100), true, false,
+ true);
{
scoped_ptr<LayerImpl> clipping_layer =
LayerImpl::Create(host_impl().active_tree(), 123);
@@ -1902,13 +1678,9 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSimpleClippedLayer) {
// layer is located.
gfx::PointF position(25.f, 25.f);
gfx::Size bounds(50, 50);
- SetLayerPropertiesForTesting(clipping_layer.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(clipping_layer.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
clipping_layer->SetMasksToBounds(true);
scoped_ptr<LayerImpl> child =
@@ -1916,13 +1688,8 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSimpleClippedLayer) {
Region touch_handler_region(gfx::Rect(10, 10, 50, 50));
position = gfx::PointF(-50.f, -50.f);
bounds = gfx::Size(300, 300);
- SetLayerPropertiesForTesting(child.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, false);
child->SetDrawsContent(true);
child->SetTouchEventHandlerRegion(touch_handler_region);
clipping_layer->AddChild(child.Pass());
@@ -1983,13 +1750,9 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerOverlappingRegions) {
gfx::Point3F transform_origin;
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- gfx::PointF(),
- gfx::Size(100, 100),
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ gfx::PointF(), gfx::Size(100, 100), true, false,
+ true);
{
scoped_ptr<LayerImpl> touch_layer =
LayerImpl::Create(host_impl().active_tree(), 123);
@@ -1997,13 +1760,9 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerOverlappingRegions) {
// layer is located.
gfx::PointF position;
gfx::Size bounds(50, 50);
- SetLayerPropertiesForTesting(touch_layer.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(touch_layer.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
touch_layer->SetDrawsContent(true);
touch_layer->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 50, 50));
root->AddChild(touch_layer.Pass());
@@ -2016,13 +1775,9 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerOverlappingRegions) {
// layer is located.
gfx::PointF position(0, 25);
gfx::Size bounds(50, 50);
- SetLayerPropertiesForTesting(notouch_layer.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(notouch_layer.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
notouch_layer->SetDrawsContent(true);
root->AddChild(notouch_layer.Pass());
}
@@ -2080,13 +1835,8 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForSingleLayer) {
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, true);
root->SetDrawsContent(true);
host_impl().SetViewportSize(root->bounds());
@@ -2156,13 +1906,8 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) {
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, true);
gfx::Vector2dF clipping_offset(10, 10);
{
@@ -2171,26 +1916,18 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) {
// The clipping layer should occlude the right selection bound.
gfx::PointF position = gfx::PointF() + clipping_offset;
gfx::Size bounds(50, 50);
- SetLayerPropertiesForTesting(clipping_layer.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(clipping_layer.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
clipping_layer->SetMasksToBounds(true);
scoped_ptr<LayerImpl> clipped_layer =
LayerImpl::Create(host_impl().active_tree(), clipped_layer_id);
position = gfx::PointF();
bounds = gfx::Size(100, 100);
- SetLayerPropertiesForTesting(clipped_layer.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(clipped_layer.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
clipped_layer->SetDrawsContent(true);
clipping_layer->AddChild(clipped_layer.Pass());
root->AddChild(clipping_layer.Pass());
@@ -2268,13 +2005,8 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) {
gfx::Point3F transform_origin;
gfx::PointF position;
gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(root.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(root.get(), identity_matrix, transform_origin,
+ position, bounds, true, false, true);
gfx::Vector2dF sub_layer_offset(10, 0);
{
@@ -2282,13 +2014,9 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) {
LayerImpl::Create(host_impl().active_tree(), sub_layer_id);
gfx::PointF position = gfx::PointF() + sub_layer_offset;
gfx::Size bounds(50, 50);
- SetLayerPropertiesForTesting(sub_layer.get(),
- identity_matrix,
- transform_origin,
- position,
- bounds,
- true,
- false);
+ SetLayerPropertiesForTesting(sub_layer.get(), identity_matrix,
+ transform_origin, position, bounds, true,
+ false, false);
sub_layer->SetDrawsContent(true);
root->AddChild(sub_layer.Pass());
}
diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc
index 35b3ffd..172b227 100644
--- a/cc/trees/occlusion_tracker_unittest.cc
+++ b/cc/trees/occlusion_tracker_unittest.cc
@@ -127,6 +127,9 @@ struct OcclusionTrackerTestMainThreadTypes {
*layer = NULL;
return ref;
}
+ static void SetForceRenderSurface(LayerType* layer, bool force) {
+ layer->SetForceRenderSurface(force);
+ }
static void DestroyLayer(LayerPtrType* layer) { *layer = NULL; }
@@ -156,6 +159,9 @@ struct OcclusionTrackerTestImplThreadTypes {
return layer->Pass();
}
+ static void SetForceRenderSurface(LayerType* layer, bool force) {
+ layer->SetHasRenderSurface(force);
+ }
static void DestroyLayer(LayerPtrType* layer) { layer->reset(); }
static void RecursiveUpdateNumChildren(LayerType* layer) {
@@ -189,6 +195,7 @@ template <typename Types> class OcclusionTrackerTest : public testing::Test {
DCHECK(!root_.get());
root_ = Types::PassLayerPtr(&layer);
+ Types::SetForceRenderSurface(layer_ptr, true);
SetRootLayerOnMainThread(layer_ptr);
return layer_ptr;
@@ -211,7 +218,7 @@ template <typename Types> class OcclusionTrackerTest : public testing::Test {
const gfx::Size& bounds) {
typename Types::LayerType* layer =
CreateLayer(parent, transform, position, bounds);
- layer->SetForceRenderSurface(true);
+ Types::SetForceRenderSurface(layer, true);
return layer;
}
@@ -272,7 +279,7 @@ template <typename Types> class OcclusionTrackerTest : public testing::Test {
bool opaque) {
typename Types::ContentLayerType* layer =
CreateDrawingLayer(parent, transform, position, bounds, opaque);
- layer->SetForceRenderSurface(true);
+ Types::SetForceRenderSurface(layer, true);
return layer;
}
@@ -300,12 +307,12 @@ template <typename Types> class OcclusionTrackerTest : public testing::Test {
CopyOutputRequest::CreateBitmapRequest(base::Bind(
&OcclusionTrackerTest<Types>::CopyOutputCallback,
base::Unretained(this))));
+ layer->SetHasRenderSurface(true);
layer->PassCopyRequests(&requests);
}
void CalcDrawEtc(TestContentLayerImpl* root) {
DCHECK(root == root_.get());
- DCHECK(!root->render_surface());
Types::RecursiveUpdateNumChildren(root);
LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
@@ -734,7 +741,7 @@ class OcclusionTrackerTestScaledRenderSurface
layer1_matrix.Scale(2.0, 2.0);
typename Types::ContentLayerType* layer1 = this->CreateDrawingLayer(
parent, layer1_matrix, gfx::PointF(), gfx::Size(100, 100), true);
- layer1->SetForceRenderSurface(true);
+ Types::SetForceRenderSurface(layer1, true);
gfx::Transform layer2_matrix;
layer2_matrix.Translate(25.0, 25.0);
@@ -848,9 +855,8 @@ class OcclusionTrackerTestSurfaceRotatedOffAxis
this->identity_matrix, gfx::PointF(), gfx::Size(1000, 1000));
typename Types::ContentLayerType* parent = this->CreateDrawingLayer(
root, this->identity_matrix, gfx::PointF(), gfx::Size(100, 100), true);
- typename Types::LayerType* child = this->CreateLayer(
+ typename Types::LayerType* child = this->CreateSurface(
parent, child_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500));
- child->SetMasksToBounds(true);
typename Types::ContentLayerType* layer = this->CreateDrawingLayer(
child, layer_transform, gfx::PointF(), gfx::Size(500, 500), true);
this->CalcDrawEtc(root);
@@ -1169,14 +1175,17 @@ class OcclusionTrackerTestFilters : public OcclusionTrackerTest<Types> {
gfx::Size(500, 500),
true);
+ Types::SetForceRenderSurface(blur_layer, true);
FilterOperations filters;
filters.Append(FilterOperation::CreateBlurFilter(10.f));
blur_layer->SetFilters(filters);
+ Types::SetForceRenderSurface(opaque_layer, true);
filters.Clear();
filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f));
opaque_layer->SetFilters(filters);
+ Types::SetForceRenderSurface(opacity_layer, true);
filters.Clear();
filters.Append(FilterOperation::CreateOpacityFilter(0.5f));
opacity_layer->SetFilters(filters);
@@ -2229,8 +2238,8 @@ class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter
gfx::PointF(50.f, 50.f),
gfx::Size(100, 100),
false);
+ Types::SetForceRenderSurface(filtered_surface, true);
filtered_surface->SetBackgroundFilters(filters);
-
gfx::Rect occlusion_rect;
switch (i) {
case LEFT:
@@ -2341,6 +2350,8 @@ class OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice
true);
// Filters make the layers own surfaces.
+ Types::SetForceRenderSurface(filtered_surface1, true);
+ Types::SetForceRenderSurface(filtered_surface2, true);
FilterOperations filters;
filters.Append(FilterOperation::CreateBlurFilter(1.f));
filtered_surface1->SetBackgroundFilters(filters);
@@ -2427,6 +2438,7 @@ class OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter
gfx::Size());
// Filters make the layer own a surface.
+ Types::SetForceRenderSurface(filtered_surface, true);
FilterOperations filters;
filters.Append(FilterOperation::CreateBlurFilter(3.f));
filtered_surface->SetBackgroundFilters(filters);
@@ -2501,6 +2513,7 @@ class OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded
true);
// Filters make the layer own a surface.
+ Types::SetForceRenderSurface(filtered_surface, true);
FilterOperations filters;
filters.Append(FilterOperation::CreateBlurFilter(3.f));
filtered_surface->SetBackgroundFilters(filters);
@@ -2597,6 +2610,7 @@ class OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded
true);
// Filters make the layer own a surface.
+ Types::SetForceRenderSurface(filtered_surface, true);
FilterOperations filters;
filters.Append(FilterOperation::CreateBlurFilter(3.f));
filtered_surface->SetBackgroundFilters(filters);