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

Unified Diff: third_party/WebKit/Source/core/style/ComputedStyleConstants.h

Issue 2845773002: Make TextDecoration an enum class. (Closed)
Patch Set: Rebase Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
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 f8bae4d2b0dfc5c79cee7a77efcb7ebdae64f02e..01715aaeb39ddb5269a9d89977882fa8fb4b8162 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
@@ -241,18 +246,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) {
- 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 {

Powered by Google App Engine
This is Rietveld 408576698