Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(823)

Unified Diff: cc/layers/layer.cc

Issue 1577263004: Communicate whether passive event listeners exist to cc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_wheel_passive_listeners
Patch Set: Fix Android/ChromeOS build problems with bit packed enum class Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 9fa27317b5bd4d3b6f48c4f15c456865d2c87ffd..ea3838ea23260d28abd6eff32f61f0eab10ff112 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -69,7 +69,6 @@ Layer::Layer(const LayerSettings& settings)
mutable_properties_(kMutablePropertyNone),
should_flatten_transform_from_property_tree_(false),
should_scroll_on_main_thread_(false),
- have_wheel_event_handlers_(false),
have_scroll_event_handlers_(false),
user_scrollable_horizontal_(true),
user_scrollable_vertical_(true),
@@ -87,6 +86,8 @@ Layer::Layer(const LayerSettings& settings)
transform_is_invertible_(true),
has_render_surface_(false),
scroll_blocks_on_(SCROLL_BLOCKS_ON_NONE),
+ touch_event_properties_(EventListenerProperties::NONE),
+ wheel_event_properties_(EventListenerProperties::NONE),
background_color_(0),
opacity_(1.f),
blend_mode_(SkXfermode::kSrcOver_Mode),
@@ -956,12 +957,23 @@ void Layer::SetShouldScrollOnMainThread(bool should_scroll_on_main_thread) {
SetNeedsCommit();
}
-void Layer::SetHaveWheelEventHandlers(bool have_wheel_event_handlers) {
+void Layer::SetTouchEventProperties(
+ EventListenerProperties touch_event_properties) {
DCHECK(IsPropertyChangeAllowed());
- if (have_wheel_event_handlers_ == have_wheel_event_handlers)
+ if (touch_event_properties_ == touch_event_properties)
return;
- have_wheel_event_handlers_ = have_wheel_event_handlers;
+ touch_event_properties_ = touch_event_properties;
+ SetNeedsCommit();
+}
+
+void Layer::SetWheelEventProperties(
+ EventListenerProperties wheel_event_properties) {
+ DCHECK(IsPropertyChangeAllowed());
+ if (wheel_event_properties_ == wheel_event_properties)
+ return;
+
+ wheel_event_properties_ = wheel_event_properties;
SetNeedsCommit();
}
@@ -1197,7 +1209,8 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
layer->SetBackgroundFilters(background_filters());
layer->SetMasksToBounds(masks_to_bounds_);
layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_);
- layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_);
+ layer->SetTouchEventProperties(touch_event_properties_);
+ layer->SetWheelEventProperties(wheel_event_properties_);
layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_);
layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
layer->SetTouchEventHandlerRegion(touch_event_handler_region_);
@@ -1466,7 +1479,10 @@ void Layer::LayerSpecificPropertiesToProto(proto::LayerProperties* proto) {
base->set_masks_to_bounds(masks_to_bounds_);
base->set_should_scroll_on_main_thread(should_scroll_on_main_thread_);
- base->set_have_wheel_event_handlers(have_wheel_event_handlers_);
+ base->set_touch_event_properties(
+ static_cast<int32_t>(touch_event_properties_));
+ base->set_wheel_event_properties(
+ static_cast<int32_t>(wheel_event_properties_));
base->set_have_scroll_event_handlers(have_scroll_event_handlers_);
RegionToProto(non_fast_scrollable_region_,
base->mutable_non_fast_scrollable_region());
@@ -1552,7 +1568,10 @@ void Layer::FromLayerSpecificPropertiesProto(
has_render_surface_ = base.has_render_surface();
masks_to_bounds_ = base.masks_to_bounds();
should_scroll_on_main_thread_ = base.should_scroll_on_main_thread();
- have_wheel_event_handlers_ = base.have_wheel_event_handlers();
+ touch_event_properties_ =
+ (EventListenerProperties)base.touch_event_properties();
+ wheel_event_properties_ =
+ (EventListenerProperties)base.wheel_event_properties();
have_scroll_event_handlers_ = base.have_scroll_event_handlers();
non_fast_scrollable_region_ =
RegionFromProto(base.non_fast_scrollable_region());
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | cc/layers/layer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698