summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
Diffstat (limited to 'cc')
-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
24 files changed, 68 insertions, 133 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