summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/layers/delegated_renderer_layer_impl_unittest.cc4
-rw-r--r--cc/layers/draw_properties.h4
-rw-r--r--cc/layers/layer.cc2
-rw-r--r--cc/layers/layer.h10
-rw-r--r--cc/layers/layer_impl.cc6
-rw-r--r--cc/layers/layer_impl.h8
-rw-r--r--cc/layers/layer_impl_unittest.cc1
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc2
-rw-r--r--cc/test/fake_layer_tree_host_impl.cc1
-rw-r--r--cc/trees/layer_tree_host_common.cc38
-rw-r--r--cc/trees/layer_tree_host_common_unittest.cc2
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc2
-rw-r--r--cc/trees/layer_tree_impl.cc1
-rw-r--r--cc/trees/layer_tree_impl_unittest.cc3
-rw-r--r--cc/trees/property_tree_builder.cc5
15 files changed, 62 insertions, 27 deletions
diff --git a/cc/layers/delegated_renderer_layer_impl_unittest.cc b/cc/layers/delegated_renderer_layer_impl_unittest.cc
index a2e8d70..daaaa27 100644
--- a/cc/layers/delegated_renderer_layer_impl_unittest.cc
+++ b/cc/layers/delegated_renderer_layer_impl_unittest.cc
@@ -1250,6 +1250,7 @@ TEST_F(DelegatedRendererLayerImplTestClip,
SetUpTest();
LayerTreeHostImpl::FrameData frame;
+ host_impl_->active_tree()->BuildPropertyTreesForTesting();
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
ASSERT_EQ(2u, frame.render_passes.size());
@@ -1280,6 +1281,7 @@ TEST_F(DelegatedRendererLayerImplTestClip,
SetUpTest();
LayerTreeHostImpl::FrameData frame;
+ host_impl_->active_tree()->BuildPropertyTreesForTesting();
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
ASSERT_EQ(2u, frame.render_passes.size());
@@ -1370,6 +1372,7 @@ TEST_F(DelegatedRendererLayerImplTestClip,
delegated_renderer_layer_->SetHasRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
+ host_impl_->active_tree()->BuildPropertyTreesForTesting();
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
ASSERT_EQ(3u, frame.render_passes.size());
@@ -1398,6 +1401,7 @@ TEST_F(DelegatedRendererLayerImplTestClip, QuadsClipped_LayerClipped_Surface) {
delegated_renderer_layer_->SetHasRenderSurface(true);
LayerTreeHostImpl::FrameData frame;
+ host_impl_->active_tree()->BuildPropertyTreesForTesting();
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
ASSERT_EQ(3u, frame.render_passes.size());
diff --git a/cc/layers/draw_properties.h b/cc/layers/draw_properties.h
index 5a07af0..4dcd85e 100644
--- a/cc/layers/draw_properties.h
+++ b/cc/layers/draw_properties.h
@@ -25,7 +25,6 @@ struct CC_EXPORT DrawProperties {
target_space_transform_is_animating(false),
screen_space_transform_is_animating(false),
can_use_lcd_text(false),
- is_clipped(false),
render_target(nullptr),
num_unclipped_descendants(0),
layer_or_descendant_has_copy_request(false),
@@ -70,9 +69,6 @@ struct CC_EXPORT DrawProperties {
// True if the layer can use LCD text.
bool can_use_lcd_text;
- // True if the layer needs to be clipped by clip_rect.
- bool is_clipped;
-
// The layer whose coordinate space this layer draws into. This can be
// either the same layer (draw_properties_.render_target == this) or an
// ancestor of this layer.
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index b9867d6..e085802 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -1215,6 +1215,7 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
layer->SetShouldFlattenTransform(should_flatten_transform_);
layer->set_should_flatten_transform_from_property_tree(
should_flatten_transform_from_property_tree_);
+ layer->set_is_clipped(is_clipped_);
layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_);
if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating())
layer->SetTransformAndInvertibility(transform_, transform_is_invertible_);
@@ -1416,6 +1417,7 @@ void Layer::SetHasRenderSurface(bool has_render_surface) {
// We do not need SetNeedsCommit here, since this is only ever called
// during a commit, from CalculateDrawProperties.
SetNeedsPushProperties();
+ layer_tree_host_->property_trees()->needs_rebuild = true;
}
void Layer::CreateRenderSurface() {
diff --git a/cc/layers/layer.h b/cc/layers/layer.h
index 3ff2810..2d4d1ed 100644
--- a/cc/layers/layer.h
+++ b/cc/layers/layer.h
@@ -252,7 +252,6 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
bool screen_space_opacity_is_animating() const {
return draw_properties_.screen_space_opacity_is_animating;
}
- bool is_clipped() const { return draw_properties_.is_clipped; }
gfx::Rect clip_rect() const { return draw_properties_.clip_rect; }
gfx::Rect drawable_content_rect() const {
return draw_properties_.drawable_content_rect;
@@ -500,6 +499,14 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
return should_flatten_transform_from_property_tree_;
}
+ void set_is_clipped(bool is_clipped) {
+ if (is_clipped_ == is_clipped)
+ return;
+ is_clipped_ = is_clipped;
+ SetNeedsPushProperties();
+ }
+ bool is_clipped() const { return is_clipped_; }
+
// TODO(vollick): These values are temporary and will be removed as soon as
// render surface determinations are moved out of CDP. They only exist because
// certain logic depends on whether or not a layer would render to a separate
@@ -698,6 +705,7 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
int num_children_with_scroll_parent_;
gfx::Vector2dF offset_to_transform_parent_;
bool should_flatten_transform_from_property_tree_ : 1;
+ bool is_clipped_ : 1;
bool should_scroll_on_main_thread_ : 1;
bool have_wheel_event_handlers_ : 1;
bool have_scroll_event_handlers_ : 1;
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 42e2f70..5a943b0 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -60,6 +60,7 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl,
double_sided_(true),
should_flatten_transform_(true),
should_flatten_transform_from_property_tree_(false),
+ is_clipped_(false),
layer_property_changed_(false),
masks_to_bounds_(false),
contents_opaque_(false),
@@ -290,7 +291,7 @@ void LayerImpl::ClearRenderSurfaceLayerList() {
void LayerImpl::PopulateSharedQuadState(SharedQuadState* state) const {
state->SetAll(draw_properties_.target_space_transform, bounds(),
draw_properties_.visible_layer_rect, draw_properties_.clip_rect,
- draw_properties_.is_clipped, draw_properties_.opacity,
+ is_clipped_, draw_properties_.opacity,
draw_properties_.blend_mode, sorting_context_id_);
}
@@ -305,7 +306,7 @@ void LayerImpl::PopulateScaledSharedQuadState(SharedQuadState* state,
scaled_visible_layer_rect.Intersect(gfx::Rect(scaled_bounds));
state->SetAll(scaled_draw_transform, scaled_bounds, scaled_visible_layer_rect,
- draw_properties().clip_rect, draw_properties().is_clipped,
+ draw_properties().clip_rect, is_clipped_,
draw_properties().opacity, draw_properties().blend_mode,
sorting_context_id_);
}
@@ -546,6 +547,7 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
layer->SetShouldFlattenTransform(should_flatten_transform_);
layer->set_should_flatten_transform_from_property_tree(
should_flatten_transform_from_property_tree_);
+ layer->set_is_clipped(is_clipped_);
layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_);
layer->SetTransformAndInvertibility(transform_, transform_is_invertible_);
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index 57a0be1..2f424c3 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -183,6 +183,12 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
return should_flatten_transform_from_property_tree_;
}
+ void set_is_clipped(bool is_clipped) {
+ is_clipped_ = is_clipped;
+ SetNeedsPushProperties();
+ }
+ bool is_clipped() const { return is_clipped_; }
+
void UpdatePropertyTreeTransform();
void UpdatePropertyTreeOpacity();
void UpdatePropertyTreeScrollOffset();
@@ -393,7 +399,6 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
return draw_properties_.screen_space_opacity_is_animating;
}
bool can_use_lcd_text() const { return draw_properties_.can_use_lcd_text; }
- bool is_clipped() const { return draw_properties_.is_clipped; }
gfx::Rect clip_rect() const { return draw_properties_.clip_rect; }
gfx::Rect drawable_content_rect() const {
return draw_properties_.drawable_content_rect;
@@ -766,6 +771,7 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
bool double_sided_ : 1;
bool should_flatten_transform_ : 1;
bool should_flatten_transform_from_property_tree_ : 1;
+ bool is_clipped_ : 1;
// Tracks if drawing-related properties have changed since last redraw.
bool layer_property_changed_ : 1;
diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc
index 964b999..0676597 100644
--- a/cc/layers/layer_impl_unittest.cc
+++ b/cc/layers/layer_impl_unittest.cc
@@ -310,6 +310,7 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
// Unrelated functions, always set to new values, always set needs update.
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 4)));
+ host_impl.active_tree()->BuildPropertyTreesForTesting();
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true));
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true));
VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index 6e89caa..ce0956e 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -1333,6 +1333,7 @@ TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) {
pending_layer_->SetMaskLayer(mask_ptr.Pass());
pending_layer_->SetHasRenderSurface(true);
+ host_impl_.pending_tree()->BuildPropertyTreesForTesting();
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
bool update_lcd_text = false;
host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
@@ -1462,6 +1463,7 @@ TEST_F(PictureLayerImplTest, ScaledMaskLayer) {
pending_layer_->SetMaskLayer(mask_ptr.Pass());
pending_layer_->SetHasRenderSurface(true);
+ host_impl_.pending_tree()->BuildPropertyTreesForTesting();
host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1));
bool update_lcd_text = false;
host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text);
diff --git a/cc/test/fake_layer_tree_host_impl.cc b/cc/test/fake_layer_tree_host_impl.cc
index fe316a7..fba9a99 100644
--- a/cc/test/fake_layer_tree_host_impl.cc
+++ b/cc/test/fake_layer_tree_host_impl.cc
@@ -91,6 +91,7 @@ void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawProperties(
LayerTreeImpl* layerTree) {
RecursiveUpdateNumChildren(layerTree->root_layer());
bool update_lcd_text = false;
+ layerTree->BuildPropertyTreesForTesting();
layerTree->UpdateDrawProperties(update_lcd_text);
}
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 427a3c8..9989031 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -2047,7 +2047,7 @@ static void CalculateDrawPropertiesInternal(
// reduce how much would be drawn, and instead it would create unnecessary
// changes to scissor state affecting GPU performance. Our clip information
// is used in the recursion below, so we must set it beforehand.
- layer_draw_properties.is_clipped = layer_or_ancestor_clips_descendants;
+ DCHECK_EQ(layer_or_ancestor_clips_descendants, layer->is_clipped());
if (layer_or_ancestor_clips_descendants) {
layer_draw_properties.clip_rect = clip_rect_in_target_space;
} else {
@@ -2487,6 +2487,7 @@ void VerifyPropertyTreeValuesForLayer(LayerImpl* current_layer,
<< "expected: " << current_layer->draw_opacity()
<< " actual: " << DrawOpacityFromPropertyTrees(
current_layer, property_trees->opacity_tree);
+
const bool can_use_lcd_text_match =
CanUseLcdTextFromPropertyTrees(
current_layer, layers_always_allowed_lcd_text, can_use_lcd_text,
@@ -2536,22 +2537,6 @@ void CalculateDrawPropertiesAndVerify(LayerTreeHostCommon::CalcDrawPropsInputs<
inputs->verify_property_trees &&
(property_tree_option == BUILD_PROPERTY_TREES_IF_NEEDED);
- if (should_measure_property_tree_performance) {
- TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"),
- "LayerTreeHostCommon::CalculateDrawProperties");
- }
-
- std::vector<AccumulatedSurfaceState<LayerType>> accumulated_surface_state;
- CalculateDrawPropertiesInternal<LayerType>(
- inputs->root_layer, globals, data_for_recursion,
- inputs->render_surface_layer_list, &dummy_layer_list,
- &accumulated_surface_state, inputs->current_render_surface_layer_list_id);
-
- if (should_measure_property_tree_performance) {
- TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"),
- "LayerTreeHostCommon::CalculateDrawProperties");
- }
-
if (inputs->verify_property_trees) {
typename LayerType::LayerListType update_layer_list;
@@ -2594,10 +2579,27 @@ void CalculateDrawPropertiesAndVerify(LayerTreeHostCommon::CalcDrawPropsInputs<
break;
}
}
+ }
- VerifyPropertyTreeValues(inputs);
+ if (should_measure_property_tree_performance) {
+ TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"),
+ "LayerTreeHostCommon::CalculateDrawProperties");
}
+ std::vector<AccumulatedSurfaceState<LayerType>> accumulated_surface_state;
+ CalculateDrawPropertiesInternal<LayerType>(
+ inputs->root_layer, globals, data_for_recursion,
+ inputs->render_surface_layer_list, &dummy_layer_list,
+ &accumulated_surface_state, inputs->current_render_surface_layer_list_id);
+
+ if (should_measure_property_tree_performance) {
+ TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"),
+ "LayerTreeHostCommon::CalculateDrawProperties");
+ }
+
+ if (inputs->verify_property_trees)
+ VerifyPropertyTreeValues(inputs);
+
// The dummy layer list should not have been used.
DCHECK_EQ(0u, dummy_layer_list.size());
// A root layer render_surface should always exist after
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 43e2bb0..8d6a659 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -7176,6 +7176,7 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
// Add a mask layer to child.
child_raw->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 6).Pass());
+ child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
ExecuteCalculateDrawProperties(grand_parent_raw);
member_id = render_surface_layer_list_count();
@@ -7267,6 +7268,7 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
EXPECT_EQ(expected, actual);
child_raw->TakeMaskLayer();
+ child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
// Now everyone's a member!
grand_parent_raw->SetDrawsContent(true);
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index daa179f..e02990f 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -2310,6 +2310,7 @@ TEST_F(LayerTreeHostImplTest, DidDrawNotCalledOnHiddenLayer) {
EXPECT_FALSE(layer->will_draw_called());
EXPECT_FALSE(layer->did_draw_called());
+ host_impl_->active_tree()->BuildPropertyTreesForTesting();
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
host_impl_->DidDrawAllLayers(frame);
@@ -5632,6 +5633,7 @@ TEST_F(LayerTreeHostImplTest, NoPartialSwap) {
harness.MustSetScissor(0, 0, 10, 10);
{
LayerTreeHostImpl::FrameData frame;
+ host_impl_->active_tree()->BuildPropertyTreesForTesting();
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
host_impl_->DrawLayers(&frame);
host_impl_->DidDrawAllLayers(frame);
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index d4d2dee..7044a65 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -751,6 +751,7 @@ bool LayerTreeImpl::UpdateDrawProperties(bool update_lcd_text) {
}
void LayerTreeImpl::BuildPropertyTreesForTesting() {
+ LayerTreeHostCommon::PreCalculateMetaInformationForTesting(root_layer_.get());
PropertyTreeBuilder::BuildPropertyTrees(
root_layer_.get(), page_scale_layer_, inner_viewport_scroll_layer_,
outer_viewport_scroll_layer_, current_page_scale_factor(),
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index 81a566f..9e8fee5 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -972,6 +972,9 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsScrollParents) {
// This should cause scroll child and its descendants to be affected by
// |child|'s clip.
scroll_child->SetScrollParent(child.get());
+ scoped_ptr<std::set<LayerImpl*>> scroll_children(new std::set<LayerImpl*>);
+ scroll_children->insert(scroll_child.get());
+ child->SetScrollChildren(scroll_children.release());
SetLayerPropertiesForTesting(grand_child.get(), identity_matrix,
transform_origin, position, bounds, true,
diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc
index 28ad43f..8ad4407 100644
--- a/cc/trees/property_tree_builder.cc
+++ b/cc/trees/property_tree_builder.cc
@@ -100,7 +100,8 @@ void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor,
int parent_id = parent->id;
bool ancestor_clips_subtree =
- data_from_ancestor.ancestor_clips_subtree || layer->clip_parent();
+ data_from_ancestor.ancestor_clips_subtree ||
+ (layer->clip_parent() && layer->clip_parent()->is_clipped());
data_for_children->ancestor_clips_subtree = false;
bool has_unclipped_surface = false;
@@ -145,6 +146,8 @@ void AddClipNodeIfNeeded(const DataForRecursion<LayerType>& data_from_ancestor,
layer->SetClipTreeIndex(
has_unclipped_surface ? 0 : data_for_children->clip_tree_parent);
+ layer->set_is_clipped(data_for_children->ancestor_clips_subtree);
+
// TODO(awoloszyn): Right now when we hit a node with a replica, we reset the
// clip for all children since we may need to draw. We need to figure out a
// better way, since we will need both the clipped and unclipped versions.