 Chromium Code Reviews
 Chromium Code Reviews Issue 2845773002:
  Make TextDecoration an enum class.  (Closed)
    
  
    Issue 2845773002:
  Make TextDecoration an enum class.  (Closed) 
  | OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 
| 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 
| 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights | 
| 6 * reserved. | 6 * reserved. | 
| 7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) | 
| 10 * | 10 * | 
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 kLineBreakAfterWhiteSpace | 244 kLineBreakAfterWhiteSpace | 
| 245 }; | 245 }; | 
| 246 | 246 | 
| 247 enum EResize { RESIZE_NONE, RESIZE_BOTH, RESIZE_HORIZONTAL, RESIZE_VERTICAL }; | 247 enum EResize { RESIZE_NONE, RESIZE_BOTH, RESIZE_HORIZONTAL, RESIZE_VERTICAL }; | 
| 248 | 248 | 
| 249 enum QuoteType { OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE }; | 249 enum QuoteType { OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE }; | 
| 250 | 250 | 
| 251 enum EAnimPlayState { kAnimPlayStatePlaying, kAnimPlayStatePaused }; | 251 enum EAnimPlayState { kAnimPlayStatePlaying, kAnimPlayStatePaused }; | 
| 252 | 252 | 
| 253 static const size_t kTextDecorationBits = 4; | 253 static const size_t kTextDecorationBits = 4; | 
| 254 enum TextDecoration { | 254 enum class TextDecoration : unsigned { | 
| 255 kTextDecorationNone = 0x0, | 255 kNone = 0x0, | 
| 256 kTextDecorationUnderline = 0x1, | 256 kUnderline = 0x1, | 
| 257 kTextDecorationOverline = 0x2, | 257 kOverline = 0x2, | 
| 258 kTextDecorationLineThrough = 0x4, | 258 kLineThrough = 0x4, | 
| 259 kTextDecorationBlink = 0x8 | 259 kBlink = 0x8 | 
| 260 }; | 260 }; | 
| 261 inline TextDecoration operator|(TextDecoration a, TextDecoration b) { | 261 inline TextDecoration operator|(TextDecoration a, TextDecoration b) { | 
| 262 return TextDecoration(int(a) | int(b)); | 262 return static_cast<TextDecoration>(static_cast<unsigned>(a) | | 
| 263 static_cast<unsigned>(b)); | |
| 263 } | 264 } | 
| 264 inline TextDecoration& operator|=(TextDecoration& a, TextDecoration b) { | 265 inline TextDecoration& operator|=(TextDecoration& a, TextDecoration b) { | 
| 265 return a = a | b; | 266 return a = static_cast<TextDecoration>(static_cast<unsigned>(a) | | 
| 267 static_cast<unsigned>(b)); | |
| 268 } | |
| 269 inline TextDecoration& operator^=(TextDecoration& a, TextDecoration b) { | |
| 270 return a = static_cast<TextDecoration>(static_cast<unsigned>(a) ^ | |
| 271 static_cast<unsigned>(b)); | |
| 272 } | |
| 273 inline bool EnumHasFlags(TextDecoration v, TextDecoration mask) { | |
| 
Bugs Nash
2017/04/27 00:02:23
If this function is only going to be used for Text
 
shend
2017/04/27 00:27:33
Certain other enums will need this as well. I will
 | |
| 274 return static_cast<TextDecoration>(static_cast<unsigned>(v) & | |
| 275 static_cast<unsigned>(mask)) != | |
| 276 TextDecoration::kNone; | |
| 
Bugs Nash
2017/04/27 00:02:23
I don't think TextDecoration::kNone is exactly wha
 
shend
2017/04/27 00:27:33
Done.
 | |
| 266 } | 277 } | 
| 267 | 278 | 
| 268 enum TextDecorationStyle { | 279 enum TextDecorationStyle { | 
| 269 kTextDecorationStyleSolid, | 280 kTextDecorationStyleSolid, | 
| 270 kTextDecorationStyleDouble, | 281 kTextDecorationStyleDouble, | 
| 271 kTextDecorationStyleDotted, | 282 kTextDecorationStyleDotted, | 
| 272 kTextDecorationStyleDashed, | 283 kTextDecorationStyleDashed, | 
| 273 kTextDecorationStyleWavy | 284 kTextDecorationStyleWavy | 
| 274 }; | 285 }; | 
| 275 | 286 | 
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 505 kScrollSnapTypeNone, | 516 kScrollSnapTypeNone, | 
| 506 kScrollSnapTypeMandatory, | 517 kScrollSnapTypeMandatory, | 
| 507 kScrollSnapTypeProximity | 518 kScrollSnapTypeProximity | 
| 508 }; | 519 }; | 
| 509 | 520 | 
| 510 enum AutoRepeatType { kNoAutoRepeat, kAutoFill, kAutoFit }; | 521 enum AutoRepeatType { kNoAutoRepeat, kAutoFill, kAutoFit }; | 
| 511 | 522 | 
| 512 } // namespace blink | 523 } // namespace blink | 
| 513 | 524 | 
| 514 #endif // ComputedStyleConstants_h | 525 #endif // ComputedStyleConstants_h | 
| OLD | NEW |