| OLD | NEW |
| 1 {% from 'macros.tmpl' import license %} | 1 {% from 'macros.tmpl' import license %} |
| 2 {{license()}} | 2 {{license()}} |
| 3 | 3 |
| 4 #include "core/css/CSSPropertyMetadata.h" | 4 #include "core/css/CSSPropertyMetadata.h" |
| 5 | 5 |
| 6 #include "platform/RuntimeEnabledFeatures.h" | 6 #include "platform/RuntimeEnabledFeatures.h" |
| 7 #include "wtf/BitArray.h" | 7 #include "wtf/BitArray.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 {% for flag, function_name in switches %} | 10 {% for flag, function_name in switches %} |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 {% if function_name == "isInheritedProperty" %} | 21 {% if function_name == "isInheritedProperty" %} |
| 22 case CSSPropertyVariable: | 22 case CSSPropertyVariable: |
| 23 {% endif %} | 23 {% endif %} |
| 24 return true; | 24 return true; |
| 25 default: | 25 default: |
| 26 return false; | 26 return false; |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 {% endfor %} | 29 {% endfor %} |
| 30 | 30 |
| 31 // There is one more valid property ID than the total count of CSS properties | |
| 32 // because of custom properties. | |
| 33 static const int numValidPropertyIDs = numCSSProperties + 1; | |
| 34 | |
| 35 bool CSSPropertyMetadata::isEnabledProperty(CSSPropertyID unresolvedProperty) | 31 bool CSSPropertyMetadata::isEnabledProperty(CSSPropertyID unresolvedProperty) |
| 36 { | 32 { |
| 37 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); | 33 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
| 38 static BitArray<numValidPropertyIDs>* enabledProperties = 0; | 34 static BitArray<numCSSProperties>* enabledProperties = 0; |
| 39 if (!enabledProperties) { | 35 if (!enabledProperties) { |
| 40 enabledProperties = new BitArray<numValidPropertyIDs>(true); // All bits
sets to 1. | 36 enabledProperties = new BitArray<numCSSProperties>(true); // All bits se
ts to 1. |
| 41 static_assert(CSSPropertyVariable == {{first_enum_value - 1}}, "CSSPrope
rtyVariable should directly precede first_enum_value."); | |
| 42 if (!RuntimeEnabledFeatures::cssVariablesEnabled()) | |
| 43 enabledProperties->clear(0); | |
| 44 {% for property_id, property in properties.items() if property.runtime_f
lag %} | 37 {% for property_id, property in properties.items() if property.runtime_f
lag %} |
| 45 if (!RuntimeEnabledFeatures::{{property.runtime_flag|lower_first}}Enable
d()) | 38 if (!RuntimeEnabledFeatures::{{property.runtime_flag|lower_first}}Enable
d()) |
| 46 enabledProperties->clear({{property_id}} - {{first_enum_value - 1}})
; | 39 enabledProperties->clear({{property_id}} - {{first_enum_value}}); |
| 47 {% endfor %} | 40 {% endfor %} |
| 48 {% for property_id, property in properties.items() if property.is_intern
al %} | 41 {% for property_id, property in properties.items() if property.is_intern
al %} |
| 49 enabledProperties->clear({{property_id}} - {{first_enum_value - 1}}); | 42 enabledProperties->clear({{property_id}} - {{first_enum_value}}); |
| 50 {% endfor %} | 43 {% endfor %} |
| 51 } | 44 } |
| 52 return enabledProperties->get(property - {{first_enum_value - 1}}); | 45 |
| 46 if (unresolvedProperty >= {{first_enum_value}}) |
| 47 return enabledProperties->get(property - {{first_enum_value}}); |
| 48 |
| 49 if (unresolvedProperty == CSSPropertyVariable) |
| 50 return RuntimeEnabledFeatures::cssVariablesEnabled(); |
| 51 ASSERT(unresolvedProperty == CSSPropertyApplyAtRule); |
| 52 return RuntimeEnabledFeatures::cssApplyAtRulesEnabled(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void CSSPropertyMetadata::filterEnabledCSSPropertiesIntoVector(const CSSProperty
ID* properties, size_t propertyCount, Vector<CSSPropertyID>& outVector) | 55 void CSSPropertyMetadata::filterEnabledCSSPropertiesIntoVector(const CSSProperty
ID* properties, size_t propertyCount, Vector<CSSPropertyID>& outVector) |
| 56 { | 56 { |
| 57 for (unsigned i = 0; i < propertyCount; i++) { | 57 for (unsigned i = 0; i < propertyCount; i++) { |
| 58 CSSPropertyID property = properties[i]; | 58 CSSPropertyID property = properties[i]; |
| 59 if (isEnabledProperty(property)) | 59 if (isEnabledProperty(property)) |
| 60 outVector.append(property); | 60 outVector.append(property); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 } // namespace blink | 64 } // namespace blink |
| OLD | NEW |