Chromium Code Reviews| Index: third_party/WebKit/Source/core/style/ComputedStyleConstants.h |
| diff --git a/third_party/WebKit/Source/core/style/ComputedStyleConstants.h b/third_party/WebKit/Source/core/style/ComputedStyleConstants.h |
| index 1b89f9e062e028c1ec1ca9a73c5dcefb91041479..0f21e8c8b1d02b315b6ea4fb82cf99e2754c3e97 100644 |
| --- a/third_party/WebKit/Source/core/style/ComputedStyleConstants.h |
| +++ b/third_party/WebKit/Source/core/style/ComputedStyleConstants.h |
| @@ -33,6 +33,11 @@ |
| namespace blink { |
| +template <typename Enum> |
| +inline bool EnumHasFlags(Enum v, Enum mask) { |
| + return static_cast<unsigned>(v) & static_cast<unsigned>(mask); |
| +} |
| + |
| // Some enums are automatically generated in ComputedStyleBaseConstants |
| // TODO(sashab): Change these enums to enum classes with an unsigned underlying |
| @@ -251,18 +256,24 @@ enum QuoteType { OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE }; |
| enum EAnimPlayState { kAnimPlayStatePlaying, kAnimPlayStatePaused }; |
| static const size_t kTextDecorationBits = 4; |
| -enum TextDecoration { |
| - kTextDecorationNone = 0x0, |
| - kTextDecorationUnderline = 0x1, |
| - kTextDecorationOverline = 0x2, |
| - kTextDecorationLineThrough = 0x4, |
| - kTextDecorationBlink = 0x8 |
| +enum class TextDecoration : unsigned { |
| + kNone = 0x0, |
| + kUnderline = 0x1, |
| + kOverline = 0x2, |
| + kLineThrough = 0x4, |
| + kBlink = 0x8 |
| }; |
| inline TextDecoration operator|(TextDecoration a, TextDecoration b) { |
|
Bugs Nash
2017/04/27 00:53:55
ew c++ wat
shend
2017/04/27 01:09:17
lol
|
| - return TextDecoration(int(a) | int(b)); |
| + return static_cast<TextDecoration>(static_cast<unsigned>(a) | |
| + static_cast<unsigned>(b)); |
| } |
| inline TextDecoration& operator|=(TextDecoration& a, TextDecoration b) { |
| - return a = a | b; |
| + return a = static_cast<TextDecoration>(static_cast<unsigned>(a) | |
| + static_cast<unsigned>(b)); |
| +} |
| +inline TextDecoration& operator^=(TextDecoration& a, TextDecoration b) { |
| + return a = static_cast<TextDecoration>(static_cast<unsigned>(a) ^ |
| + static_cast<unsigned>(b)); |
| } |
| enum TextDecorationStyle { |