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

Unified Diff: third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl

Issue 2837923003: Make NodeFilter a legacy callback interface. (Closed)
Patch Set: legacy_callback_interface.*.tmpl, etc. Created 3 years, 8 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: third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
diff --git a/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
index bd6281f1f6add2d9a489b6b7b43faaffc3b22132..8e458ec3cb2d4f0ab4eda8691b009390132a361e 100644
--- a/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
@@ -137,14 +137,16 @@ if (UNLIKELY(numArgsPassed <= {{argument.index}})) {
}
{% endif %}
{% if argument.is_callback_interface %}
-{# FIXME: remove EventListener special case #}
+{# FIXME: remove EventListener/NodeFilter special case. crbug.com/630986 #}
{% if argument.idl_type == 'EventListener' %}
{% if method.name == 'RemoveEventListener' or method.name == 'RemoveListener' %}
{{argument.name}} = V8EventListenerHelper::GetEventListener(ScriptState::Current(info.GetIsolate()), info[{{argument.index}}], false, kListenerFindOnly);
{% else %}{# method.name == 'AddEventListener' #}
{{argument.name}} = V8EventListenerHelper::GetEventListener(ScriptState::Current(info.GetIsolate()), info[{{argument.index}}], false, kListenerFindOrCreate);
{% endif %}{# method.name #}
-{% else %}{# argument.idl_type == 'EventListener' #}
+{% elif argument.idl_type == 'NodeFilter' %}
+{{argument.name}} = V8NodeFilterCondition::CreateOrNull(info[{{argument.index}}], ScriptState::Current(info.GetIsolate()));
+{% else %}{# argument.idl_type == 'EventListener'/'NodeFilter #}
{# Callback functions must be functions:
http://www.w3.org/TR/WebIDL/#es-callback-function #}
{% if argument.is_optional %}
@@ -164,7 +166,7 @@ if (info.Length() <= {{argument.index}} || !{% if argument.is_nullable %}(info[{
}
{{argument.name}} = {% if argument.is_nullable %}info[{{argument.index}}]->IsNull() ? nullptr : {% endif %}V8{{argument.idl_type}}::Create(v8::Local<v8::Function>::Cast(info[{{argument.index}}]), ScriptState::Current(info.GetIsolate()));
{% endif %}{# argument.is_optional #}
-{% endif %}{# argument.idl_type == 'EventListener' #}
+{% endif %}{# argument.idl_type == 'EventListener'/'NodeFilter' #}
{% elif argument.is_callback_function %}
if ({% if argument.is_nullable %}!IsUndefinedOrNull(info[{{argument.index}}]) && {% endif %}!(info[{{argument.index}}]->IsObject() && v8::Local<v8::Object>::Cast(info[{{argument.index}}])->IsCallable())) {
{{throw_argument_error(method, argument, "The callback provided as parameter %(index)d is not a function.")}}

Powered by Google App Engine
This is Rietveld 408576698