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

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

Issue 1186823014: [bindings] Eliminate custom bindings for DeviceOrientationEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Introducing |TreatUndefinedAs=Null| Created 5 years, 6 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: Source/bindings/templates/methods.cpp
diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp
index eb039ef987f3f99339daed14701f54a8a84f714c..ea274670467e8e0c295e344da0bb560c432f7ddf 100644
--- a/Source/bindings/templates/methods.cpp
+++ b/Source/bindings/templates/methods.cpp
@@ -83,6 +83,10 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
} else {
{{argument.set_default_value}};
}
+ {% elif argument.is_undefined_to_null %}
+ if (!isUndefinedOrNull(info[{{argument.index}}])) {
+ {{generate_argument(method, argument, world_suffix) | indent(8)}}
+ }
{% else %}
{{generate_argument(method, argument, world_suffix) | indent}}
{% endif %}
@@ -96,6 +100,9 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
{# FIXME: remove EventListener special case #}
{% if argument.idl_type == 'EventListener' %}
RefPtr<{{argument.idl_type}}> {{argument.name}}
+{% elif argument.is_undefined_to_null %}
+{{argument.cpp_type}}* {{argument.name}} = nullptr;
+{{argument.cpp_type}} {{argument.name}}Value
{%- else %}
{{argument.cpp_type}} {{argument.name}}
{%- endif %}{# argument.idl_type == 'EventListener' #}

Powered by Google App Engine
This is Rietveld 408576698