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

Unified Diff: Source/bindings/templates/methods.cpp

Issue 396283004: Make the MediaQueryList listener an EventListener (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix review comments Created 6 years, 4 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 | « Source/bindings/scripts/v8_types.py ('k') | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/methods.cpp
diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp
index cf307e68859e6f8a5be32b7564636cd4045ddcad..1bfb7715bda502dfa8392b1d547eda6bda3532d1 100644
--- a/Source/bindings/templates/methods.cpp
+++ b/Source/bindings/templates/methods.cpp
@@ -135,7 +135,7 @@ if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefi
{% if argument.is_callback_interface %}
{# FIXME: remove EventListener special case #}
{% if argument.idl_type == 'EventListener' %}
-{% if method.name == 'removeEventListener' %}
+{% if method.name == 'removeEventListener' or method.name == 'removeListener' %}
{{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(info.GetIsolate()), info[{{argument.index}}], false, ListenerFindOnly);
{% else %}{# method.name == 'addEventListener' #}
{{argument.name}} = V8EventListenerList::getEventListener(ScriptState::current(info.GetIsolate()), info[{{argument.index}}], false, ListenerFindOrCreate);
@@ -282,14 +282,15 @@ else
{% endif %}
{%- endif %}{# None for void #}
{# Post-set #}
-{% if interface_name == 'EventTarget' and method.name in ('addEventListener',
- 'removeEventListener') %}
+{% if interface_name in ('EventTarget', 'MediaQueryList')
+ and method.name in ('addEventListener', 'removeEventListener', 'addListener', 'removeListener') %}
{% set hidden_dependency_action = 'addHiddenValueToArray'
- if method.name == 'addEventListener' else 'removeHiddenValueFromArray' %}
+ if method.name in ('addEventListener', 'addListener') else 'removeHiddenValueFromArray' %}
+{% set argument_index = '1' if interface_name == 'EventTarget' else '0' %}
{# Length check needed to skip action on legacy calls without enough arguments.
http://crbug.com/353484 #}
if (info.Length() >= 2 && listener && !impl->toNode())
Jens Widell 2014/08/16 06:56:08 Should we adjust the "2" here to "argument_index+1
cbiesinger 2014/08/29 22:54:13 Done.
- {{hidden_dependency_action}}(info.Holder(), info[1], {{v8_class}}::eventListenerCacheIndex, info.GetIsolate());
+ {{hidden_dependency_action}}(info.Holder(), info[{{argument_index}}], {{v8_class}}::eventListenerCacheIndex, info.GetIsolate());
{% endif %}
{% endmacro %}
« no previous file with comments | « Source/bindings/scripts/v8_types.py ('k') | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698