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

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

Issue 155623004: IDL compiler: [ReflectEmpty] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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/unstable/v8_attributes.py ('k') | Source/bindings/tests/idls/TestObjectPython.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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}}";
« no previous file with comments | « Source/bindings/scripts/unstable/v8_attributes.py ('k') | Source/bindings/tests/idls/TestObjectPython.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698