| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 kLineBreakAfterWhiteSpace | 239 kLineBreakAfterWhiteSpace |
| 235 }; | 240 }; |
| 236 | 241 |
| 237 enum EResize { RESIZE_NONE, RESIZE_BOTH, RESIZE_HORIZONTAL, RESIZE_VERTICAL }; | 242 enum EResize { RESIZE_NONE, RESIZE_BOTH, RESIZE_HORIZONTAL, RESIZE_VERTICAL }; |
| 238 | 243 |
| 239 enum QuoteType { OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE }; | 244 enum QuoteType { OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE }; |
| 240 | 245 |
| 241 enum EAnimPlayState { kAnimPlayStatePlaying, kAnimPlayStatePaused }; | 246 enum EAnimPlayState { kAnimPlayStatePlaying, kAnimPlayStatePaused }; |
| 242 | 247 |
| 243 static const size_t kTextDecorationBits = 4; | 248 static const size_t kTextDecorationBits = 4; |
| 244 enum TextDecoration { | 249 enum class TextDecoration : unsigned { |
| 245 kTextDecorationNone = 0x0, | 250 kNone = 0x0, |
| 246 kTextDecorationUnderline = 0x1, | 251 kUnderline = 0x1, |
| 247 kTextDecorationOverline = 0x2, | 252 kOverline = 0x2, |
| 248 kTextDecorationLineThrough = 0x4, | 253 kLineThrough = 0x4, |
| 249 kTextDecorationBlink = 0x8 | 254 kBlink = 0x8 |
| 250 }; | 255 }; |
| 251 inline TextDecoration operator|(TextDecoration a, TextDecoration b) { | 256 inline TextDecoration operator|(TextDecoration a, TextDecoration b) { |
| 252 return TextDecoration(int(a) | int(b)); | 257 return static_cast<TextDecoration>(static_cast<unsigned>(a) | |
| 258 static_cast<unsigned>(b)); |
| 253 } | 259 } |
| 254 inline TextDecoration& operator|=(TextDecoration& a, TextDecoration b) { | 260 inline TextDecoration& operator|=(TextDecoration& a, TextDecoration b) { |
| 255 return a = a | b; | 261 return a = static_cast<TextDecoration>(static_cast<unsigned>(a) | |
| 262 static_cast<unsigned>(b)); |
| 263 } |
| 264 inline TextDecoration& operator^=(TextDecoration& a, TextDecoration b) { |
| 265 return a = static_cast<TextDecoration>(static_cast<unsigned>(a) ^ |
| 266 static_cast<unsigned>(b)); |
| 256 } | 267 } |
| 257 | 268 |
| 258 enum TextDecorationStyle { | 269 enum TextDecorationStyle { |
| 259 kTextDecorationStyleSolid, | 270 kTextDecorationStyleSolid, |
| 260 kTextDecorationStyleDouble, | 271 kTextDecorationStyleDouble, |
| 261 kTextDecorationStyleDotted, | 272 kTextDecorationStyleDotted, |
| 262 kTextDecorationStyleDashed, | 273 kTextDecorationStyleDashed, |
| 263 kTextDecorationStyleWavy | 274 kTextDecorationStyleWavy |
| 264 }; | 275 }; |
| 265 | 276 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 // fraction, which leaves 20 bits for the integer part, making 1048575 | 488 // fraction, which leaves 20 bits for the integer part, making 1048575 |
| 478 // the largest number. | 489 // the largest number. |
| 479 | 490 |
| 480 static const int kBorderWidthFractionalBits = 6; | 491 static const int kBorderWidthFractionalBits = 6; |
| 481 static const int kBorderWidthDenominator = 1 << kBorderWidthFractionalBits; | 492 static const int kBorderWidthDenominator = 1 << kBorderWidthFractionalBits; |
| 482 static const int kMaxForBorderWidth = ((1 << 26) - 1) / kBorderWidthDenominator; | 493 static const int kMaxForBorderWidth = ((1 << 26) - 1) / kBorderWidthDenominator; |
| 483 | 494 |
| 484 } // namespace blink | 495 } // namespace blink |
| 485 | 496 |
| 486 #endif // ComputedStyleConstants_h | 497 #endif // ComputedStyleConstants_h |
| OLD | NEW |