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 NOTREACHED(); |
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 char CSSPropertyMetadata::repetitionSeparator(CSSPropertyID property) { |
| 31 switch (property) { |
| 32 {% for property_id, property in properties.items() if property.separator %} |
| 33 case {{property_id}}: |
| 34 return '{{property.separator}}'; |
| 35 {% endfor %} |
| 36 default: |
| 37 return 0; |
| 38 } |
| 39 } |
| 40 |
| 41 bool CSSPropertyMetadata::propertyIsRepeated(CSSPropertyID property) { |
| 42 return repetitionSeparator(property) != 0; |
| 43 } |
| 44 |
30 bool CSSPropertyMetadata::isEnabledProperty(CSSPropertyID unresolvedProperty) { | 45 bool CSSPropertyMetadata::isEnabledProperty(CSSPropertyID unresolvedProperty) { |
31 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); | 46 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
32 static std::bitset<numCSSProperties>* enabledProperties = nullptr; | 47 static std::bitset<numCSSProperties>* enabledProperties = nullptr; |
33 if (!enabledProperties) { | 48 if (!enabledProperties) { |
34 enabledProperties = new std::bitset<numCSSProperties>(); | 49 enabledProperties = new std::bitset<numCSSProperties>(); |
35 enabledProperties->set(); // All bits sets to 1. | 50 enabledProperties->set(); // All bits sets to 1. |
36 {% for property_id, property in properties.items() if property.runtime_flag
%} | 51 {% for property_id, property in properties.items() if property.runtime_flag
%} |
37 if (!RuntimeEnabledFeatures::{{property.runtime_flag|lower_first}}Enabled()) | 52 if (!RuntimeEnabledFeatures::{{property.runtime_flag|lower_first}}Enabled()) |
38 enabledProperties->reset({{property_id}} - {{first_enum_value}}); | 53 enabledProperties->reset({{property_id}} - {{first_enum_value}}); |
39 {% endfor %} | 54 {% endfor %} |
(...skipping 16 matching lines...) Expand all Loading... |
56 size_t propertyCount, | 71 size_t propertyCount, |
57 Vector<CSSPropertyID>& outVector) { | 72 Vector<CSSPropertyID>& outVector) { |
58 for (unsigned i = 0; i < propertyCount; i++) { | 73 for (unsigned i = 0; i < propertyCount; i++) { |
59 CSSPropertyID property = properties[i]; | 74 CSSPropertyID property = properties[i]; |
60 if (isEnabledProperty(property)) | 75 if (isEnabledProperty(property)) |
61 outVector.push_back(property); | 76 outVector.push_back(property); |
62 } | 77 } |
63 } | 78 } |
64 | 79 |
65 } // namespace blink | 80 } // namespace blink |
OLD | NEW |