summaryrefslogtreecommitdiffstats
path: root/cc/trees
diff options
context:
space:
mode:
authorjaydasika <jaydasika@chromium.org>2015-07-14 08:15:04 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-14 15:16:04 +0000
commitd36e7fa1ce7503fa9c64e3271e1a831c5f3aec50 (patch)
treeeedacbefb51ef514b84e78ad8ef7b98deb397052 /cc/trees
parenta8c375bf808b8b169e4303deeac4cce20c786d29 (diff)
downloadchromium_src-d36e7fa1ce7503fa9c64e3271e1a831c5f3aec50.zip
chromium_src-d36e7fa1ce7503fa9c64e3271e1a831c5f3aec50.tar.gz
chromium_src-d36e7fa1ce7503fa9c64e3271e1a831c5f3aec50.tar.bz2
Compute if a layer is clipped outside CalcDrawProps
We need to know if a layer is clipped to compute its drawable visible rect. So, we need to compute it outside CalcDrawProps to move drawable visible rect computation outside CalcDrawProps. Committed: https://crrev.com/2af7226e29be65a8ea4a279b9358a6fcfada5cd3 Cr-Commit-Position: refs/heads/master@{#338515} CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1231453002 Cr-Commit-Position: refs/heads/master@{#338691}
Diffstat (limited to 'cc/trees')
-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
6 files changed, 32 insertions, 19 deletions
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 68074dd..f1a5d5f 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -7050,6 +7050,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();
@@ -7141,6 +7142,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 6ded33b..258d5cc 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);
@@ -5650,6 +5651,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 8f351f0..14e9dc5 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.