| {% from 'macros.tmpl' import license, print_if %} |
| {{license()}} |
| |
| #ifndef ComputedStyleBaseConstants_h |
| #define ComputedStyleBaseConstants_h |
| |
| namespace blink { |
| |
| // TODO(sashab): Move these enums to their own namespace, or add a CSS prefix, |
| // for consistency and to prevent name conflicts. |
| |
| {% for enum in enums %} |
| enum class {{enum.type_name}} : unsigned { |
| {% for value in enum.values %} |
| {{value}}{{print_if(enum.is_set, " = " ~ (0 if loop.first else 2**loop.index0))}}, |
| {% endfor %} |
| }; |
| |
| {% if enum.is_set %} |
| static const int k{{enum.type_name}}Bits = {{enum.values|length - 1}}; |
| |
| {% for op in ('|', '^') %} |
| inline {{enum.type_name}} operator{{op}}({{enum.type_name}} a, {{enum.type_name}} b) { |
| return static_cast<{{enum.type_name}}>( |
| static_cast<unsigned>(a) {{op}} static_cast<unsigned>(b) |
| ); |
| } |
| inline {{enum.type_name}}& operator{{op}}=({{enum.type_name}}& a, {{enum.type_name}} b) { |
| return a = a {{op}} b; |
| } |
| |
| {% endfor %} |
| {% endif %} |
| {% endfor %} |
| } // namespace blink |
| |
| #endif // ComputedStyleBaseConstants_h |