Commit 2869c922 authored by sunxd's avatar sunxd Committed by Commit Bot

Rename SurfaceLayer::hit_testable_ to surface_hit_testable_

We want to propagate pointer-events: none information to cc to generate
correct hit testing data for viz. The plan is to have blink set the hit
testable bit on cc::Layers. In order to disambiguate the bit in surface
layer that represents the origin of the surface, we want to rename the
variable.

Bug: 841358
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I207815dcfad0f29b222b0a39c350f1e926aedac9
Reviewed-on: https://chromium-review.googlesource.com/1052506Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarRobert Flack <flackr@chromium.org>
Commit-Queue: Xianda Sun <sunxd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558450}
parent d6365357
...@@ -59,10 +59,10 @@ void SurfaceLayer::SetStretchContentToFillBounds( ...@@ -59,10 +59,10 @@ void SurfaceLayer::SetStretchContentToFillBounds(
SetNeedsPushProperties(); SetNeedsPushProperties();
} }
void SurfaceLayer::SetHitTestable(bool hit_testable) { void SurfaceLayer::SetSurfaceHitTestable(bool surface_hit_testable) {
if (hit_testable_ == hit_testable) if (surface_hit_testable_ == surface_hit_testable)
return; return;
hit_testable_ = hit_testable; surface_hit_testable_ = surface_hit_testable;
SetNeedsPushProperties(); SetNeedsPushProperties();
} }
...@@ -100,7 +100,7 @@ void SurfaceLayer::PushPropertiesTo(LayerImpl* layer) { ...@@ -100,7 +100,7 @@ void SurfaceLayer::PushPropertiesTo(LayerImpl* layer) {
deadline_in_frames_ = 0u; deadline_in_frames_ = 0u;
layer_impl->SetFallbackSurfaceId(fallback_surface_id_); layer_impl->SetFallbackSurfaceId(fallback_surface_id_);
layer_impl->SetStretchContentToFillBounds(stretch_content_to_fill_bounds_); layer_impl->SetStretchContentToFillBounds(stretch_content_to_fill_bounds_);
layer_impl->SetHitTestable(hit_testable_); layer_impl->SetSurfaceHitTestable(surface_hit_testable_);
} }
} // namespace cc } // namespace cc
...@@ -32,8 +32,8 @@ class CC_EXPORT SurfaceLayer : public Layer { ...@@ -32,8 +32,8 @@ class CC_EXPORT SurfaceLayer : public Layer {
return stretch_content_to_fill_bounds_; return stretch_content_to_fill_bounds_;
} }
void SetHitTestable(bool hit_testable); void SetSurfaceHitTestable(bool surface_hit_testable);
bool hit_testable() const { return hit_testable_; } bool surface_hit_testable() const { return surface_hit_testable_; }
// Layer overrides. // Layer overrides.
std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
...@@ -64,7 +64,14 @@ class CC_EXPORT SurfaceLayer : public Layer { ...@@ -64,7 +64,14 @@ class CC_EXPORT SurfaceLayer : public Layer {
base::Optional<uint32_t> deadline_in_frames_ = 0u; base::Optional<uint32_t> deadline_in_frames_ = 0u;
bool stretch_content_to_fill_bounds_ = false; bool stretch_content_to_fill_bounds_ = false;
bool hit_testable_ = false;
// Whether or not the surface should submit hit test data when submitting
// compositor frame. The bit represents that the surface layer may be
// associated with an out-of-process iframe and viz hit testing needs to know
// the hit test information of that iframe. This bit is different from a layer
// being hit testable in the renderer, a hit testable surface layer may not
// be surface hit testable (e.g., a surface layer created by video).
bool surface_hit_testable_ = false;
DISALLOW_COPY_AND_ASSIGN(SurfaceLayer); DISALLOW_COPY_AND_ASSIGN(SurfaceLayer);
}; };
......
...@@ -54,11 +54,11 @@ void SurfaceLayerImpl::SetStretchContentToFillBounds(bool stretch_content) { ...@@ -54,11 +54,11 @@ void SurfaceLayerImpl::SetStretchContentToFillBounds(bool stretch_content) {
NoteLayerPropertyChanged(); NoteLayerPropertyChanged();
} }
void SurfaceLayerImpl::SetHitTestable(bool hit_testable) { void SurfaceLayerImpl::SetSurfaceHitTestable(bool surface_hit_testable) {
if (hit_testable_ == hit_testable) if (surface_hit_testable_ == surface_hit_testable)
return; return;
hit_testable_ = hit_testable; surface_hit_testable_ = surface_hit_testable;
NoteLayerPropertyChanged(); NoteLayerPropertyChanged();
} }
...@@ -71,7 +71,7 @@ void SurfaceLayerImpl::PushPropertiesTo(LayerImpl* layer) { ...@@ -71,7 +71,7 @@ void SurfaceLayerImpl::PushPropertiesTo(LayerImpl* layer) {
deadline_in_frames_ = 0u; deadline_in_frames_ = 0u;
layer_impl->SetFallbackSurfaceId(fallback_surface_id_); layer_impl->SetFallbackSurfaceId(fallback_surface_id_);
layer_impl->SetStretchContentToFillBounds(stretch_content_to_fill_bounds_); layer_impl->SetStretchContentToFillBounds(stretch_content_to_fill_bounds_);
layer_impl->SetHitTestable(hit_testable_); layer_impl->SetSurfaceHitTestable(surface_hit_testable_);
} }
void SurfaceLayerImpl::AppendQuads(viz::RenderPass* render_pass, void SurfaceLayerImpl::AppendQuads(viz::RenderPass* render_pass,
......
...@@ -50,8 +50,8 @@ class CC_EXPORT SurfaceLayerImpl : public LayerImpl { ...@@ -50,8 +50,8 @@ class CC_EXPORT SurfaceLayerImpl : public LayerImpl {
return stretch_content_to_fill_bounds_; return stretch_content_to_fill_bounds_;
} }
void SetHitTestable(bool hit_testable); void SetSurfaceHitTestable(bool surface_hit_testable);
bool hit_testable() const { return hit_testable_; } bool surface_hit_testable() const { return surface_hit_testable_; }
// LayerImpl overrides. // LayerImpl overrides.
std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
...@@ -79,7 +79,7 @@ class CC_EXPORT SurfaceLayerImpl : public LayerImpl { ...@@ -79,7 +79,7 @@ class CC_EXPORT SurfaceLayerImpl : public LayerImpl {
base::Optional<uint32_t> deadline_in_frames_; base::Optional<uint32_t> deadline_in_frames_;
bool stretch_content_to_fill_bounds_ = false; bool stretch_content_to_fill_bounds_ = false;
bool hit_testable_ = false; bool surface_hit_testable_ = false;
DISALLOW_COPY_AND_ASSIGN(SurfaceLayerImpl); DISALLOW_COPY_AND_ASSIGN(SurfaceLayerImpl);
}; };
......
...@@ -75,7 +75,7 @@ mojom::HitTestRegionListPtr HitTestDataProviderSurfaceLayer::GetHitTestData( ...@@ -75,7 +75,7 @@ mojom::HitTestRegionListPtr HitTestDataProviderSurfaceLayer::GetHitTestData(
const auto* surface_layer = const auto* surface_layer =
static_cast<const cc::SurfaceLayerImpl*>(layer); static_cast<const cc::SurfaceLayerImpl*>(layer);
if (!surface_layer->hit_testable()) { if (!surface_layer->surface_hit_testable()) {
overlapping_region.Union(cc::MathUtil::MapEnclosingClippedRect( overlapping_region.Union(cc::MathUtil::MapEnclosingClippedRect(
layer->ScreenSpaceTransform(), gfx::Rect(surface_layer->bounds()))); layer->ScreenSpaceTransform(), gfx::Rect(surface_layer->bounds())));
continue; continue;
......
...@@ -73,12 +73,12 @@ TEST(HitTestDataProviderSurfaceLayerTest, HitTestDataRenderer) { ...@@ -73,12 +73,12 @@ TEST(HitTestDataProviderSurfaceLayerTest, HitTestDataRenderer) {
rotate.Rotate(45); rotate.Rotate(45);
surface_child1->test_properties()->transform = rotate; surface_child1->test_properties()->transform = rotate;
surface_child1->SetDrawsContent(true); surface_child1->SetDrawsContent(true);
surface_child1->SetHitTestable(true); surface_child1->SetSurfaceHitTestable(true);
surface_child2->SetPosition(gfx::PointF(450, 300)); surface_child2->SetPosition(gfx::PointF(450, 300));
surface_child2->SetBounds(gfx::Size(100, 100)); surface_child2->SetBounds(gfx::Size(100, 100));
surface_child2->SetDrawsContent(true); surface_child2->SetDrawsContent(true);
surface_child2->SetHitTestable(true); surface_child2->SetSurfaceHitTestable(true);
overlapping_layer->SetPosition(gfx::PointF(500, 350)); overlapping_layer->SetPosition(gfx::PointF(500, 350));
overlapping_layer->SetBounds(gfx::Size(200, 200)); overlapping_layer->SetBounds(gfx::Size(200, 200));
......
...@@ -82,7 +82,7 @@ void ChildFrameCompositingHelper::SetPrimarySurfaceId( ...@@ -82,7 +82,7 @@ void ChildFrameCompositingHelper::SetPrimarySurfaceId(
surface_layer_ = cc::SurfaceLayer::Create(); surface_layer_ = cc::SurfaceLayer::Create();
surface_layer_->SetMasksToBounds(true); surface_layer_->SetMasksToBounds(true);
surface_layer_->SetHitTestable(true); surface_layer_->SetSurfaceHitTestable(true);
surface_layer_->SetBackgroundColor(SK_ColorTRANSPARENT); surface_layer_->SetBackgroundColor(SK_ColorTRANSPARENT);
surface_layer_->SetPrimarySurfaceId(surface_id, deadline); surface_layer_->SetPrimarySurfaceId(surface_id, deadline);
......
...@@ -50,7 +50,7 @@ scoped_refptr<cc::SurfaceLayer> CreateSurfaceLayer( ...@@ -50,7 +50,7 @@ scoped_refptr<cc::SurfaceLayer> CreateSurfaceLayer(
layer->SetBounds(size_in_pixels); layer->SetBounds(size_in_pixels);
layer->SetIsDrawable(true); layer->SetIsDrawable(true);
layer->SetContentsOpaque(surface_opaque); layer->SetContentsOpaque(surface_opaque);
layer->SetHitTestable(true); layer->SetSurfaceHitTestable(true);
return layer; return layer;
} }
......
...@@ -775,7 +775,7 @@ void Layer::SetShowPrimarySurface(const viz::SurfaceId& surface_id, ...@@ -775,7 +775,7 @@ void Layer::SetShowPrimarySurface(const viz::SurfaceId& surface_id,
if (!surface_layer_) { if (!surface_layer_) {
scoped_refptr<cc::SurfaceLayer> new_layer = cc::SurfaceLayer::Create(); scoped_refptr<cc::SurfaceLayer> new_layer = cc::SurfaceLayer::Create();
new_layer->SetHitTestable(true); new_layer->SetSurfaceHitTestable(true);
SwitchToLayer(new_layer); SwitchToLayer(new_layer);
surface_layer_ = new_layer; surface_layer_ = new_layer;
} }
......
...@@ -905,16 +905,16 @@ TEST_F(LayerWithDelegateTest, SurfaceLayerCloneAndMirror) { ...@@ -905,16 +905,16 @@ TEST_F(LayerWithDelegateTest, SurfaceLayerCloneAndMirror) {
cc::DeadlinePolicy::UseDefaultDeadline(), false); cc::DeadlinePolicy::UseDefaultDeadline(), false);
EXPECT_FALSE(layer->StretchContentToFillBounds()); EXPECT_FALSE(layer->StretchContentToFillBounds());
EXPECT_TRUE(static_cast<cc::SurfaceLayer*>(layer->cc_layer_for_testing()) EXPECT_TRUE(static_cast<cc::SurfaceLayer*>(layer->cc_layer_for_testing())
->hit_testable()); ->surface_hit_testable());
auto clone = layer->Clone(); auto clone = layer->Clone();
EXPECT_FALSE(clone->StretchContentToFillBounds()); EXPECT_FALSE(clone->StretchContentToFillBounds());
EXPECT_TRUE(static_cast<cc::SurfaceLayer*>(clone->cc_layer_for_testing()) EXPECT_TRUE(static_cast<cc::SurfaceLayer*>(clone->cc_layer_for_testing())
->hit_testable()); ->surface_hit_testable());
auto mirror = layer->Mirror(); auto mirror = layer->Mirror();
EXPECT_FALSE(mirror->StretchContentToFillBounds()); EXPECT_FALSE(mirror->StretchContentToFillBounds());
EXPECT_TRUE(static_cast<cc::SurfaceLayer*>(mirror->cc_layer_for_testing()) EXPECT_TRUE(static_cast<cc::SurfaceLayer*>(mirror->cc_layer_for_testing())
->hit_testable()); ->surface_hit_testable());
local_surface_id = allocator.GenerateId(); local_surface_id = allocator.GenerateId();
viz::SurfaceId surface_id_two(arbitrary_frame_sink, local_surface_id); viz::SurfaceId surface_id_two(arbitrary_frame_sink, local_surface_id);
...@@ -922,16 +922,16 @@ TEST_F(LayerWithDelegateTest, SurfaceLayerCloneAndMirror) { ...@@ -922,16 +922,16 @@ TEST_F(LayerWithDelegateTest, SurfaceLayerCloneAndMirror) {
cc::DeadlinePolicy::UseDefaultDeadline(), true); cc::DeadlinePolicy::UseDefaultDeadline(), true);
EXPECT_TRUE(layer->StretchContentToFillBounds()); EXPECT_TRUE(layer->StretchContentToFillBounds());
EXPECT_TRUE(static_cast<cc::SurfaceLayer*>(layer->cc_layer_for_testing()) EXPECT_TRUE(static_cast<cc::SurfaceLayer*>(layer->cc_layer_for_testing())
->hit_testable()); ->surface_hit_testable());
clone = layer->Clone(); clone = layer->Clone();
EXPECT_TRUE(clone->StretchContentToFillBounds()); EXPECT_TRUE(clone->StretchContentToFillBounds());
EXPECT_TRUE(static_cast<cc::SurfaceLayer*>(clone->cc_layer_for_testing()) EXPECT_TRUE(static_cast<cc::SurfaceLayer*>(clone->cc_layer_for_testing())
->hit_testable()); ->surface_hit_testable());
mirror = layer->Mirror(); mirror = layer->Mirror();
EXPECT_TRUE(mirror->StretchContentToFillBounds()); EXPECT_TRUE(mirror->StretchContentToFillBounds());
EXPECT_TRUE(static_cast<cc::SurfaceLayer*>(mirror->cc_layer_for_testing()) EXPECT_TRUE(static_cast<cc::SurfaceLayer*>(mirror->cc_layer_for_testing())
->hit_testable()); ->surface_hit_testable());
} }
class LayerWithNullDelegateTest : public LayerWithDelegateTest { class LayerWithNullDelegateTest : public LayerWithDelegateTest {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment