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

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

Issue 152043003: IDL compiler: [ReflectMissing], [ReflectInvalid] (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 4b66baa8254ed434407965b3dc8acf7551720692..fea5d2ca5fc795ff9d2b0bdfd2f6d33f8e54498c 100644
--- a/Source/bindings/templates/attributes.cpp
+++ b/Source/bindings/templates/attributes.cpp
@@ -34,7 +34,8 @@ const v8::PropertyCallbackInfo<v8::Value>& info
{% endif %}
{% if attribute.reflect_only %}
{{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_original}};
- {{release_only_check(attribute.reflect_only) | indent}}
+ {{release_only_check(attribute.reflect_only, attribute.reflect_missing,
+ attribute.reflect_invalid) | indent}}
{% endif %}
{% if attribute.is_call_with_execution_context %}
ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate());
@@ -95,18 +96,23 @@ const v8::PropertyCallbackInfo<v8::Value>& info
{% endmacro %}
{######################################}
-{% macro release_only_check(reflect_only_values) %}
+{% macro release_only_check(reflect_only_values, reflect_missing,
+ reflect_invalid) %}
{# 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 (resultValue.isEmpty()) {
+{% if reflect_missing %}
+ resultValue = "{{reflect_missing}}";
+{% else %}
;
+{% endif %}
{% for value in reflect_only_values %}
} else if (equalIgnoringCase(resultValue, "{{value}}")) {
resultValue = "{{value}}";
{% endfor %}
} else {
- resultValue = "";
+ resultValue = "{{reflect_invalid}}";
}
{% endmacro %}
« 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