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

Unified Diff: cc/layers/layer_impl.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
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_impl.cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index b845968c2f7df709585ad96bda4ce3ecc1bacc71..f29519cfbddb00cdb30dd17c66ed4ec19d031067 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -41,6 +41,23 @@
#include "ui/gfx/geometry/vector2d_conversions.h"
namespace cc {
+
+namespace {
+
+base::ListValue* EventListenerPropertiesAsJSON(
+ EventListenerProperties event_properties) {
+ base::ListValue* result = new base::ListValue;
+ if ((event_properties & EventListenerProperties::BLOCKING) !=
+ EventListenerProperties::NONE)
+ result->AppendString("Blocking");
+ if ((event_properties & EventListenerProperties::PASSIVE) !=
+ EventListenerProperties::NONE)
+ result->AppendString("Passive");
+ return result;
+}
+
+} // namespace
+
LayerImpl::LayerImpl(LayerTreeImpl* layer_impl, int id)
: LayerImpl(layer_impl, id, new LayerImpl::SyncedScrollOffset) {
}
@@ -58,7 +75,6 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl,
scroll_offset_(scroll_offset),
scroll_clip_layer_id_(Layer::INVALID_ID),
should_scroll_on_main_thread_(false),
- have_wheel_event_handlers_(false),
have_scroll_event_handlers_(false),
scroll_blocks_on_(SCROLL_BLOCKS_ON_NONE),
user_scrollable_horizontal_(true),
@@ -78,6 +94,8 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl,
is_container_for_fixed_position_layers_(false),
is_affected_by_page_scale_(true),
was_ever_ready_since_last_transform_animation_(true),
+ touch_event_properties_(EventListenerProperties::NONE),
+ wheel_event_properties_(EventListenerProperties::NONE),
background_color_(0),
opacity_(1.0),
blend_mode_(SkXfermode::kSrcOver_Mode),
@@ -546,7 +564,7 @@ InputHandler::ScrollStatus LayerImpl::TryScroll(
}
if ((type == InputHandler::WHEEL || type == InputHandler::ANIMATED_WHEEL) &&
- have_wheel_event_handlers() &&
+ wheel_event_properties() != EventListenerProperties::NONE &&
effective_block_mode & SCROLL_BLOCKS_ON_WHEEL_EVENT) {
TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed WheelEventHandlers");
return InputHandler::SCROLL_ON_MAIN_THREAD;
@@ -595,7 +613,7 @@ void LayerImpl::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->SetWheelEventProperties(wheel_event_properties_);
aelias_OOO_until_Jul13 2016/01/12 20:03:11 I think we also need a SetTouchEventProperties cal
dtapuska 2016/01/12 21:25:48 Done.
layer->SetHaveScrollEventHandlers(have_scroll_event_handlers_);
layer->SetScrollBlocksOn(scroll_blocks_on_);
layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
@@ -746,8 +764,16 @@ base::DictionaryValue* LayerImpl::LayerTreeAsJson() const {
if (scrollable())
result->SetBoolean("Scrollable", true);
- if (have_wheel_event_handlers_)
- result->SetBoolean("WheelHandler", have_wheel_event_handlers_);
+ if (touch_event_properties_ != EventListenerProperties::NONE) {
+ list = EventListenerPropertiesAsJSON(touch_event_properties_);
+ result->Set("TouchHandler", list);
+ }
+
+ if (wheel_event_properties_ != EventListenerProperties::NONE) {
+ list = EventListenerPropertiesAsJSON(wheel_event_properties_);
+ result->Set("WheelHandler", list);
+ }
+
if (have_scroll_event_handlers_)
result->SetBoolean("ScrollHandler", have_scroll_event_handlers_);
if (!touch_event_handler_region_.IsEmpty()) {
@@ -1715,7 +1741,7 @@ void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const {
touch_event_handler_region_.AsValueInto(state);
state->EndArray();
}
- if (have_wheel_event_handlers_) {
+ if (wheel_event_properties_ != EventListenerProperties::NONE) {
gfx::Rect wheel_rect(bounds());
Region wheel_region(wheel_rect);
state->BeginArray("wheel_event_handler_region");
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698