Index: third_party/WebKit/Source/build/scripts/make_event_factory.py |
diff --git a/third_party/WebKit/Source/build/scripts/make_event_factory.py b/third_party/WebKit/Source/build/scripts/make_event_factory.py |
index aa87658f566846a906dffccc7e3b842533af0a4a..1f280fe05ae3fa981a62ba66feff7dbc14b8dfab 100755 |
--- a/third_party/WebKit/Source/build/scripts/make_event_factory.py |
+++ b/third_party/WebKit/Source/build/scripts/make_event_factory.py |
@@ -59,6 +59,41 @@ def case_insensitive_matching(name): |
or name == 'TouchEvent') |
+# All events _not_ on the following whitelist are being measured in |
philipj_slow
2016/02/11 14:40:28
I like this approach! But can you reduce the list
|
+# createEvent. The plan is to limit createEvent to just a few selected |
+# events necessary for legacy content according to the specification: |
+# |
+# https://dom.spec.whatwg.org/#dom-document-createevent |
+# |
+# The criteria for the current whitelist, unless otherwise noted, is |
+# to have a corresponding init*Event() function, or being an alias for |
+# an event that has a corresponding init*Event(). It isn't a full |
+# match with the spec yet. |
+def candidate_whitelist(name): |
+ return (name == 'CustomEvent' |
+ or name == 'CompositionEvent' |
+ or name == 'DeviceMotionEvent' |
+ or name == 'DeviceOrientationEvent' |
+ or name == 'Event' |
+ or name == 'Events' |
+ or name == 'HTMLEvents' |
+ or name == 'KeyboardEvent' |
+ or name == 'KeyboardEvents' |
+ or name == 'MessageEvent' |
+ or name == 'MouseEvent' |
+ or name == 'MutationEvent' |
+ or name == 'OrientationEvent' |
+ or name == 'SVGEvents' |
+ or name == 'SVGZoomEvent' # Will be deprecated instead. |
+ or name == 'StorageEvent' |
+ or name == 'TextEvent' |
+ or name == 'TouchEvent' |
+ or name == 'UIEvent') |
+ |
+ |
+def measure_name(name): |
+ return 'DocumentCreateEvent' + name |
+ |
class EventFactoryWriter(in_generator.Writer): |
defaults = { |
'ImplementedAs': None, |
@@ -74,6 +109,8 @@ class EventFactoryWriter(in_generator.Writer): |
'lower_first': name_utilities.lower_first, |
'case_insensitive_matching': case_insensitive_matching, |
'script_name': name_utilities.script_name, |
+ 'candidate_whitelist': candidate_whitelist, |
+ 'measure_name': measure_name, |
} |
def __init__(self, in_file_path): |