Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #ifndef ComputedStyleConstants_h | 28 #ifndef ComputedStyleConstants_h |
| 29 #define ComputedStyleConstants_h | 29 #define ComputedStyleConstants_h |
| 30 | 30 |
| 31 #include "core/ComputedStyleBaseConstants.h" | 31 #include "core/ComputedStyleBaseConstants.h" |
| 32 #include <cstddef> | 32 #include <cstddef> |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 template <typename Enum> | |
| 37 inline bool EnumHasFlags(Enum v, Enum mask) { | |
| 38 return static_cast<unsigned>(v) & static_cast<unsigned>(mask); | |
| 39 } | |
| 40 | |
| 36 // Some enums are automatically generated in ComputedStyleBaseConstants | 41 // Some enums are automatically generated in ComputedStyleBaseConstants |
| 37 | 42 |
| 38 // TODO(sashab): Change these enums to enum classes with an unsigned underlying | 43 // TODO(sashab): Change these enums to enum classes with an unsigned underlying |
| 39 // type. Enum classes provide better type safety, and forcing an unsigned | 44 // type. Enum classes provide better type safety, and forcing an unsigned |
| 40 // underlying type prevents msvc from interpreting enums as negative numbers. | 45 // underlying type prevents msvc from interpreting enums as negative numbers. |
| 41 // See: crbug.com/628043 | 46 // See: crbug.com/628043 |
| 42 | 47 |
| 43 // Sides used when drawing borders and outlines. The values should run clockwise | 48 // Sides used when drawing borders and outlines. The values should run clockwise |
| 44 // from top. | 49 // from top. |
| 45 enum BoxSide { kBSTop, kBSRight, kBSBottom, kBSLeft }; | 50 enum BoxSide { kBSTop, kBSRight, kBSBottom, kBSLeft }; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 kLineBreakAfterWhiteSpace | 249 kLineBreakAfterWhiteSpace |
| 245 }; | 250 }; |
| 246 | 251 |
| 247 enum EResize { RESIZE_NONE, RESIZE_BOTH, RESIZE_HORIZONTAL, RESIZE_VERTICAL }; | 252 enum EResize { RESIZE_NONE, RESIZE_BOTH, RESIZE_HORIZONTAL, RESIZE_VERTICAL }; |
| 248 | 253 |
| 249 enum QuoteType { OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE }; | 254 enum QuoteType { OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE }; |
| 250 | 255 |
| 251 enum EAnimPlayState { kAnimPlayStatePlaying, kAnimPlayStatePaused }; | 256 enum EAnimPlayState { kAnimPlayStatePlaying, kAnimPlayStatePaused }; |
| 252 | 257 |
| 253 static const size_t kTextDecorationBits = 4; | 258 static const size_t kTextDecorationBits = 4; |
| 254 enum TextDecoration { | 259 enum class TextDecoration : unsigned { |
| 255 kTextDecorationNone = 0x0, | 260 kNone = 0x0, |
| 256 kTextDecorationUnderline = 0x1, | 261 kUnderline = 0x1, |
| 257 kTextDecorationOverline = 0x2, | 262 kOverline = 0x2, |
| 258 kTextDecorationLineThrough = 0x4, | 263 kLineThrough = 0x4, |
| 259 kTextDecorationBlink = 0x8 | 264 kBlink = 0x8 |
| 260 }; | 265 }; |
| 261 inline TextDecoration operator|(TextDecoration a, TextDecoration b) { | 266 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
| |
| 262 return TextDecoration(int(a) | int(b)); | 267 return static_cast<TextDecoration>(static_cast<unsigned>(a) | |
| 268 static_cast<unsigned>(b)); | |
| 263 } | 269 } |
| 264 inline TextDecoration& operator|=(TextDecoration& a, TextDecoration b) { | 270 inline TextDecoration& operator|=(TextDecoration& a, TextDecoration b) { |
| 265 return a = a | b; | 271 return a = static_cast<TextDecoration>(static_cast<unsigned>(a) | |
| 272 static_cast<unsigned>(b)); | |
| 273 } | |
| 274 inline TextDecoration& operator^=(TextDecoration& a, TextDecoration b) { | |
| 275 return a = static_cast<TextDecoration>(static_cast<unsigned>(a) ^ | |
| 276 static_cast<unsigned>(b)); | |
| 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 |