| 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 %} |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 {% if function_name == "isProperty" %} | 23 {% if function_name == "isProperty" %} |
| 24 case CSSPropertyApplyAtRule: | 24 case CSSPropertyApplyAtRule: |
| 25 {% endif %} | 25 {% endif %} |
| 26 return true; | 26 return true; |
| 27 default: | 27 default: |
| 28 return false; | 28 return false; |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 {% endfor %} | 31 {% endfor %} |
| 32 | 32 |
| 33 char CSSPropertyMetadata::repetitionSeparator(CSSPropertyID unresolvedProperty)
{ | 33 char CSSPropertyMetadata::RepetitionSeparator(CSSPropertyID unresolvedProperty)
{ |
| 34 switch (unresolvedProperty) { | 34 switch (unresolvedProperty) { |
| 35 {% for property in properties_including_aliases if property.separator %} | 35 {% for property in properties_including_aliases if property.separator %} |
| 36 case {{property.property_id}}: | 36 case {{property.property_id}}: |
| 37 return '{{property.separator}}'; | 37 return '{{property.separator}}'; |
| 38 {% endfor %} | 38 {% endfor %} |
| 39 default: | 39 default: |
| 40 return 0; | 40 return 0; |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool CSSPropertyMetadata::propertyIsRepeated(CSSPropertyID unresolvedProperty) { | 44 bool CSSPropertyMetadata::PropertyIsRepeated(CSSPropertyID unresolvedProperty) { |
| 45 return repetitionSeparator(unresolvedProperty) != 0; | 45 return RepetitionSeparator(unresolvedProperty) != 0; |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool CSSPropertyMetadata::isEnabledProperty(CSSPropertyID unresolvedProperty) { | 48 bool CSSPropertyMetadata::IsEnabledProperty(CSSPropertyID unresolvedProperty) { |
| 49 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); | 49 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
| 50 static std::bitset<numCSSProperties>* enabledProperties = nullptr; | 50 static std::bitset<numCSSProperties>* enabledProperties = nullptr; |
| 51 if (!enabledProperties) { | 51 if (!enabledProperties) { |
| 52 enabledProperties = new std::bitset<numCSSProperties>(); | 52 enabledProperties = new std::bitset<numCSSProperties>(); |
| 53 enabledProperties->set(); // All bits sets to 1. | 53 enabledProperties->set(); // All bits sets to 1. |
| 54 {% for property in properties_including_aliases if property.runtime_flag %} | 54 {% for property in properties_including_aliases if property.runtime_flag %} |
| 55 if (!RuntimeEnabledFeatures::{{property.runtime_flag|lower_first}}Enabled()) | 55 if (!RuntimeEnabledFeatures::{{property.runtime_flag|lower_first}}Enabled()) |
| 56 enabledProperties->reset({{property.property_id}} - {{first_enum_value}}); | 56 enabledProperties->reset({{property.property_id}} - {{first_enum_value}}); |
| 57 {% endfor %} | 57 {% endfor %} |
| 58 {% for property in properties_including_aliases if property.is_internal %} | 58 {% for property in properties_including_aliases if property.is_internal %} |
| 59 enabledProperties->reset({{property.property_id}} - {{first_enum_value}}); | 59 enabledProperties->reset({{property.property_id}} - {{first_enum_value}}); |
| 60 {% endfor %} | 60 {% endfor %} |
| 61 } | 61 } |
| 62 | 62 |
| 63 if (unresolvedProperty >= {{first_enum_value}}) | 63 if (unresolvedProperty >= {{first_enum_value}}) |
| 64 return enabledProperties->test(property - {{first_enum_value}}); | 64 return enabledProperties->test(property - {{first_enum_value}}); |
| 65 | 65 |
| 66 if (unresolvedProperty == CSSPropertyVariable) | 66 if (unresolvedProperty == CSSPropertyVariable) |
| 67 return true; | 67 return true; |
| 68 ASSERT(unresolvedProperty == CSSPropertyApplyAtRule); | 68 ASSERT(unresolvedProperty == CSSPropertyApplyAtRule); |
| 69 return RuntimeEnabledFeatures::cssApplyAtRulesEnabled(); | 69 return RuntimeEnabledFeatures::cssApplyAtRulesEnabled(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void CSSPropertyMetadata::filterEnabledCSSPropertiesIntoVector( | 72 void CSSPropertyMetadata::FilterEnabledCSSPropertiesIntoVector( |
| 73 const CSSPropertyID* properties, | 73 const CSSPropertyID* properties, |
| 74 size_t propertyCount, | 74 size_t propertyCount, |
| 75 Vector<CSSPropertyID>& outVector) { | 75 Vector<CSSPropertyID>& outVector) { |
| 76 for (unsigned i = 0; i < propertyCount; i++) { | 76 for (unsigned i = 0; i < propertyCount; i++) { |
| 77 CSSPropertyID property = properties[i]; | 77 CSSPropertyID property = properties[i]; |
| 78 if (isEnabledProperty(property)) | 78 if (IsEnabledProperty(property)) |
| 79 outVector.push_back(property); | 79 outVector.push_back(property); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace blink | 83 } // namespace blink |
| OLD | NEW |