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

Unified Diff: cc/test/layer_tree_json_parser.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/test/layer_tree_json_parser.cc
diff --git a/cc/test/layer_tree_json_parser.cc b/cc/test/layer_tree_json_parser.cc
index 4dd3d661e13fc257178412002ea34177acd5bf35..f71ec4e21350053ad612a334d1c7313d37ca3cc4 100644
--- a/cc/test/layer_tree_json_parser.cc
+++ b/cc/test/layer_tree_json_parser.cc
@@ -20,6 +20,28 @@ namespace cc {
namespace {
+bool GetEventListenerProperties(base::DictionaryValue* dict,
+ const char* property,
+ EventListenerProperties* listener_properties) {
+ *listener_properties = EventListenerProperties::NONE;
+ base::ListValue* list;
+ bool success = true;
+ if (dict->HasKey(property)) {
+ success &= dict->GetList(property, &list);
+ std::string str;
+ for (size_t i = 0; i < list->GetSize(); i++) {
+ success &= list->GetString(i, &str);
+ if (str == "Blocking")
+ *listener_properties |= EventListenerProperties::BLOCKING;
+ else if (str == "Passive")
+ *listener_properties |= EventListenerProperties::PASSIVE;
+ else
+ success = false;
+ }
+ }
+ return success;
+}
+
scoped_refptr<Layer> ParseTreeFromValue(base::Value* val,
ContentLayerClient* content_client) {
base::DictionaryValue* dict;
@@ -125,9 +147,14 @@ 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);
+ EventListenerProperties listener_properties;
+ success &=
+ GetEventListenerProperties(dict, "TouchHandler", &listener_properties);
+ new_layer->SetTouchEventProperties(listener_properties);
+
+ success &=
+ GetEventListenerProperties(dict, "WheelHandler", &listener_properties);
+ new_layer->SetWheelEventProperties(listener_properties);
bool scroll_handler;
if (dict->GetBoolean("ScrollHandler", &scroll_handler))

Powered by Google App Engine
This is Rietveld 408576698