{% from 'macros.tmpl' import license %} {{license()}} #include "core/css/CSSPropertyMetadata.h" #include "platform/RuntimeEnabledFeatures.h" #include "wtf/BitArray.h" namespace blink { {% for flag, function_name in switches %} bool CSSPropertyMetadata::{{function_name}}(CSSPropertyID property) { switch(property) { case CSSPropertyInvalid: ASSERT_NOT_REACHED(); return false; {% for property_id, property in properties.items() if property[flag] %} case {{property_id}}: {% endfor %} {% if function_name == "isInheritedProperty" %} case CSSPropertyVariable: {% endif %} return true; default: return false; } } {% endfor %} bool CSSPropertyMetadata::isEnabledProperty(CSSPropertyID unresolvedProperty) { CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); static BitArray* enabledProperties = 0; if (!enabledProperties) { enabledProperties = new BitArray(true); // All bits sets to 1. {% 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}}); {% endfor %} {% for property_id, property in properties.items() if property.is_internal %} enabledProperties->clear({{property_id}} - {{first_enum_value}}); {% endfor %} } if (unresolvedProperty >= {{first_enum_value}}) return enabledProperties->get(property - {{first_enum_value}}); if (unresolvedProperty == CSSPropertyVariable) return RuntimeEnabledFeatures::cssVariablesEnabled(); ASSERT(unresolvedProperty == CSSPropertyApplyAtRule); return RuntimeEnabledFeatures::cssApplyAtRulesEnabled(); } void CSSPropertyMetadata::filterEnabledCSSPropertiesIntoVector(const CSSPropertyID* properties, size_t propertyCount, Vector& outVector) { for (unsigned i = 0; i < propertyCount; i++) { CSSPropertyID property = properties[i]; if (isEnabledProperty(property)) outVector.append(property); } } } // namespace blink