summaryrefslogtreecommitdiffstats
path: root/cc/trees
diff options
context:
space:
mode:
authorvollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-15 18:22:27 +0000
committervollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-15 18:22:27 +0000
commit8d96434f9b5e6dca2ee4b6417bf7392b3c2a7b70 (patch)
tree9957e5b9a712851d9f38c46a9b5040553dea62f5 /cc/trees
parent40c2a1b88240d7bdb12c5cc0ac31788082793469 (diff)
downloadchromium_src-8d96434f9b5e6dca2ee4b6417bf7392b3c2a7b70.zip
chromium_src-8d96434f9b5e6dca2ee4b6417bf7392b3c2a7b70.tar.gz
chromium_src-8d96434f9b5e6dca2ee4b6417bf7392b3c2a7b70.tar.bz2
Remove hit-testing-only RSLL entries
As of https://codereview.chromium.org/266913021/ we no longer hit test via the RSLL; we walk the tree instead. This means we can remove the machinery added to allow hidden layers to appear in the RSLL for hit testing purposes. This is essentially a revert of https://codereview.chromium.org/25712004 R=danakj@chromium.org BUG=None Review URL: https://codereview.chromium.org/289973003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270742 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/trees')
-rw-r--r--cc/trees/layer_tree_host.cc2
-rw-r--r--cc/trees/layer_tree_host_common.cc15
-rw-r--r--cc/trees/layer_tree_host_impl.cc2
-rw-r--r--cc/trees/layer_tree_host_unittest.cc35
-rw-r--r--cc/trees/layer_tree_impl.h3
-rw-r--r--cc/trees/layer_tree_impl_unittest.cc104
-rw-r--r--cc/trees/occlusion_tracker.cc3
-rw-r--r--cc/trees/occlusion_tracker_unittest.cc39
8 files changed, 6 insertions, 197 deletions
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index e284014..67fe68b 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -1001,7 +1001,7 @@ void LayerTreeHost::PaintLayerContents(
if (it.represents_target_render_surface()) {
PaintMasksForRenderSurface(
*it, queue, did_paint_content, need_more_updates);
- } else if (it.represents_itself() && it->DrawsContent()) {
+ } else if (it.represents_itself()) {
DCHECK(!it->paint_properties().bounds.IsEmpty());
*did_paint_content |= it->Update(queue, &occlusion_tracker);
*need_more_updates |= it->NeedMoreUpdates();
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index a9af3ef..34f4553 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -431,10 +431,10 @@ static bool LayerShouldBeSkipped(LayerType* layer, bool layer_is_drawn) {
// Layers can be skipped if any of these conditions are met.
// - is not drawn due to it or one of its ancestors being hidden (or having
// no copy requests).
+ // - does not draw content.
+ // - is transparent.
// - has empty bounds
// - the layer is not double-sided, but its back face is visible.
- // - is transparent
- // - does not draw content and does not participate in hit testing.
//
// Some additional conditions need to be computed at a later point after the
// recursion is finished.
@@ -448,7 +448,7 @@ static bool LayerShouldBeSkipped(LayerType* layer, bool layer_is_drawn) {
if (!layer_is_drawn)
return true;
- if (layer->bounds().IsEmpty())
+ if (!layer->DrawsContent() || layer->bounds().IsEmpty())
return true;
LayerType* backface_test_layer = layer;
@@ -465,13 +465,6 @@ static bool LayerShouldBeSkipped(LayerType* layer, bool layer_is_drawn) {
IsLayerBackFaceVisible(backface_test_layer))
return true;
- // The layer is visible to events. If it's subject to hit testing, then
- // we can't skip it.
- bool can_accept_input = !layer->touch_event_handler_region().IsEmpty() ||
- layer->have_wheel_event_handlers();
- if (!layer->DrawsContent() && !can_accept_input)
- return true;
-
return false;
}
@@ -507,7 +500,6 @@ static inline bool SubtreeShouldBeSkipped(LayerImpl* layer,
// The opacity of a layer always applies to its children (either implicitly
// via a render surface or explicitly if the parent preserves 3D), so the
// entire subtree can be skipped if this layer is fully transparent.
- // TODO(sad): Don't skip layers used for hit testing crbug.com/295295.
return !layer->opacity();
}
@@ -531,7 +523,6 @@ static inline bool SubtreeShouldBeSkipped(Layer* layer, bool layer_is_drawn) {
// In particular, it should not cause the subtree to be skipped.
// Similarly, for layers that might animate opacity using an impl-only
// animation, their subtree should also not be skipped.
- // TODO(sad): Don't skip layers used for hit testing crbug.com/295295.
return !layer->opacity() && !layer->OpacityIsAnimating() &&
!layer->OpacityCanAnimateOnImplThread();
}
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index b51d6f9..eb2ba96 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -825,7 +825,7 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses(
contributing_render_pass,
occlusion_tracker,
&append_quads_data);
- } else if (it.represents_itself() && it->DrawsContent() &&
+ } else if (it.represents_itself() &&
!it->visible_content_rect().IsEmpty()) {
bool occluded = occlusion_tracker.Occluded(it->render_target(),
it->visible_content_rect(),
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 52ac0f6..888b0f6 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -4645,41 +4645,6 @@ class LayerTreeHostTestMemoryLimits : public LayerTreeHostTest {
SINGLE_AND_MULTI_THREAD_NOIMPL_TEST_F(LayerTreeHostTestMemoryLimits);
-class LayerTreeHostTestNoQuadsForEmptyLayer : public LayerTreeHostTest {
- protected:
- virtual void SetupTree() OVERRIDE {
- LayerTreeHostTest::SetupTree();
- root_layer_ = FakeContentLayer::Create(&client_);
- root_layer_->SetBounds(gfx::Size(10, 10));
- root_layer_->SetIsDrawable(false);
- root_layer_->SetHaveWheelEventHandlers(true);
- layer_tree_host()->SetRootLayer(root_layer_);
- LayerTreeHostTest::SetupTree();
- }
-
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
-
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
- FakeContentLayerImpl* layer_impl =
- static_cast<FakeContentLayerImpl*>(impl->RootLayer());
- EXPECT_FALSE(layer_impl->DrawsContent());
- EXPECT_EQ(0u, layer_impl->append_quads_count());
- }
-
- virtual void DidCommit() OVERRIDE {
- // The layer is not drawable, so it should not be updated.
- EXPECT_EQ(0u, root_layer_->update_count());
- EndTest();
- }
- virtual void AfterTest() OVERRIDE {}
-
- private:
- FakeContentLayerClient client_;
- scoped_refptr<FakeContentLayer> root_layer_;
-};
-
-SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoQuadsForEmptyLayer);
-
} // namespace
class LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h
index 5b740c3..d27e1e4 100644
--- a/cc/trees/layer_tree_impl.h
+++ b/cc/trees/layer_tree_impl.h
@@ -295,8 +295,7 @@ class CC_EXPORT LayerTreeImpl {
// Persisted state for non-impl-side-painting.
int scrolling_layer_id_from_previous_tree_;
- // List of visible or hit-testable layers for the most recently prepared
- // frame. Used for rendering and input event hit testing.
+ // List of visible layers for the most recently prepared frame.
LayerImplList render_surface_layer_list_;
bool use_gpu_rasterization_;
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index b27a06e..4a8259e 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -1185,110 +1185,6 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) {
EXPECT_EQ(4, result_layer->id());
}
-TEST_F(LayerTreeImplTest, HitTestingForEmptyLayers) {
- // Layer 1 - root
- scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
- gfx::Transform identity_matrix;
- gfx::PointF anchor;
- gfx::PointF position;
- gfx::Size bounds(100, 100);
- SetLayerPropertiesForTesting(
- root.get(), identity_matrix, anchor, position, bounds, true, false);
- root->SetDrawsContent(true);
-
- {
- // Layer 2 - empty: drawsContent=false
- gfx::PointF position(10.f, 10.f);
- gfx::Size bounds(30, 30);
- scoped_ptr<LayerImpl> empty_layer =
- LayerImpl::Create(host_impl().active_tree(), 2);
- SetLayerPropertiesForTesting(empty_layer.get(),
- identity_matrix,
- anchor,
- position,
- bounds,
- true,
- false);
-
- empty_layer->SetDrawsContent(false);
- root->AddChild(empty_layer.Pass());
- }
-
- {
- // Layer 3 - empty, but has touch handler
- gfx::PointF position(10.f, 60.f);
- gfx::Size bounds(30, 30);
- scoped_ptr<LayerImpl> test_layer =
- LayerImpl::Create(host_impl().active_tree(), 3);
- SetLayerPropertiesForTesting(test_layer.get(),
- identity_matrix,
- anchor,
- position,
- bounds,
- true,
- false);
-
- test_layer->SetDrawsContent(false);
- Region touch_handler_region(gfx::Rect(10, 10, 10, 10));
- test_layer->SetTouchEventHandlerRegion(touch_handler_region);
- root->AddChild(test_layer.Pass());
- }
-
- {
- // Layer 4 - empty, but has mousewheel handler
- gfx::PointF position(60.f, 60.f);
- gfx::Size bounds(30, 30);
- scoped_ptr<LayerImpl> test_layer =
- LayerImpl::Create(host_impl().active_tree(), 4);
- SetLayerPropertiesForTesting(test_layer.get(),
- identity_matrix,
- anchor,
- position,
- bounds,
- true,
- false);
-
- test_layer->SetDrawsContent(false);
- test_layer->SetHaveWheelEventHandlers(true);
- root->AddChild(test_layer.Pass());
- }
-
- host_impl().SetViewportSize(root->bounds());
- host_impl().active_tree()->SetRootLayer(root.Pass());
- host_impl().active_tree()->UpdateDrawProperties();
-
- // Verify that the root layer and empty layers with touch/wheel handlers
- // (but not the empty layer without a touch handler) are in the RSSL.
- ASSERT_EQ(1u, RenderSurfaceLayerList().size());
- EXPECT_EQ(1, RenderSurfaceLayerList()[0]->id());
- ASSERT_EQ(3u, root_layer()->render_surface()->layer_list().size());
- EXPECT_EQ(1, root_layer()->render_surface()->layer_list().at(0)->id());
- EXPECT_EQ(3, root_layer()->render_surface()->layer_list().at(1)->id());
- EXPECT_EQ(4, root_layer()->render_surface()->layer_list().at(2)->id());
-
- // Hit testing for a point inside the empty no-handlers layer should return
- // the root layer.
- gfx::Point test_point = gfx::Point(15, 15);
- LayerImpl* result_layer =
- host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
- ASSERT_TRUE(result_layer);
- EXPECT_EQ(1, result_layer->id());
-
- // Hit testing for a point inside the touch handler layer should return it.
- test_point = gfx::Point(15, 75);
- result_layer =
- host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
- ASSERT_TRUE(result_layer);
- EXPECT_EQ(3, result_layer->id());
-
- // Hit testing for a point inside the mousewheel layer should return it.
- test_point = gfx::Point(75, 75);
- result_layer =
- host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
- ASSERT_TRUE(result_layer);
- EXPECT_EQ(4, result_layer->id());
-}
-
TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
scoped_ptr<LayerImpl> root =
LayerImpl::Create(host_impl().active_tree(), 12345);
diff --git a/cc/trees/occlusion_tracker.cc b/cc/trees/occlusion_tracker.cc
index 94125be..ceb2d14 100644
--- a/cc/trees/occlusion_tracker.cc
+++ b/cc/trees/occlusion_tracker.cc
@@ -404,9 +404,6 @@ void OcclusionTracker<LayerType>::MarkOccludedBehindLayer(
if (stack_.empty())
return;
- if (!layer->DrawsContent())
- return;
-
if (!LayerOpacityKnown(layer) || layer->draw_opacity() < 1)
return;
diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc
index 8f083f5..4687dab 100644
--- a/cc/trees/occlusion_tracker_unittest.cc
+++ b/cc/trees/occlusion_tracker_unittest.cc
@@ -328,14 +328,6 @@ template <typename Types> class OcclusionTrackerTest : public testing::Test {
Types::TestLayerIterator::Begin(render_surface_layer_list_.get());
}
- void SetDrawsContent(LayerImpl* layer_impl, bool draws_content) {
- layer_impl->SetDrawsContent(draws_content);
- }
-
- void SetDrawsContent(Layer* layer, bool draws_content) {
- layer->SetIsDrawable(draws_content);
- }
-
void EnterLayer(typename Types::LayerType* layer,
typename Types::OcclusionTrackerType* occlusion) {
ASSERT_EQ(layer, *layer_iterator_);
@@ -3565,36 +3557,5 @@ class OcclusionTrackerTestHiddenCopyRequestDoesNotOcclude
ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestHiddenCopyRequestDoesNotOcclude)
-template <class Types>
-class OcclusionTrackerTestEmptyEventLayerDoesNotOcclude
- : public OcclusionTrackerTest<Types> {
- protected:
- explicit OcclusionTrackerTestEmptyEventLayerDoesNotOcclude(
- bool opaque_layers)
- : OcclusionTrackerTest<Types>(opaque_layers) {}
- void RunMyTest() {
- typename Types::ContentLayerType* root = this->CreateRoot(
- this->identity_matrix, gfx::Point(), gfx::Size(400, 400));
- typename Types::ContentLayerType* empty_layer = this->CreateDrawingLayer(
- root, this->identity_matrix, gfx::Point(), gfx::Size(200, 200), true);
- this->SetDrawsContent(empty_layer, false);
- empty_layer->SetTouchEventHandlerRegion(gfx::Rect(10, 10, 10, 10));
-
- this->CalcDrawEtc(root);
-
- TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion(
- gfx::Rect(0, 0, 1000, 1000));
-
- this->VisitLayer(empty_layer, &occlusion);
-
- EXPECT_EQ(gfx::Rect().ToString(),
- occlusion.occlusion_from_outside_target().ToString());
- EXPECT_EQ(gfx::Rect().ToString(),
- occlusion.occlusion_from_inside_target().ToString());
- }
-};
-
-ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestEmptyEventLayerDoesNotOcclude)
-
} // namespace
} // namespace cc