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

Unified Diff: third_party/WebKit/Source/build/scripts/templates/CSSPropertyMetadata.cpp.tmpl

Issue 1405293012: [Variables] Enable get/setProperty and similar APIs from the CSSOM (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use static_assert. Created 5 years, 1 month 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: third_party/WebKit/Source/build/scripts/templates/CSSPropertyMetadata.cpp.tmpl
diff --git a/third_party/WebKit/Source/build/scripts/templates/CSSPropertyMetadata.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/CSSPropertyMetadata.cpp.tmpl
index 9c822ae008617f43447a23f28d4ef0ee8cca0fb1..cdccc1d39e48e813d35ac2287ce418ac3426ebbd 100644
--- a/third_party/WebKit/Source/build/scripts/templates/CSSPropertyMetadata.cpp.tmpl
+++ b/third_party/WebKit/Source/build/scripts/templates/CSSPropertyMetadata.cpp.tmpl
@@ -26,21 +26,28 @@ bool CSSPropertyMetadata::{{function_name}}(CSSPropertyID property)
}
{% endfor %}
+// There is one more valid property ID than the total count of CSS properties
+// because of custom properties.
+static const int numValidPropertyIDs = numCSSProperties + 1;
+
bool CSSPropertyMetadata::isEnabledProperty(CSSPropertyID unresolvedProperty)
{
CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
- static BitArray<numCSSProperties>* enabledProperties = 0;
+ static BitArray<numValidPropertyIDs>* enabledProperties = 0;
if (!enabledProperties) {
- enabledProperties = new BitArray<numCSSProperties>(true); // All bits sets to 1.
+ enabledProperties = new BitArray<numValidPropertyIDs>(true); // All bits sets to 1.
+ static_assert(CSSPropertyVariable == {{first_enum_value - 1}}, "CSSPropertyVariable should directly precede first_enum_value.");
+ if (!RuntimeEnabledFeatures::cssVariablesEnabled())
+ enabledProperties->clear(0);
{% for property_id, property in properties.items() if property.runtime_flag %}
if (!RuntimeEnabledFeatures::{{property.runtime_flag|lower_first}}Enabled())
- enabledProperties->clear({{property_id}} - {{first_enum_value}});
+ enabledProperties->clear({{property_id}} - {{first_enum_value - 1}});
{% endfor %}
{% for property_id, property in properties.items() if property.is_internal %}
- enabledProperties->clear({{property_id}} - {{first_enum_value}});
+ enabledProperties->clear({{property_id}} - {{first_enum_value - 1}});
{% endfor %}
}
- return enabledProperties->get(property - {{first_enum_value}});
+ return enabledProperties->get(property - {{first_enum_value - 1}});
}
void CSSPropertyMetadata::filterEnabledCSSPropertiesIntoVector(const CSSPropertyID* properties, size_t propertyCount, Vector<CSSPropertyID>& outVector)

Powered by Google App Engine
This is Rietveld 408576698