| OLD | NEW |
| 1 {% from 'macros.tmpl' import license %} | 1 {% from 'macros.tmpl' import license, print_if %} |
| 2 {{license()}} | 2 {{license()}} |
| 3 | 3 |
| 4 #ifndef ComputedStyleBaseConstants_h | 4 #ifndef ComputedStyleBaseConstants_h |
| 5 #define ComputedStyleBaseConstants_h | 5 #define ComputedStyleBaseConstants_h |
| 6 | 6 |
| 7 namespace blink { | 7 namespace blink { |
| 8 | 8 |
| 9 // TODO(sashab): Move these enums to their own namespace, or add a CSS prefix, | 9 // TODO(sashab): Move these enums to their own namespace, or add a CSS prefix, |
| 10 // for consistency and to prevent name conflicts. | 10 // for consistency and to prevent name conflicts. |
| 11 | 11 |
| 12 {% for enum_name, enum_values in enums.items() %} | 12 {% for enum in enums %} |
| 13 enum class {{enum_name}} : unsigned { | 13 enum class {{enum.type_name}} : unsigned { |
| 14 {% for enum_value in enum_values %} | 14 {% for value in enum.values %} |
| 15 {{enum_value}}, | 15 {{value}}{{print_if(enum.is_set, " = " ~ (0 if loop.first else 2**loop.index0)
)}}, |
| 16 {% endfor %} | 16 {% endfor %} |
| 17 }; | 17 }; |
| 18 | 18 |
| 19 {% if enum.is_set %} |
| 20 static const int k{{enum.type_name}}Bits = {{enum.values|length - 1}}; |
| 21 |
| 22 {% for op in ('|', '^') %} |
| 23 inline {{enum.type_name}} operator{{op}}({{enum.type_name}} a, {{enum.type_name}
} b) { |
| 24 return static_cast<{{enum.type_name}}>( |
| 25 static_cast<unsigned>(a) {{op}} static_cast<unsigned>(b) |
| 26 ); |
| 27 } |
| 28 inline {{enum.type_name}}& operator{{op}}=({{enum.type_name}}& a, {{enum.type_na
me}} b) { |
| 29 return a = a {{op}} b; |
| 30 } |
| 31 |
| 32 {% endfor %} |
| 33 {% endif %} |
| 19 {% endfor %} | 34 {% endfor %} |
| 20 } // namespace blink | 35 } // namespace blink |
| 21 | 36 |
| 22 #endif // ComputedStyleBaseConstants_h | 37 #endif // ComputedStyleBaseConstants_h |
| OLD | NEW |