| 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 <bitset> | 7 #include <bitset> |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 {% for flag, function_name in switches %} | 10 {% for flag, function_name in switches %} |
| 11 | 11 |
| 12 bool CSSPropertyMetadata::{{function_name}}(CSSPropertyID property) { | 12 bool CSSPropertyMetadata::{{function_name}}(CSSPropertyID property) { |
| 13 switch(property) { | 13 switch(property) { |
| 14 case CSSPropertyInvalid: | 14 case CSSPropertyInvalid: |
| 15 ASSERT_NOT_REACHED(); | 15 ASSERT_NOT_REACHED(); |
| 16 return false; | 16 return false; |
| 17 {% for property_id, property in properties.items() if property[flag] %} | 17 {% for property_id, property in properties.items() if property[flag] %} |
| 18 case {{property_id}}: | 18 case {{property_id}}: |
| 19 {% endfor %} | 19 {% endfor %} |
| 20 {% if function_name == "isInheritedProperty" %} | 20 {% if function_name == "isInheritedProperty" %} |
| 21 case CSSPropertyVariable: | 21 case CSSPropertyVariable: |
| 22 {% endif %} | 22 {% endif %} |
| 23 return true; | 23 return true; |
| 24 default: | 24 default: |
| 25 return false; | 25 return false; |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 {% endfor %} | 28 {% endfor %} |
| 29 | 29 |
| 30 bool CSSPropertyMetadata::isEnabledProperty(CSSPropertyID unresolvedProperty) { | 30 bool CSSPropertyMetadata::IsEnabledProperty(CSSPropertyID unresolvedProperty) { |
| 31 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); | 31 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
| 32 static std::bitset<numCSSProperties>* enabledProperties = nullptr; | 32 static std::bitset<numCSSProperties>* enabledProperties = nullptr; |
| 33 if (!enabledProperties) { | 33 if (!enabledProperties) { |
| 34 enabledProperties = new std::bitset<numCSSProperties>(); | 34 enabledProperties = new std::bitset<numCSSProperties>(); |
| 35 enabledProperties->set(); // All bits sets to 1. | 35 enabledProperties->set(); // All bits sets to 1. |
| 36 {% for property_id, property in properties.items() if property.runtime_flag
%} | 36 {% for property_id, property in properties.items() if property.runtime_flag
%} |
| 37 if (!RuntimeEnabledFeatures::{{property.runtime_flag|lower_first}}Enabled()) | 37 if (!RuntimeEnabledFeatures::{{property.runtime_flag|lower_first}}Enabled()) |
| 38 enabledProperties->reset({{property_id}} - {{first_enum_value}}); | 38 enabledProperties->reset({{property_id}} - {{first_enum_value}}); |
| 39 {% endfor %} | 39 {% endfor %} |
| 40 {% for property_id, property in properties.items() if property.is_internal %
} | 40 {% for property_id, property in properties.items() if property.is_internal %
} |
| 41 enabledProperties->reset({{property_id}} - {{first_enum_value}}); | 41 enabledProperties->reset({{property_id}} - {{first_enum_value}}); |
| 42 {% endfor %} | 42 {% endfor %} |
| 43 } | 43 } |
| 44 | 44 |
| 45 if (unresolvedProperty >= {{first_enum_value}}) | 45 if (unresolvedProperty >= {{first_enum_value}}) |
| 46 return enabledProperties->test(property - {{first_enum_value}}); | 46 return enabledProperties->test(property - {{first_enum_value}}); |
| 47 | 47 |
| 48 if (unresolvedProperty == CSSPropertyVariable) | 48 if (unresolvedProperty == CSSPropertyVariable) |
| 49 return true; | 49 return true; |
| 50 ASSERT(unresolvedProperty == CSSPropertyApplyAtRule); | 50 ASSERT(unresolvedProperty == CSSPropertyApplyAtRule); |
| 51 return RuntimeEnabledFeatures::cssApplyAtRulesEnabled(); | 51 return RuntimeEnabledFeatures::cssApplyAtRulesEnabled(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void CSSPropertyMetadata::filterEnabledCSSPropertiesIntoVector( | 54 void CSSPropertyMetadata::FilterEnabledCSSPropertiesIntoVector( |
| 55 const CSSPropertyID* properties, | 55 const CSSPropertyID* properties, |
| 56 size_t propertyCount, | 56 size_t propertyCount, |
| 57 Vector<CSSPropertyID>& outVector) { | 57 Vector<CSSPropertyID>& outVector) { |
| 58 for (unsigned i = 0; i < propertyCount; i++) { | 58 for (unsigned i = 0; i < propertyCount; i++) { |
| 59 CSSPropertyID property = properties[i]; | 59 CSSPropertyID property = properties[i]; |
| 60 if (isEnabledProperty(property)) | 60 if (IsEnabledProperty(property)) |
| 61 outVector.push_back(property); | 61 outVector.push_back(property); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace blink | 65 } // namespace blink |
| OLD | NEW |