Index: Source/bindings/templates/attributes.cpp |
diff --git a/Source/bindings/templates/attributes.cpp b/Source/bindings/templates/attributes.cpp |
index fea5d2ca5fc795ff9d2b0bdfd2f6d33f8e54498c..f5a342f1546420d6c17c874a44018632e57121e5 100644 |
--- a/Source/bindings/templates/attributes.cpp |
+++ b/Source/bindings/templates/attributes.cpp |
@@ -35,7 +35,8 @@ const v8::PropertyCallbackInfo<v8::Value>& info |
{% if attribute.reflect_only %} |
{{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_original}}; |
{{release_only_check(attribute.reflect_only, attribute.reflect_missing, |
- attribute.reflect_invalid) | indent}} |
+ attribute.reflect_invalid, attribute.reflect_empty) |
+ | indent}} |
{% endif %} |
{% if attribute.is_call_with_execution_context %} |
ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()); |
@@ -97,16 +98,28 @@ const v8::PropertyCallbackInfo<v8::Value>& info |
{######################################} |
{% macro release_only_check(reflect_only_values, reflect_missing, |
- reflect_invalid) %} |
+ reflect_invalid, reflect_empty) %} |
{# Attribute is limited to only known values: check that the attribute value is |
one of those. If not, set it to the empty string. |
http://www.whatwg.org/specs/web-apps/current-work/#limited-to-only-known-values #} |
+{% if reflect_empty %} |
+if (resultValue.isNull()) { |
+{% if reflect_missing %} |
+ resultValue = "{{reflect_missing}}"; |
+{% else %} |
+ ; |
+{% endif %} |
+} else if (resultValue.isEmpty()) { |
+ resultValue = "{{reflect_empty}}"; |
+{% else %} |
if (resultValue.isEmpty()) { |
+{# FIXME: should use [ReflectEmpty] instead; need to change IDL files #} |
haraken
2014/02/05 07:13:15
Yeah, we should fix it.
|
{% if reflect_missing %} |
resultValue = "{{reflect_missing}}"; |
{% else %} |
; |
haraken
2014/02/05 07:13:15
What's this?
Nils Barth (inactive)
2014/02/05 07:14:39
Perl generates an empty statement if there's no va
|
{% endif %} |
+{% endif %} |
{% for value in reflect_only_values %} |
} else if (equalIgnoringCase(resultValue, "{{value}}")) { |
resultValue = "{{value}}"; |