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

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

Issue 145773004: IDL compiler: [ReflectOnly] (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
Index: Source/bindings/templates/attributes.cpp
diff --git a/Source/bindings/templates/attributes.cpp b/Source/bindings/templates/attributes.cpp
index 633864fcaeb7db2110ace1a82d2a26d6cd8bd846..4b66baa8254ed434407965b3dc8acf7551720692 100644
--- a/Source/bindings/templates/attributes.cpp
+++ b/Source/bindings/templates/attributes.cpp
@@ -32,6 +32,10 @@ const v8::PropertyCallbackInfo<v8::Value>& info
{% elif not (attribute.is_static or attribute.is_unforgeable) %}
{{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder());
{% endif %}
+ {% if attribute.reflect_only %}
+ {{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_original}};
+ {{release_only_check(attribute.reflect_only) | indent}}
+ {% endif %}
{% if attribute.is_call_with_execution_context %}
ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate());
{% endif %}
@@ -90,6 +94,22 @@ const v8::PropertyCallbackInfo<v8::Value>& info
{% endfilter %}
{% endmacro %}
+{######################################}
+{% macro release_only_check(reflect_only_values) %}
+{# 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()) {
+ ;
+{% for value in reflect_only_values %}
+} else if (equalIgnoringCase(resultValue, "{{value}}")) {
+ resultValue = "{{value}}";
+{% endfor %}
+} else {
+ resultValue = "";
+}
+{% endmacro %}
+
{##############################################################################}
{% macro attribute_getter_callback(attribute, world_suffix) %}

Powered by Google App Engine
This is Rietveld 408576698