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

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

Issue 2722503002: [CSS Typed OM] Specify and check separators for repeated properties (Closed)
Patch Set: Add "/" as a valid separator in CSSProperties.json5 Created 3 years, 9 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 "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 NOTREACHED();
38 return 0;
39 }
40 }
41
30 bool CSSPropertyMetadata::isEnabledProperty(CSSPropertyID unresolvedProperty) { 42 bool CSSPropertyMetadata::isEnabledProperty(CSSPropertyID unresolvedProperty) {
31 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); 43 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
32 static std::bitset<numCSSProperties>* enabledProperties = nullptr; 44 static std::bitset<numCSSProperties>* enabledProperties = nullptr;
33 if (!enabledProperties) { 45 if (!enabledProperties) {
34 enabledProperties = new std::bitset<numCSSProperties>(); 46 enabledProperties = new std::bitset<numCSSProperties>();
35 enabledProperties->set(); // All bits sets to 1. 47 enabledProperties->set(); // All bits sets to 1.
36 {% for property_id, property in properties.items() if property.runtime_flag %} 48 {% for property_id, property in properties.items() if property.runtime_flag %}
37 if (!RuntimeEnabledFeatures::{{property.runtime_flag|lower_first}}Enabled()) 49 if (!RuntimeEnabledFeatures::{{property.runtime_flag|lower_first}}Enabled())
38 enabledProperties->reset({{property_id}} - {{first_enum_value}}); 50 enabledProperties->reset({{property_id}} - {{first_enum_value}});
39 {% endfor %} 51 {% endfor %}
(...skipping 16 matching lines...) Expand all
56 size_t propertyCount, 68 size_t propertyCount,
57 Vector<CSSPropertyID>& outVector) { 69 Vector<CSSPropertyID>& outVector) {
58 for (unsigned i = 0; i < propertyCount; i++) { 70 for (unsigned i = 0; i < propertyCount; i++) {
59 CSSPropertyID property = properties[i]; 71 CSSPropertyID property = properties[i];
60 if (isEnabledProperty(property)) 72 if (isEnabledProperty(property))
61 outVector.push_back(property); 73 outVector.push_back(property);
62 } 74 }
63 } 75 }
64 76
65 } // namespace blink 77 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698