summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordtapuska <dtapuska@chromium.org>2016-01-29 07:14:48 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-29 15:15:37 +0000
commitee0b6981de62e9a234d031eab793da8d7752197b (patch)
treeef42a954bec374daaf7ca14a16a52e361c22ae56
parentc068fa909f540cc362576559c7eb9e205918f0a1 (diff)
downloadchromium_src-ee0b6981de62e9a234d031eab793da8d7752197b.zip
chromium_src-ee0b6981de62e9a234d031eab793da8d7752197b.tar.gz
chromium_src-ee0b6981de62e9a234d031eab793da8d7752197b.tar.bz2
Move have_wheel_event_handlers to WebLayerTreeView.
Since having wheel event handlers was based on the document in general there was no need for the hit testing code for determining the layer in cc. So it makes more sense to have these fields on the layer tree view. BUG=489802 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1639363002 Cr-Commit-Position: refs/heads/master@{#372346}
-rw-r--r--cc/blink/web_layer_impl.cc8
-rw-r--r--cc/blink/web_layer_impl.h2
-rw-r--r--cc/debug/debug_rect_history.cc3
-rw-r--r--cc/input/input_handler.h2
-rw-r--r--cc/layers/layer.cc13
-rw-r--r--cc/layers/layer.h4
-rw-r--r--cc/layers/layer_impl.cc15
-rw-r--r--cc/layers/layer_impl.h22
-rw-r--r--cc/layers/layer_unittest.cc5
-rw-r--r--cc/proto/layer.proto1
-rw-r--r--cc/proto/layer_tree_host.proto1
-rw-r--r--cc/test/layer_tree_json_parser.cc4
-rw-r--r--cc/test/layer_tree_json_parser_unittest.cc3
-rw-r--r--cc/trees/draw_property_utils.cc4
-rw-r--r--cc/trees/layer_tree_host.cc12
-rw-r--r--cc/trees/layer_tree_host.h5
-rw-r--r--cc/trees/layer_tree_host_common.cc26
-rw-r--r--cc/trees/layer_tree_host_common_unittest.cc12
-rw-r--r--cc/trees/layer_tree_host_impl.cc12
-rw-r--r--cc/trees/layer_tree_host_impl.h2
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc5
-rw-r--r--cc/trees/layer_tree_host_unittest.cc2
-rw-r--r--cc/trees/layer_tree_impl.cc27
-rw-r--r--cc/trees/layer_tree_impl.h11
-rw-r--r--content/renderer/gpu/render_widget_compositor.cc8
-rw-r--r--content/renderer/gpu/render_widget_compositor.h2
-rw-r--r--content/test/web_layer_tree_view_impl_for_testing.cc9
-rw-r--r--content/test/web_layer_tree_view_impl_for_testing.h2
-rw-r--r--third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp3
-rw-r--r--third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp22
-rw-r--r--third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h2
-rw-r--r--third_party/WebKit/Source/core/loader/EmptyClients.h3
-rw-r--r--third_party/WebKit/Source/core/page/ChromeClient.h2
-rw-r--r--third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp14
-rw-r--r--third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h1
-rw-r--r--third_party/WebKit/Source/web/ChromeClientImpl.cpp13
-rw-r--r--third_party/WebKit/Source/web/ChromeClientImpl.h2
-rw-r--r--third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp7
-rw-r--r--third_party/WebKit/public/platform/WebLayer.h3
-rw-r--r--third_party/WebKit/public/platform/WebLayerTreeView.h5
-rw-r--r--ui/events/blink/input_handler_proxy.cc3
-rw-r--r--ui/events/blink/input_handler_proxy_unittest.cc8
42 files changed, 138 insertions, 172 deletions
diff --git a/cc/blink/web_layer_impl.cc b/cc/blink/web_layer_impl.cc
index 335861e..6d0e593 100644
--- a/cc/blink/web_layer_impl.cc
+++ b/cc/blink/web_layer_impl.cc
@@ -320,14 +320,6 @@ bool WebLayerImpl::userScrollableVertical() const {
return layer_->user_scrollable_vertical();
}
-void WebLayerImpl::setHaveWheelEventHandlers(bool have_wheel_event_handlers) {
- layer_->SetHaveWheelEventHandlers(have_wheel_event_handlers);
-}
-
-bool WebLayerImpl::haveWheelEventHandlers() const {
- return layer_->have_wheel_event_handlers();
-}
-
void WebLayerImpl::setHaveScrollEventHandlers(bool have_scroll_event_handlers) {
layer_->SetHaveScrollEventHandlers(have_scroll_event_handlers);
}
diff --git a/cc/blink/web_layer_impl.h b/cc/blink/web_layer_impl.h
index 4ec3290..5718738 100644
--- a/cc/blink/web_layer_impl.h
+++ b/cc/blink/web_layer_impl.h
@@ -121,8 +121,6 @@ class WebLayerImpl : public blink::WebLayer {
void setUserScrollable(bool horizontal, bool vertical) override;
bool userScrollableHorizontal() const override;
bool userScrollableVertical() const override;
- void setHaveWheelEventHandlers(bool have_wheel_event_handlers) override;
- bool haveWheelEventHandlers() const override;
void setHaveScrollEventHandlers(bool have_scroll_event_handlers) override;
bool haveScrollEventHandlers() const override;
void addMainThreadScrollingReasons(
diff --git a/cc/debug/debug_rect_history.cc b/cc/debug/debug_rect_history.cc
index 5ac2b5d..33896f8 100644
--- a/cc/debug/debug_rect_history.cc
+++ b/cc/debug/debug_rect_history.cc
@@ -14,6 +14,7 @@
#include "cc/trees/damage_tracker.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_host_common.h"
+#include "cc/trees/layer_tree_impl.h"
#include "ui/gfx/geometry/rect_conversions.h"
namespace cc {
@@ -180,7 +181,7 @@ void DebugRectHistory::SaveWheelEventHandlerRects(LayerImpl* layer) {
}
void DebugRectHistory::SaveWheelEventHandlerRectsCallback(LayerImpl* layer) {
- if (!layer->have_wheel_event_handlers())
+ if (!layer->layer_tree_impl()->have_wheel_event_handlers())
return;
debug_rects_.push_back(
diff --git a/cc/input/input_handler.h b/cc/input/input_handler.h
index 3ffd220..449c471 100644
--- a/cc/input/input_handler.h
+++ b/cc/input/input_handler.h
@@ -170,7 +170,7 @@ class CC_EXPORT InputHandler {
virtual bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point,
ScrollInputType type) const = 0;
- virtual bool HaveWheelEventHandlersAt(const gfx::Point& viewport_point) = 0;
+ virtual bool HaveWheelEventHandlers() const = 0;
// Whether the page should be given the opportunity to suppress scrolling by
// consuming touch events that started at |viewport_point|.
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 97c770f..0dfa3db 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -71,7 +71,6 @@ Layer::Layer(const LayerSettings& settings)
main_thread_scrolling_reasons_(
MainThreadScrollingReason::kNotScrollingOnMain),
should_flatten_transform_from_property_tree_(false),
- have_wheel_event_handlers_(false),
have_scroll_event_handlers_(false),
user_scrollable_horizontal_(true),
user_scrollable_vertical_(true),
@@ -971,15 +970,6 @@ void Layer::ClearMainThreadScrollingReasons() {
SetNeedsCommit();
}
-void Layer::SetHaveWheelEventHandlers(bool have_wheel_event_handlers) {
- DCHECK(IsPropertyChangeAllowed());
- if (have_wheel_event_handlers_ == have_wheel_event_handlers)
- return;
-
- have_wheel_event_handlers_ = have_wheel_event_handlers;
- SetNeedsCommit();
-}
-
void Layer::SetHaveScrollEventHandlers(bool have_scroll_event_handlers) {
DCHECK(IsPropertyChangeAllowed());
if (have_scroll_event_handlers_ == have_scroll_event_handlers)
@@ -1223,7 +1213,6 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
layer->SetBackgroundFilters(background_filters());
layer->SetMasksToBounds(masks_to_bounds_);
layer->set_main_thread_scrolling_reasons(main_thread_scrolling_reasons_);
- layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_);
layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_);
layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
layer->SetTouchEventHandlerRegion(touch_event_handler_region_);
@@ -1493,7 +1482,6 @@ void Layer::LayerSpecificPropertiesToProto(proto::LayerProperties* proto) {
base->set_masks_to_bounds(masks_to_bounds_);
base->set_main_thread_scrolling_reasons(main_thread_scrolling_reasons_);
- base->set_have_wheel_event_handlers(have_wheel_event_handlers_);
base->set_have_scroll_event_handlers(have_scroll_event_handlers_);
RegionToProto(non_fast_scrollable_region_,
base->mutable_non_fast_scrollable_region());
@@ -1579,7 +1567,6 @@ void Layer::FromLayerSpecificPropertiesProto(
has_render_surface_ = base.has_render_surface();
masks_to_bounds_ = base.masks_to_bounds();
main_thread_scrolling_reasons_ = base.main_thread_scrolling_reasons();
- have_wheel_event_handlers_ = base.have_wheel_event_handlers();
have_scroll_event_handlers_ = base.have_scroll_event_handlers();
non_fast_scrollable_region_ =
RegionFromProto(base.non_fast_scrollable_region());
diff --git a/cc/layers/layer.h b/cc/layers/layer.h
index 529c384..2b4272b 100644
--- a/cc/layers/layer.h
+++ b/cc/layers/layer.h
@@ -284,9 +284,6 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
return !!main_thread_scrolling_reasons_;
}
- void SetHaveWheelEventHandlers(bool have_wheel_event_handlers);
- bool have_wheel_event_handlers() const { return have_wheel_event_handlers_; }
-
void SetHaveScrollEventHandlers(bool have_scroll_event_handlers);
bool have_scroll_event_handlers() const {
return have_scroll_event_handlers_;
@@ -723,7 +720,6 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
gfx::Vector2dF offset_to_transform_parent_;
uint32_t main_thread_scrolling_reasons_;
bool should_flatten_transform_from_property_tree_ : 1;
- bool have_wheel_event_handlers_ : 1;
bool have_scroll_event_handlers_ : 1;
bool user_scrollable_horizontal_ : 1;
bool user_scrollable_vertical_ : 1;
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 1526be4..1b620ad 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -60,7 +60,6 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl,
scroll_clip_layer_id_(Layer::INVALID_ID),
main_thread_scrolling_reasons_(
MainThreadScrollingReason::kNotScrollingOnMain),
- have_wheel_event_handlers_(false),
have_scroll_event_handlers_(false),
user_scrollable_horizontal_(true),
user_scrollable_vertical_(true),
@@ -99,7 +98,7 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl,
frame_timing_requests_dirty_(false),
visited_(false),
layer_or_descendant_is_drawn_(false),
- layer_or_descendant_has_input_handler_(false),
+ layer_or_descendant_has_touch_handler_(false),
sorted_for_recursion_(false) {
DCHECK_GT(layer_id_, 0);
DCHECK(layer_tree_impl_);
@@ -557,7 +556,7 @@ InputHandler::ScrollStatus LayerImpl::TryScroll(
}
if ((type == InputHandler::WHEEL || type == InputHandler::ANIMATED_WHEEL) &&
- have_wheel_event_handlers()) {
+ layer_tree_impl_->have_wheel_event_handlers()) {
TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed WheelEventHandlers");
scroll_status.thread = InputHandler::SCROLL_ON_MAIN_THREAD;
scroll_status.main_thread_scrolling_reasons =
@@ -615,7 +614,6 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
layer->SetBackgroundFilters(background_filters());
layer->SetMasksToBounds(masks_to_bounds_);
layer->set_main_thread_scrolling_reasons(main_thread_scrolling_reasons_);
- layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_);
layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_);
layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
layer->SetTouchEventHandlerRegion(touch_event_handler_region_);
@@ -765,8 +763,6 @@ base::DictionaryValue* LayerImpl::LayerTreeAsJson() const {
if (scrollable())
result->SetBoolean("Scrollable", true);
- if (have_wheel_event_handlers_)
- result->SetBoolean("WheelHandler", have_wheel_event_handlers_);
if (have_scroll_event_handlers_)
result->SetBoolean("ScrollHandler", have_scroll_event_handlers_);
if (!touch_event_handler_region_.IsEmpty()) {
@@ -1730,13 +1726,6 @@ void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const {
touch_event_handler_region_.AsValueInto(state);
state->EndArray();
}
- if (have_wheel_event_handlers_) {
- gfx::Rect wheel_rect(bounds());
- Region wheel_region(wheel_rect);
- state->BeginArray("wheel_event_handler_region");
- wheel_region.AsValueInto(state);
- state->EndArray();
- }
if (have_scroll_event_handlers_) {
gfx::Rect scroll_rect(bounds());
Region scroll_region(scroll_rect);
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index ec5a609..fe3c1c7 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -503,11 +503,6 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
return !!main_thread_scrolling_reasons_;
}
- void SetHaveWheelEventHandlers(bool have_wheel_event_handlers) {
- have_wheel_event_handlers_ = have_wheel_event_handlers;
- }
- bool have_wheel_event_handlers() const { return have_wheel_event_handlers_; }
-
void SetHaveScrollEventHandlers(bool have_scroll_event_handlers) {
have_scroll_event_handlers_ = have_scroll_event_handlers;
}
@@ -663,14 +658,14 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
bool layer_or_descendant_is_drawn() { return layer_or_descendant_is_drawn_; }
- void set_layer_or_descendant_has_input_handler(
- bool layer_or_descendant_has_input_handler) {
- layer_or_descendant_has_input_handler_ =
- layer_or_descendant_has_input_handler;
+ void set_layer_or_descendant_has_touch_handler(
+ bool layer_or_descendant_has_touch_handler) {
+ layer_or_descendant_has_touch_handler_ =
+ layer_or_descendant_has_touch_handler;
}
- bool layer_or_descendant_has_input_handler() {
- return layer_or_descendant_has_input_handler_;
+ bool layer_or_descendant_has_touch_handler() {
+ return layer_or_descendant_has_touch_handler_;
}
void set_sorted_for_recursion(bool sorted_for_recursion) {
@@ -766,7 +761,6 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
gfx::Vector2dF offset_to_transform_parent_;
uint32_t main_thread_scrolling_reasons_;
- bool have_wheel_event_handlers_ : 1;
bool have_scroll_event_handlers_ : 1;
bool user_scrollable_horizontal_ : 1;
@@ -881,8 +875,8 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
bool frame_timing_requests_dirty_;
bool visited_;
bool layer_or_descendant_is_drawn_;
- // If true, the layer or one of its descendants has a wheel or touch handler.
- bool layer_or_descendant_has_input_handler_;
+ // If true, the layer or one of its descendants has a touch handler.
+ bool layer_or_descendant_has_touch_handler_;
bool sorted_for_recursion_;
DISALLOW_COPY_AND_ASSIGN(LayerImpl);
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc
index 48f7342..76e41ca 100644
--- a/cc/layers/layer_unittest.cc
+++ b/cc/layers/layer_unittest.cc
@@ -134,8 +134,6 @@ class LayerSerializationTest : public testing::Test {
EXPECT_EQ(src->masks_to_bounds_, dest->masks_to_bounds_);
EXPECT_EQ(src->main_thread_scrolling_reasons_,
dest->main_thread_scrolling_reasons_);
- EXPECT_EQ(src->have_wheel_event_handlers_,
- dest->have_wheel_event_handlers_);
EXPECT_EQ(src->have_scroll_event_handlers_,
dest->have_scroll_event_handlers_);
EXPECT_EQ(src->non_fast_scrollable_region_,
@@ -251,7 +249,6 @@ class LayerSerializationTest : public testing::Test {
layer->masks_to_bounds_ = true;
layer->main_thread_scrolling_reasons_ =
MainThreadScrollingReason::kNotScrollingOnMain;
- layer->have_wheel_event_handlers_ = true;
layer->have_scroll_event_handlers_ = false;
layer->non_fast_scrollable_region_ = Region(gfx::Rect(5, 1, 14, 3));
layer->touch_event_handler_region_ = Region(gfx::Rect(3, 14, 1, 5));
@@ -301,7 +298,6 @@ class LayerSerializationTest : public testing::Test {
layer->masks_to_bounds_ = !layer->masks_to_bounds_;
layer->main_thread_scrolling_reasons_ =
MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects;
- layer->have_wheel_event_handlers_ = !layer->have_wheel_event_handlers_;
layer->have_scroll_event_handlers_ = !layer->have_scroll_event_handlers_;
layer->non_fast_scrollable_region_ = Region(gfx::Rect(5, 1, 14, 3));
layer->touch_event_handler_region_ = Region(gfx::Rect(3, 14, 1, 5));
@@ -970,7 +966,6 @@ TEST_F(LayerTest, CheckPropertyChangeCausesCorrectBehavior) {
MainThreadScrollingReason::kEventHandlers));
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetNonFastScrollableRegion(
Region(gfx::Rect(1, 1, 2, 2))));
- EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHaveWheelEventHandlers(true));
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHaveScrollEventHandlers(true));
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform(
gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)));
diff --git a/cc/proto/layer.proto b/cc/proto/layer.proto
index 2244528..015c8ea 100644
--- a/cc/proto/layer.proto
+++ b/cc/proto/layer.proto
@@ -88,7 +88,6 @@ message BaseLayerProperties {
// repeated FilterOperation background_filters = 13;
optional bool masks_to_bounds = 14;
optional uint32 main_thread_scrolling_reasons = 15;
- optional bool have_wheel_event_handlers = 16;
optional bool have_scroll_event_handlers = 17;
optional Region non_fast_scrollable_region = 18;
optional Region touch_event_handler_region = 19;
diff --git a/cc/proto/layer_tree_host.proto b/cc/proto/layer_tree_host.proto
index 432c1f6..b601bc1 100644
--- a/cc/proto/layer_tree_host.proto
+++ b/cc/proto/layer_tree_host.proto
@@ -53,4 +53,5 @@ message LayerTreeHost {
optional PropertyTrees property_trees = 31;
optional uint32 surface_id_namespace = 32;
optional uint32 next_surface_sequence = 33;
+ optional bool have_wheel_event_handlers = 34;
}
diff --git a/cc/test/layer_tree_json_parser.cc b/cc/test/layer_tree_json_parser.cc
index 1c91f66..eff1302 100644
--- a/cc/test/layer_tree_json_parser.cc
+++ b/cc/test/layer_tree_json_parser.cc
@@ -125,10 +125,6 @@ scoped_refptr<Layer> ParseTreeFromValue(base::Value* val,
new_layer->SetScrollClipLayerId(scrollable ? new_layer->id()
: Layer::INVALID_ID);
- bool wheel_handler;
- if (dict->GetBoolean("WheelHandler", &wheel_handler))
- new_layer->SetHaveWheelEventHandlers(wheel_handler);
-
bool scroll_handler;
if (dict->GetBoolean("ScrollHandler", &scroll_handler))
new_layer->SetHaveScrollEventHandlers(scroll_handler);
diff --git a/cc/test/layer_tree_json_parser_unittest.cc b/cc/test/layer_tree_json_parser_unittest.cc
index f111032..bb3e114 100644
--- a/cc/test/layer_tree_json_parser_unittest.cc
+++ b/cc/test/layer_tree_json_parser_unittest.cc
@@ -41,8 +41,6 @@ bool LayerTreesMatch(LayerImpl* const layer_impl,
layer->scrollable()));
RETURN_IF_EXPECTATION_FAILS(EXPECT_FLOAT_EQ(layer_impl->opacity(),
layer->opacity()));
- RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->have_wheel_event_handlers(),
- layer->have_wheel_event_handlers()));
RETURN_IF_EXPECTATION_FAILS(
EXPECT_EQ(layer_impl->have_scroll_event_handlers(),
layer->have_scroll_event_handlers()));
@@ -82,7 +80,6 @@ TEST_F(LayerTreeJsonParserSanityCheck, Basic) {
parent->SetPosition(gfx::PointF(25.f, 25.f));
- child->SetHaveWheelEventHandlers(true);
child->SetHaveScrollEventHandlers(true);
parent->AddChild(std::move(child));
diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc
index cb0a6e5..342dcb6 100644
--- a/cc/trees/draw_property_utils.cc
+++ b/cc/trees/draw_property_utils.cc
@@ -334,13 +334,13 @@ static inline bool SubtreeShouldBeSkipped(LayerImpl* layer,
if (layer->num_copy_requests_in_target_subtree() > 0)
return false;
- // We cannot skip the the subtree if a descendant has a wheel or touch handler
+ // We cannot skip the the subtree if a descendant has a touch handler
// or the hit testing code will break (it requires fresh transforms, etc).
// Though we don't need visible rect for hit testing, we need render surface's
// drawable content rect which depends on layer's drawable content rect which
// in turn depends on layer's clip rect that is computed while computing
// visible rects.
- if (layer->layer_or_descendant_has_input_handler())
+ if (layer->layer_or_descendant_has_touch_handler())
return false;
// If the layer is not drawn, then skip it and its subtree.
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 881cff8..529beae 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -183,6 +183,7 @@ LayerTreeHost::LayerTreeHost(InitParams* params, CompositorMode mode)
gpu_rasterization_histogram_recorded_(false),
background_color_(SK_ColorWHITE),
has_transparent_background_(false),
+ have_wheel_event_handlers_(false),
did_complete_scale_animation_(false),
in_paint_layer_contents_(false),
id_(s_layer_tree_host_sequence_number.GetNext() + 1),
@@ -391,6 +392,7 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
sync_tree->set_background_color(background_color_);
sync_tree->set_has_transparent_background(has_transparent_background_);
+ sync_tree->set_have_wheel_event_handlers(have_wheel_event_handlers_);
if (page_scale_layer_.get() && inner_viewport_scroll_layer_.get()) {
sync_tree->SetViewportLayersFromIds(
@@ -1105,6 +1107,14 @@ void LayerTreeHost::RegisterSelection(const LayerSelection& selection) {
SetNeedsCommit();
}
+void LayerTreeHost::SetHaveWheelEventHandlers(bool have_event_handlers) {
+ if (have_wheel_event_handlers_ == have_event_handlers)
+ return;
+
+ have_wheel_event_handlers_ = have_event_handlers;
+ SetNeedsCommit();
+}
+
int LayerTreeHost::ScheduleMicroBenchmark(
const std::string& benchmark_name,
scoped_ptr<base::Value> value,
@@ -1430,6 +1440,7 @@ void LayerTreeHost::ToProtobufForCommit(proto::LayerTreeHost* proto) const {
content_is_suitable_for_gpu_rasterization_);
proto->set_background_color(background_color_);
proto->set_has_transparent_background(has_transparent_background_);
+ proto->set_have_wheel_event_handlers(have_wheel_event_handlers_);
proto->set_in_paint_layer_contents(in_paint_layer_contents_);
proto->set_id(id_);
proto->set_next_commit_forces_redraw(next_commit_forces_redraw_);
@@ -1494,6 +1505,7 @@ void LayerTreeHost::FromProtobufForCommit(const proto::LayerTreeHost& proto) {
proto.content_is_suitable_for_gpu_rasterization();
background_color_ = proto.background_color();
has_transparent_background_ = proto.has_transparent_background();
+ have_wheel_event_handlers_ = proto.have_wheel_event_handlers();
in_paint_layer_contents_ = proto.in_paint_layer_contents();
id_ = proto.id();
next_commit_forces_redraw_ = proto.next_commit_forces_redraw();
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index 43bea66d..6c4634c0 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -224,6 +224,9 @@ class CC_EXPORT LayerTreeHost : public MutatorHostClient {
void RegisterSelection(const LayerSelection& selection);
+ bool have_wheel_event_handlers() const { return have_wheel_event_handlers_; }
+ void SetHaveWheelEventHandlers(bool have_event_handlers);
+
const LayerTreeSettings& settings() const { return settings_; }
void SetDebugState(const LayerTreeDebugState& debug_state);
@@ -529,6 +532,8 @@ class CC_EXPORT LayerTreeHost : public MutatorHostClient {
SkColor background_color_;
bool has_transparent_background_;
+ bool have_wheel_event_handlers_;
+
scoped_ptr<AnimationRegistrar> animation_registrar_;
scoped_ptr<AnimationHost> animation_host_;
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 1414918..9dd0c22 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -644,9 +644,9 @@ static inline bool SubtreeShouldBeSkipped(LayerImpl* layer,
if (layer->num_copy_requests_in_target_subtree() > 0)
return false;
- // We cannot skip the the subtree if a descendant has a wheel or touch handler
+ // We cannot skip the the subtree if a descendant has a touch handler
// or the hit testing code will break (it requires fresh transforms, etc).
- if (layer->layer_or_descendant_has_input_handler())
+ if (layer->layer_or_descendant_has_touch_handler())
return false;
// If the layer is not drawn, then skip it and its subtree.
@@ -1058,20 +1058,20 @@ static inline void RemoveSurfaceForEarlyExit(
struct PreCalculateMetaInformationRecursiveData {
size_t num_unclipped_descendants;
int num_layer_or_descendants_with_copy_request;
- int num_layer_or_descendants_with_input_handler;
+ int num_layer_or_descendants_with_touch_handler;
int num_descendants_that_draw_content;
PreCalculateMetaInformationRecursiveData()
: num_unclipped_descendants(0),
num_layer_or_descendants_with_copy_request(0),
- num_layer_or_descendants_with_input_handler(0),
+ num_layer_or_descendants_with_touch_handler(0),
num_descendants_that_draw_content(0) {}
void Merge(const PreCalculateMetaInformationRecursiveData& data) {
num_layer_or_descendants_with_copy_request +=
data.num_layer_or_descendants_with_copy_request;
- num_layer_or_descendants_with_input_handler +=
- data.num_layer_or_descendants_with_input_handler;
+ num_layer_or_descendants_with_touch_handler +=
+ data.num_layer_or_descendants_with_touch_handler;
num_unclipped_descendants += data.num_unclipped_descendants;
num_descendants_that_draw_content += data.num_descendants_that_draw_content;
}
@@ -1128,9 +1128,8 @@ static void PreCalculateMetaInformationInternal(
if (layer->HasCopyRequest())
recursive_data->num_layer_or_descendants_with_copy_request++;
- if (!layer->touch_event_handler_region().IsEmpty() ||
- layer->have_wheel_event_handlers())
- recursive_data->num_layer_or_descendants_with_input_handler++;
+ if (!layer->touch_event_handler_region().IsEmpty())
+ recursive_data->num_layer_or_descendants_with_touch_handler++;
layer->set_num_unclipped_descendants(
recursive_data->num_unclipped_descendants);
@@ -1176,14 +1175,13 @@ static void PreCalculateMetaInformationInternal(
if (layer->HasCopyRequest())
recursive_data->num_layer_or_descendants_with_copy_request++;
- if (!layer->touch_event_handler_region().IsEmpty() ||
- layer->have_wheel_event_handlers())
- recursive_data->num_layer_or_descendants_with_input_handler++;
+ if (!layer->touch_event_handler_region().IsEmpty())
+ recursive_data->num_layer_or_descendants_with_touch_handler++;
layer->draw_properties().num_unclipped_descendants =
recursive_data->num_unclipped_descendants;
- layer->set_layer_or_descendant_has_input_handler(
- (recursive_data->num_layer_or_descendants_with_input_handler != 0));
+ layer->set_layer_or_descendant_has_touch_handler(
+ (recursive_data->num_layer_or_descendants_with_touch_handler != 0));
// TODO(enne): this should be synced from the main thread, so is only
// for tests constructing layers on the compositor thread.
layer->SetNumDescendantsThatDrawContent(
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 27342ce..84e7fde 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -9117,15 +9117,15 @@ TEST_F(LayerTreeHostCommonTest, InputHandlersRecursiveUpdateTest) {
SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(),
gfx::Size(100, 100), true, false, false);
- EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false);
+ EXPECT_EQ(root->layer_or_descendant_has_touch_handler(), false);
- child->SetHaveWheelEventHandlers(true);
+ child->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 100, 100));
ExecuteCalculateDrawProperties(root);
- EXPECT_EQ(root->layer_or_descendant_has_input_handler(), true);
+ EXPECT_EQ(root->layer_or_descendant_has_touch_handler(), true);
- child->SetHaveWheelEventHandlers(false);
+ child->SetTouchEventHandlerRegion(gfx::Rect());
ExecuteCalculateDrawProperties(root);
- EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false);
+ EXPECT_EQ(root->layer_or_descendant_has_touch_handler(), false);
}
TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) {
@@ -9621,7 +9621,7 @@ TEST_F(LayerTreeHostCommonTest, LayerWithInputHandlerAndZeroOpacity) {
render_surface->SetMasksToBounds(true);
test_layer->SetDrawsContent(true);
test_layer->SetOpacity(0);
- test_layer->SetHaveWheelEventHandlers(true);
+ test_layer->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 20, 20));
ExecuteCalculateDrawProperties(root);
EXPECT_EQ(translation, test_layer->ScreenSpaceTransform());
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 16e57c3..8191597 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -572,16 +572,8 @@ bool LayerTreeHostImpl::IsCurrentlyScrollingLayerAt(
return false;
}
-bool LayerTreeHostImpl::HaveWheelEventHandlersAt(
- const gfx::Point& viewport_point) {
- gfx::PointF device_viewport_point = gfx::ScalePoint(
- gfx::PointF(viewport_point), active_tree_->device_scale_factor());
-
- LayerImpl* layer_impl =
- active_tree_->FindLayerWithWheelHandlerThatIsHitByPoint(
- device_viewport_point);
-
- return layer_impl != NULL;
+bool LayerTreeHostImpl::HaveWheelEventHandlers() const {
+ return active_tree_->have_wheel_event_handlers();
}
static LayerImpl* NextLayerInScrollOrder(LayerImpl* layer) {
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index 660369c..b8cbe2e 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -192,7 +192,7 @@ class CC_EXPORT LayerTreeHostImpl
bool IsCurrentlyScrollingLayerAt(
const gfx::Point& viewport_point,
InputHandler::ScrollInputType type) const override;
- bool HaveWheelEventHandlersAt(const gfx::Point& viewport_point) override;
+ bool HaveWheelEventHandlers() const override;
bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_port) override;
scoped_ptr<SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor(
ui::LatencyInfo* latency) override;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 49c7103..a66eb514 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -714,11 +714,10 @@ TEST_F(LayerTreeHostImplTest, ScrollBlocksOnWheelEventHandlers) {
SetupScrollAndContentsLayers(gfx::Size(100, 100));
host_impl_->SetViewportSize(gfx::Size(50, 50));
DrawFrame();
- LayerImpl* root = host_impl_->active_tree()->root_layer();
// With registered event handlers, wheel scrolls don't necessarily
// have to go to the main thread.
- root->SetHaveWheelEventHandlers(true);
+ host_impl_->active_tree()->set_have_wheel_event_handlers(true);
InputHandler::ScrollStatus status =
host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
InputHandler::WHEEL);
@@ -736,7 +735,7 @@ TEST_F(LayerTreeHostImplTest, ScrollBlocksOnWheelEventHandlers) {
// And if the handlers go away, wheel scrolls can again be processed
// on impl (despite the scroll-blocks-on mode).
- root->SetHaveWheelEventHandlers(false);
+ host_impl_->active_tree()->set_have_wheel_event_handlers(false);
status = host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
InputHandler::WHEEL);
EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index fc1d039..9313c4d 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -1333,6 +1333,7 @@ class LayerTreeHostTestCommit : public LayerTreeHostTest {
void BeginTest() override {
layer_tree_host()->SetViewportSize(gfx::Size(20, 20));
layer_tree_host()->set_background_color(SK_ColorGRAY);
+ layer_tree_host()->SetHaveWheelEventHandlers(true);
PostSetNeedsCommitToMainThread();
}
@@ -1340,6 +1341,7 @@ class LayerTreeHostTestCommit : public LayerTreeHostTest {
void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
EXPECT_EQ(gfx::Size(20, 20), impl->DrawViewportSize());
EXPECT_EQ(SK_ColorGRAY, impl->active_tree()->background_color());
+ EXPECT_TRUE(impl->active_tree()->have_wheel_event_handlers());
EndTest();
}
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 753d171..9bcd745 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -85,6 +85,7 @@ LayerTreeImpl::LayerTreeImpl(
next_activation_forces_redraw_(false),
has_ever_been_drawn_(false),
render_surface_layer_list_id_(0),
+ have_wheel_event_handlers_(false),
top_controls_shrink_blink_size_(false),
top_controls_height_(0),
top_controls_shown_ratio_(top_controls_shown_ratio) {}
@@ -354,6 +355,7 @@ void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) {
target_tree->set_source_frame_number(source_frame_number());
target_tree->set_background_color(background_color());
target_tree->set_has_transparent_background(has_transparent_background());
+ target_tree->set_have_wheel_event_handlers(have_wheel_event_handlers());
if (ViewportSizeInvalid())
target_tree->SetViewportSizeInvalid();
@@ -1699,7 +1701,7 @@ struct HitTestVisibleScrollableOrTouchableFunctor {
return layer->IsDrawnRenderSurfaceLayerListMember() ||
ScrollsAnyDrawnRenderSurfaceLayerListMember(layer) ||
!layer->touch_event_handler_region().IsEmpty() ||
- layer->have_wheel_event_handlers();
+ layer->layer_tree_impl()->have_wheel_event_handlers();
}
};
@@ -1745,29 +1747,6 @@ static bool LayerHasTouchEventHandlersAt(const gfx::PointF& screen_space_point,
return true;
}
-struct FindWheelEventLayerFunctor {
- bool operator()(LayerImpl* layer) const {
- return layer->have_wheel_event_handlers();
- }
-};
-
-LayerImpl* LayerTreeImpl::FindLayerWithWheelHandlerThatIsHitByPoint(
- const gfx::PointF& screen_space_point) {
- if (!root_layer())
- return NULL;
- bool update_lcd_text = false;
- if (!UpdateDrawProperties(update_lcd_text))
- return NULL;
- bool use_property_trees =
- settings().use_property_trees || settings().verify_property_trees;
- FindWheelEventLayerFunctor func;
- FindClosestMatchingLayerDataForRecursion data_for_recursion;
- FindClosestMatchingLayer(
- screen_space_point, root_layer(), func, property_trees_.transform_tree,
- property_trees_.clip_tree, use_property_trees, &data_for_recursion);
- return data_for_recursion.closest_match;
-}
-
struct FindTouchEventLayerFunctor {
bool operator()(LayerImpl* layer) const {
return LayerHasTouchEventHandlersAt(screen_space_point, layer,
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h
index 4e59132..ffb93bd 100644
--- a/cc/trees/layer_tree_impl.h
+++ b/cc/trees/layer_tree_impl.h
@@ -374,9 +374,6 @@ class CC_EXPORT LayerTreeImpl {
LayerImpl* FindLayerThatIsHitByPoint(const gfx::PointF& screen_space_point);
- LayerImpl* FindLayerWithWheelHandlerThatIsHitByPoint(
- const gfx::PointF& screen_space_point);
-
LayerImpl* FindLayerThatIsHitByPointInTouchHandlerRegion(
const gfx::PointF& screen_space_point);
@@ -439,6 +436,11 @@ class CC_EXPORT LayerTreeImpl {
const gfx::BoxF& box,
gfx::BoxF* bounds) const;
+ bool have_wheel_event_handlers() const { return have_wheel_event_handlers_; }
+ void set_have_wheel_event_handlers(bool have_event_handlers) {
+ have_wheel_event_handlers_ = have_event_handlers;
+ }
+
protected:
explicit LayerTreeImpl(
LayerTreeHostImpl* layer_tree_host_impl,
@@ -526,10 +528,11 @@ class CC_EXPORT LayerTreeImpl {
int render_surface_layer_list_id_;
+ bool have_wheel_event_handlers_;
+
// Whether or not Blink's viewport size was shrunk by the height of the top
// controls at the time of the last layout.
bool top_controls_shrink_blink_size_;
-
float top_controls_height_;
// The amount that the top controls are shown from 0 (hidden) to 1 (fully
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index beaae75..5bf9c46 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -745,6 +745,14 @@ void RenderWidgetCompositor::clearSelection() {
layer_tree_host_->RegisterSelection(empty_selection);
}
+void RenderWidgetCompositor::setHaveWheelEventHandlers(bool value) {
+ layer_tree_host_->SetHaveWheelEventHandlers(value);
+}
+
+bool RenderWidgetCompositor::haveWheelEventHandlers() const {
+ return layer_tree_host_->have_wheel_event_handlers();
+}
+
void CompositeAndReadbackAsyncCallback(
blink::WebCompositeAndReadbackAsyncCallback* callback,
scoped_ptr<cc::CopyOutputResult> result) {
diff --git a/content/renderer/gpu/render_widget_compositor.h b/content/renderer/gpu/render_widget_compositor.h
index 9600506..073fd77 100644
--- a/content/renderer/gpu/render_widget_compositor.h
+++ b/content/renderer/gpu/render_widget_compositor.h
@@ -135,6 +135,8 @@ class CONTENT_EXPORT RenderWidgetCompositor
void clearViewportLayers() override;
void registerSelection(const blink::WebSelection& selection) override;
void clearSelection() override;
+ void setHaveWheelEventHandlers(bool) override;
+ bool haveWheelEventHandlers() const override;
int layerTreeId() const override;
void setShowFPSCounter(bool show) override;
void setShowPaintRects(bool show) override;
diff --git a/content/test/web_layer_tree_view_impl_for_testing.cc b/content/test/web_layer_tree_view_impl_for_testing.cc
index 0bb14af..7dbc162 100644
--- a/content/test/web_layer_tree_view_impl_for_testing.cc
+++ b/content/test/web_layer_tree_view_impl_for_testing.cc
@@ -200,4 +200,13 @@ void WebLayerTreeViewImplForTesting::registerSelection(
void WebLayerTreeViewImplForTesting::clearSelection() {
}
+void WebLayerTreeViewImplForTesting::setHaveWheelEventHandlers(
+ bool have_event_handlers) {
+ layer_tree_host_->SetHaveWheelEventHandlers(have_event_handlers);
+}
+
+bool WebLayerTreeViewImplForTesting::haveWheelEventHandlers() const {
+ return layer_tree_host_->have_wheel_event_handlers();
+}
+
} // namespace content
diff --git a/content/test/web_layer_tree_view_impl_for_testing.h b/content/test/web_layer_tree_view_impl_for_testing.h
index 4596be8..9518a5b 100644
--- a/content/test/web_layer_tree_view_impl_for_testing.h
+++ b/content/test/web_layer_tree_view_impl_for_testing.h
@@ -67,6 +67,8 @@ class WebLayerTreeViewImplForTesting
void clearViewportLayers() override;
void registerSelection(const blink::WebSelection& selection) override;
void clearSelection() override;
+ void setHaveWheelEventHandlers(bool have_event_handlers) override;
+ bool haveWheelEventHandlers() const override;
// cc::LayerTreeHostClient implementation.
void WillBeginMainFrame() override {}
diff --git a/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp b/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp
index 292ff13..2ce0f9e 100644
--- a/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp
+++ b/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp
@@ -203,8 +203,7 @@ void EventHandlerRegistry::notifyHasHandlersChanged(EventHandlerClass handlerCla
scrollingCoordinator->updateHaveScrollEventHandlers();
break;
case WheelEvent:
- if (scrollingCoordinator)
- scrollingCoordinator->updateHaveWheelEventHandlers();
+ m_frameHost->chromeClient().setHaveWheelEventHandlers(hasActiveHandlers);
break;
case TouchEvent:
m_frameHost->chromeClient().needTouchEvents(hasActiveHandlers);
diff --git a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
index 03eb06d..c29f82e 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
@@ -45,6 +45,7 @@
#include "core/layout/compositing/CompositedLayerMapping.h"
#include "core/layout/compositing/PaintLayerCompositor.h"
#include "core/loader/DocumentLoader.h"
+#include "core/page/ChromeClient.h"
#include "platform/geometry/IntRect.h"
#include "platform/graphics/CompositingReasons.h"
#include "platform/graphics/GraphicsLayer.h"
@@ -79,7 +80,7 @@ static PassRefPtr<TypeBuilder::LayerTree::ScrollRect> buildScrollRect(const WebR
return scrollRectObject.release();
}
-static PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > buildScrollRectsForLayer(GraphicsLayer* graphicsLayer)
+static PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect>> buildScrollRectsForLayer(GraphicsLayer* graphicsLayer, bool reportWheelScrollers)
{
RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects = TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect>::create();
WebLayer* webLayer = graphicsLayer->platformLayer();
@@ -89,14 +90,14 @@ static PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > build
for (size_t i = 0; i < webLayer->touchEventHandlerRegion().size(); ++i) {
scrollRects->addItem(buildScrollRect(webLayer->touchEventHandlerRegion()[i], TypeBuilder::LayerTree::ScrollRect::Type::TouchEventHandler));
}
- if (webLayer->haveWheelEventHandlers()) {
+ if (reportWheelScrollers) {
WebRect webRect(webLayer->position().x, webLayer->position().y, webLayer->bounds().width, webLayer->bounds().height);
scrollRects->addItem(buildScrollRect(webRect, TypeBuilder::LayerTree::ScrollRect::Type::WheelEventHandler));
}
return scrollRects->length() ? scrollRects.release() : nullptr;
}
-static PassRefPtr<TypeBuilder::LayerTree::Layer> buildObjectForLayer(GraphicsLayer* graphicsLayer, int nodeId)
+static PassRefPtr<TypeBuilder::LayerTree::Layer> buildObjectForLayer(GraphicsLayer* graphicsLayer, int nodeId, bool reportWheelEventListeners)
{
WebLayer* webLayer = graphicsLayer->platformLayer();
RefPtr<TypeBuilder::LayerTree::Layer> layerObject = TypeBuilder::LayerTree::Layer::create()
@@ -138,7 +139,7 @@ static PassRefPtr<TypeBuilder::LayerTree::Layer> buildObjectForLayer(GraphicsLay
layerObject->setAnchorY(0.0);
layerObject->setAnchorZ(transformOrigin.z());
}
- RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects = buildScrollRectsForLayer(graphicsLayer);
+ RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect>> scrollRects = buildScrollRectsForLayer(graphicsLayer, reportWheelEventListeners);
if (scrollRects)
layerObject->setScrollRects(scrollRects.release());
return layerObject;
@@ -210,7 +211,10 @@ PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > InspectorLayerTre
LayerIdToNodeIdMap layerIdToNodeIdMap;
RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > layers = TypeBuilder::Array<TypeBuilder::LayerTree::Layer>::create();
buildLayerIdToNodeIdMap(compositor->rootLayer(), layerIdToNodeIdMap);
- gatherGraphicsLayers(rootGraphicsLayer(), layerIdToNodeIdMap, layers);
+ int scrollingLayerId = m_inspectedFrames->root()->view()->layerForScrolling()->platformLayer()->id();
+ bool haveWheelEventHandlers = m_inspectedFrames->root()->chromeClient().haveWheelEventHandlers();
+
+ gatherGraphicsLayers(rootGraphicsLayer(), layerIdToNodeIdMap, layers, haveWheelEventHandlers, scrollingLayerId);
return layers.release();
}
@@ -233,16 +237,16 @@ void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(PaintLayer* root, LayerIdT
}
}
-void InspectorLayerTreeAgent::gatherGraphicsLayers(GraphicsLayer* root, HashMap<int, int>& layerIdToNodeIdMap, RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> >& layers)
+void InspectorLayerTreeAgent::gatherGraphicsLayers(GraphicsLayer* root, HashMap<int, int>& layerIdToNodeIdMap, RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer>>& layers, bool hasWheelEventHandlers, int scrollingLayerId)
{
int layerId = root->platformLayer()->id();
if (m_pageOverlayLayerIds.find(layerId) != WTF::kNotFound)
return;
- layers->addItem(buildObjectForLayer(root, layerIdToNodeIdMap.get(layerId)));
+ layers->addItem(buildObjectForLayer(root, layerIdToNodeIdMap.get(layerId), hasWheelEventHandlers && layerId == scrollingLayerId));
if (GraphicsLayer* replica = root->replicaLayer())
- gatherGraphicsLayers(replica, layerIdToNodeIdMap, layers);
+ gatherGraphicsLayers(replica, layerIdToNodeIdMap, layers, hasWheelEventHandlers, scrollingLayerId);
for (size_t i = 0, size = root->children().size(); i < size; ++i)
- gatherGraphicsLayers(root->children()[i], layerIdToNodeIdMap, layers);
+ gatherGraphicsLayers(root->children()[i], layerIdToNodeIdMap, layers, hasWheelEventHandlers, scrollingLayerId);
}
int InspectorLayerTreeAgent::idForNode(Node* node)
diff --git a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h
index beb977d..407af15 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h
+++ b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h
@@ -100,7 +100,7 @@ private:
typedef HashMap<int, int> LayerIdToNodeIdMap;
void buildLayerIdToNodeIdMap(PaintLayer*, LayerIdToNodeIdMap&);
- void gatherGraphicsLayers(GraphicsLayer*, HashMap<int, int>& layerIdToNodeIdMap, RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> >&);
+ void gatherGraphicsLayers(GraphicsLayer*, HashMap<int, int>& layerIdToNodeIdMap, RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer>>&, bool hasWheelEventHandlers, int scrollingRootLayerId);
int idForNode(Node*);
RawPtrWillBeMember<InspectedFrames> m_inspectedFrames;
diff --git a/third_party/WebKit/Source/core/loader/EmptyClients.h b/third_party/WebKit/Source/core/loader/EmptyClients.h
index 15114d5..64fb9df 100644
--- a/third_party/WebKit/Source/core/loader/EmptyClients.h
+++ b/third_party/WebKit/Source/core/loader/EmptyClients.h
@@ -157,6 +157,9 @@ public:
void attachRootGraphicsLayer(GraphicsLayer*, LocalFrame* localRoot) override {}
void needTouchEvents(bool) override {}
+ void setHaveWheelEventHandlers(bool) override {}
+ bool haveWheelEventHandlers() const override { return false; }
+
void setTouchAction(TouchAction) override {}
void didAssociateFormControls(const WillBeHeapVector<RefPtrWillBeMember<Element>>&, LocalFrame*) override {}
diff --git a/third_party/WebKit/Source/core/page/ChromeClient.h b/third_party/WebKit/Source/core/page/ChromeClient.h
index 8525607..1c934dc 100644
--- a/third_party/WebKit/Source/core/page/ChromeClient.h
+++ b/third_party/WebKit/Source/core/page/ChromeClient.h
@@ -199,6 +199,8 @@ public:
virtual void updateCompositedSelection(const CompositedSelection&) { }
virtual void needTouchEvents(bool) = 0;
+ virtual void setHaveWheelEventHandlers(bool) = 0;
+ virtual bool haveWheelEventHandlers() const = 0;
virtual void setTouchAction(TouchAction) = 0;
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
index 51f933c..d9e0257 100644
--- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
+++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -680,19 +680,6 @@ void ScrollingCoordinator::willDestroyLayer(PaintLayer* layer)
m_layersWithTouchRects.remove(layer);
}
-void ScrollingCoordinator::updateHaveWheelEventHandlers()
-{
- ASSERT(isMainThread());
- ASSERT(m_page);
- if (!m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFrame()->view())
- return;
-
- if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->view()->layerForScrolling())) {
- bool haveHandlers = m_page->frameHost().eventHandlerRegistry().hasEventHandlers(EventHandlerRegistry::WheelEvent);
- scrollLayer->setHaveWheelEventHandlers(haveHandlers);
- }
-}
-
void ScrollingCoordinator::updateHaveScrollEventHandlers()
{
ASSERT(isMainThread());
@@ -960,7 +947,6 @@ void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView)
return;
notifyGeometryChanged();
- updateHaveWheelEventHandlers();
updateHaveScrollEventHandlers();
}
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h
index 132cc2d..3cfdba7 100644
--- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h
+++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h
@@ -76,7 +76,6 @@ public:
void updateAfterCompositingChangeIfNeeded();
- void updateHaveWheelEventHandlers();
void updateHaveScrollEventHandlers();
// Should be called whenever a scrollable area is added or removed, or gains/loses a composited layer.
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.cpp b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
index a38895a..7c169b2 100644
--- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp
+++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
@@ -881,6 +881,19 @@ void ChromeClientImpl::needTouchEvents(bool needsTouchEvents)
m_webView->hasTouchEventHandlers(needsTouchEvents);
}
+void ChromeClientImpl::setHaveWheelEventHandlers(bool hasEventHandlers)
+{
+ if (WebLayerTreeView* treeView = m_webView->layerTreeView())
+ treeView->setHaveWheelEventHandlers(hasEventHandlers);
+}
+
+bool ChromeClientImpl::haveWheelEventHandlers() const
+{
+ if (WebLayerTreeView* treeView = m_webView->layerTreeView())
+ return treeView->haveWheelEventHandlers();
+ return false;
+}
+
void ChromeClientImpl::setTouchAction(TouchAction touchAction)
{
if (WebViewClient* client = m_webView->client())
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.h b/third_party/WebKit/Source/web/ChromeClientImpl.h
index 4fc38a8..7c08ae8 100644
--- a/third_party/WebKit/Source/web/ChromeClientImpl.h
+++ b/third_party/WebKit/Source/web/ChromeClientImpl.h
@@ -112,6 +112,8 @@ public:
void setCursor(const Cursor&, LocalFrame* localRoot) override;
Cursor lastSetCursorForTesting() const override;
void needTouchEvents(bool needTouchEvents) override;
+ void setHaveWheelEventHandlers(bool hasEventHandlers) override;
+ bool haveWheelEventHandlers() const override;
void setTouchAction(TouchAction) override;
GraphicsLayerFactory* graphicsLayerFactory() const override;
diff --git a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
index 2e2c00d..9d089c9 100644
--- a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
@@ -94,6 +94,8 @@ public:
WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); }
LocalFrame* frame() const { return m_helper.webViewImpl()->mainFrameImpl()->frame(); }
+ WebLayerTreeView* webLayerTreeView() const { return webViewImpl()->layerTreeView(); }
+
protected:
std::string m_baseURL;
FrameTestHelpers::TestWebViewClient m_mockWebViewClient;
@@ -124,7 +126,7 @@ TEST_F(ScrollingCoordinatorTest, fastScrollingByDefault)
WebLayer* rootScrollLayer = getRootScrollLayer();
ASSERT_TRUE(rootScrollLayer->scrollable());
ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread());
- ASSERT_FALSE(rootScrollLayer->haveWheelEventHandlers());
+ ASSERT_FALSE(webLayerTreeView()->haveWheelEventHandlers());
}
TEST_F(ScrollingCoordinatorTest, fastScrollingCanBeDisabledWithSetting)
@@ -310,8 +312,7 @@ TEST_F(ScrollingCoordinatorTest, wheelEventHandler)
navigateTo(m_baseURL + "wheel-event-handler.html");
forceFullCompositingUpdate();
- WebLayer* rootScrollLayer = getRootScrollLayer();
- ASSERT_TRUE(rootScrollLayer->haveWheelEventHandlers());
+ ASSERT_TRUE(webLayerTreeView()->haveWheelEventHandlers());
}
TEST_F(ScrollingCoordinatorTest, scrollEventHandler)
diff --git a/third_party/WebKit/public/platform/WebLayer.h b/third_party/WebKit/public/platform/WebLayer.h
index e536ce9..fd5bb6e 100644
--- a/third_party/WebKit/public/platform/WebLayer.h
+++ b/third_party/WebKit/public/platform/WebLayer.h
@@ -197,9 +197,6 @@ public:
virtual bool userScrollableHorizontal() const = 0;
virtual bool userScrollableVertical() const = 0;
- virtual void setHaveWheelEventHandlers(bool) = 0;
- virtual bool haveWheelEventHandlers() const = 0;
-
virtual void setHaveScrollEventHandlers(bool) = 0;
virtual bool haveScrollEventHandlers() const = 0;
diff --git a/third_party/WebKit/public/platform/WebLayerTreeView.h b/third_party/WebKit/public/platform/WebLayerTreeView.h
index 441c36f..ac3c757 100644
--- a/third_party/WebKit/public/platform/WebLayerTreeView.h
+++ b/third_party/WebKit/public/platform/WebLayerTreeView.h
@@ -141,8 +141,13 @@ public:
virtual void registerSelection(const WebSelection&) { }
virtual void clearSelection() { }
+ // Input properties ---------------------------------------------------
+ virtual void setHaveWheelEventHandlers(bool) { };
+
// Debugging / dangerous ---------------------------------------------
+ virtual bool haveWheelEventHandlers() const { return false; };
+
virtual int layerTreeId() const { return 0; }
// Toggles the FPS counter in the HUD layer
diff --git a/ui/events/blink/input_handler_proxy.cc b/ui/events/blink/input_handler_proxy.cc
index 05dfaaa..7d74ed7 100644
--- a/ui/events/blink/input_handler_proxy.cc
+++ b/ui/events/blink/input_handler_proxy.cc
@@ -288,8 +288,7 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleInputEvent(
const WebGestureEvent& gesture_event =
static_cast<const WebGestureEvent&>(event);
if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad &&
- input_handler_->HaveWheelEventHandlersAt(
- gfx::Point(gesture_event.x, gesture_event.y))) {
+ input_handler_->HaveWheelEventHandlers()) {
return DID_NOT_HANDLE;
} else {
input_handler_->PinchGestureBegin();
diff --git a/ui/events/blink/input_handler_proxy_unittest.cc b/ui/events/blink/input_handler_proxy_unittest.cc
index aedda40..16e3542 100644
--- a/ui/events/blink/input_handler_proxy_unittest.cc
+++ b/ui/events/blink/input_handler_proxy_unittest.cc
@@ -131,7 +131,7 @@ class MockInputHandler : public cc::InputHandler {
bool(const gfx::Point& point,
cc::InputHandler::ScrollInputType type));
- MOCK_METHOD1(HaveWheelEventHandlersAt, bool(const gfx::Point& point));
+ MOCK_CONST_METHOD0(HaveWheelEventHandlers, bool());
MOCK_METHOD1(DoTouchEventsBlockScrollAt, bool(const gfx::Point& point));
MOCK_METHOD0(RequestUpdateForSynchronousInputHandler, void());
@@ -625,7 +625,7 @@ TEST_P(InputHandlerProxyTest, GesturePinch) {
VERIFY_AND_RESET_MOCKS();
gesture_.type = WebInputEvent::GesturePinchBegin;
- EXPECT_CALL(mock_input_handler_, HaveWheelEventHandlersAt(testing::_))
+ EXPECT_CALL(mock_input_handler_, HaveWheelEventHandlers())
.WillOnce(testing::Return(false));
EXPECT_CALL(mock_input_handler_, PinchGestureBegin());
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -674,7 +674,7 @@ TEST_P(InputHandlerProxyTest, GesturePinchWithWheelHandler) {
VERIFY_AND_RESET_MOCKS();
gesture_.type = WebInputEvent::GesturePinchBegin;
- EXPECT_CALL(mock_input_handler_, HaveWheelEventHandlersAt(testing::_))
+ EXPECT_CALL(mock_input_handler_, HaveWheelEventHandlers())
.WillOnce(testing::Return(true));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -723,7 +723,7 @@ TEST_P(InputHandlerProxyTest, GesturePinchAfterScrollOnMainThread) {
VERIFY_AND_RESET_MOCKS();
gesture_.type = WebInputEvent::GesturePinchBegin;
- EXPECT_CALL(mock_input_handler_, HaveWheelEventHandlersAt(testing::_))
+ EXPECT_CALL(mock_input_handler_, HaveWheelEventHandlers())
.WillOnce(testing::Return(false));
EXPECT_CALL(mock_input_handler_, PinchGestureBegin());
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));