Chromium Code Reviews| Index: Source/bindings/templates/methods.cpp |
| diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp |
| index c2381da54f8d37c4aeebbf800f8ce08a4e6f6db6..ea1a2e4aec0949ffc02f99da0ed4f478fb59f7d0 100644 |
| --- a/Source/bindings/templates/methods.cpp |
| +++ b/Source/bindings/templates/methods.cpp |
| @@ -16,7 +16,13 @@ static void {{method.name}}Method(const v8::FunctionCallbackInfo<v8::Value>& arg |
| return; |
| } |
| {% endif %} |
| - {% if argument.idl_type == 'SerializedScriptValue' %} |
| + {% if argument.is_clamp %} |
| + {# For clamping, IDL type (not C++ type) is used for a C++ variable #} |
| + {{argument.idl_type}} {{argument.name}} = 0; |
|
Nils Barth (inactive)
2013/10/31 03:22:44
We might want to use |cpp_type| here, so it's the
Nils Barth (inactive)
2013/10/31 04:18:25
I've put a FIXME here.
|
| + V8TRYCATCH_VOID(double, {{argument.name}}NativeValue, args[{{argument.index}}]->NumberValue()); |
| + if (!std::isnan({{argument.name}}NativeValue)) |
| + {{argument.name}} = clampTo<{{argument.idl_type}}>({{argument.name}}NativeValue); |
|
Nils Barth (inactive)
2013/10/31 03:22:44
OTOH, we need |idl_type| here for the actual clamp
Nils Barth (inactive)
2013/10/31 04:18:25
I've put a comment here.
|
| + {% elif argument.idl_type == 'SerializedScriptValue' %} |
| bool {{argument.name}}DidThrow = false; |
| {{argument.cpp_type}} {{argument.name}} = SerializedScriptValue::create(args[{{argument.index}}], 0, 0, {{argument.name}}DidThrow, args.GetIsolate()); |
| if ({{argument.name}}DidThrow) |