OLD | NEW |
1 {% from 'macros.tmpl' import license %} | 1 {% from 'macros.tmpl' import license %} |
2 {{license()}} | 2 {{license()}} |
3 | 3 |
4 #include "config.h" | 4 #include "config.h" |
5 #include "core/css/CSSPropertyMetadata.h" | 5 #include "core/css/CSSPropertyMetadata.h" |
6 | 6 |
7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
8 #include "wtf/BitArray.h" | 8 #include "wtf/BitArray.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 {% for flag, function_name in switches %} | 11 {% for flag, function_name in switches %} |
12 | 12 |
13 bool CSSPropertyMetadata::{{function_name}}(CSSPropertyID property) | 13 bool CSSPropertyMetadata::{{function_name}}(CSSPropertyID property) |
14 { | 14 { |
15 switch(property) { | 15 switch(property) { |
16 case CSSPropertyInvalid: | 16 case CSSPropertyInvalid: |
17 ASSERT_NOT_REACHED(); | 17 ASSERT_NOT_REACHED(); |
18 return false; | 18 return false; |
19 {% for property_id, property in properties.items() if property[flag] %} | 19 {% for property_id, property in properties.items() if property[flag] %} |
20 case {{property_id}}: | 20 case {{property_id}}: |
21 {% endfor %} | 21 {% endfor %} |
22 return true; | 22 return true; |
23 default: | 23 default: |
24 return false; | 24 return false; |
25 } | 25 } |
26 } | 26 } |
27 {% endfor %} | 27 {% endfor %} |
28 | 28 |
29 bool CSSPropertyMetadata::isEnabledProperty(CSSPropertyID property) | 29 bool CSSPropertyMetadata::isEnabledProperty(CSSPropertyID unresolvedProperty) |
30 { | 30 { |
| 31 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
31 static BitArray<numCSSProperties>* enabledProperties = 0; | 32 static BitArray<numCSSProperties>* enabledProperties = 0; |
32 if (!enabledProperties) { | 33 if (!enabledProperties) { |
33 enabledProperties = new BitArray<numCSSProperties>(true); // All bits se
ts to 1. | 34 enabledProperties = new BitArray<numCSSProperties>(true); // All bits se
ts to 1. |
34 {% for property_id, property in properties.items() if property.runtime_f
lag %} | 35 {% for property_id, property in properties.items() if property.runtime_f
lag %} |
35 if (!RuntimeEnabledFeatures::{{property.runtime_flag|lower_first}}Enable
d()) | 36 if (!RuntimeEnabledFeatures::{{property.runtime_flag|lower_first}}Enable
d()) |
36 enabledProperties->clear({{property_id}} - {{first_enum_value}}); | 37 enabledProperties->clear({{property_id}} - {{first_enum_value}}); |
37 {% endfor %} | 38 {% endfor %} |
38 {% for property_id, property in properties.items() if property.is_intern
al %} | 39 {% for property_id, property in properties.items() if property.is_intern
al %} |
39 enabledProperties->clear({{property_id}} - {{first_enum_value}}); | 40 enabledProperties->clear({{property_id}} - {{first_enum_value}}); |
40 {% endfor %} | 41 {% endfor %} |
41 } | 42 } |
42 return enabledProperties->get(property - {{first_enum_value}}); | 43 return enabledProperties->get(property - {{first_enum_value}}); |
43 } | 44 } |
44 | 45 |
45 void CSSPropertyMetadata::filterEnabledCSSPropertiesIntoVector(const CSSProperty
ID* properties, size_t propertyCount, Vector<CSSPropertyID>& outVector) | 46 void CSSPropertyMetadata::filterEnabledCSSPropertiesIntoVector(const CSSProperty
ID* properties, size_t propertyCount, Vector<CSSPropertyID>& outVector) |
46 { | 47 { |
47 for (unsigned i = 0; i < propertyCount; i++) { | 48 for (unsigned i = 0; i < propertyCount; i++) { |
48 CSSPropertyID property = properties[i]; | 49 CSSPropertyID property = properties[i]; |
49 if (isEnabledProperty(property)) | 50 if (isEnabledProperty(property)) |
50 outVector.append(property); | 51 outVector.append(property); |
51 } | 52 } |
52 } | 53 } |
53 | 54 |
54 } // namespace blink | 55 } // namespace blink |
OLD | NEW |