Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(916)

Side by Side Diff: Source/build/scripts/templates/CSSPropertyMetadata.cpp.tmpl

Issue 1096963002: Make UseCounters work on aliased properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
OLDNEW
« no previous file with comments | « Source/build/scripts/make_css_property_names.py ('k') | Source/core/animation/css/CSSAnimations.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698