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 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 14 matching lines...) Expand all Loading... |
25 #ifndef BorderValue_h | 25 #ifndef BorderValue_h |
26 #define BorderValue_h | 26 #define BorderValue_h |
27 | 27 |
28 #include "core/css/StyleColor.h" | 28 #include "core/css/StyleColor.h" |
29 #include "core/style/ComputedStyleConstants.h" | 29 #include "core/style/ComputedStyleConstants.h" |
30 #include "platform/graphics/Color.h" | 30 #include "platform/graphics/Color.h" |
31 #include "platform/wtf/Allocator.h" | 31 #include "platform/wtf/Allocator.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
| 35 // In order to conserve memory, the border width uses fixed point, |
| 36 // which can be bitpacked. This fixed point implementation is |
| 37 // essentially the same as in LayoutUnit. Six bits are used for the |
| 38 // fraction, which leaves 20 bits for the integer part, making 1048575 |
| 39 // the largest number. |
| 40 |
| 41 static const int kBorderWidthFractionalBits = 6; |
| 42 static const int kBorderWidthDenominator = 1 << kBorderWidthFractionalBits; |
| 43 static const int kMaxForBorderWidth = ((1 << 26) - 1) / kBorderWidthDenominator; |
| 44 |
35 class BorderValue { | 45 class BorderValue { |
36 DISALLOW_NEW(); | 46 DISALLOW_NEW(); |
37 friend class ComputedStyle; | 47 friend class ComputedStyle; |
38 | 48 |
39 public: | 49 public: |
40 BorderValue() | 50 BorderValue() |
41 : color_(0), | 51 : color_(0), |
42 color_is_current_color_(true), | 52 color_is_current_color_(true), |
43 style_(static_cast<unsigned>(EBorderStyle::kNone)), | 53 style_(static_cast<unsigned>(EBorderStyle::kNone)), |
44 is_auto_(kOutlineIsAutoOff) { | 54 is_auto_(kOutlineIsAutoOff) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 unsigned width_ : 26; // Fixed point width | 137 unsigned width_ : 26; // Fixed point width |
128 unsigned style_ : 4; // EBorderStyle | 138 unsigned style_ : 4; // EBorderStyle |
129 | 139 |
130 // This is only used by OutlineValue but moved here to keep the bits packed. | 140 // This is only used by OutlineValue but moved here to keep the bits packed. |
131 unsigned is_auto_ : 1; // OutlineIsAuto | 141 unsigned is_auto_ : 1; // OutlineIsAuto |
132 }; | 142 }; |
133 | 143 |
134 } // namespace blink | 144 } // namespace blink |
135 | 145 |
136 #endif // BorderValue_h | 146 #endif // BorderValue_h |
OLD | NEW |