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 |
11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
12 * | 12 * |
13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
17 * | 17 * |
18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
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/BorderColorAndStyle.h" | 29 #include "core/style/BorderStyle.h" |
30 #include "core/style/ComputedStyleConstants.h" | 30 #include "core/style/ComputedStyleConstants.h" |
31 #include "platform/graphics/Color.h" | 31 #include "platform/graphics/Color.h" |
32 #include "platform/wtf/Allocator.h" | 32 #include "platform/wtf/Allocator.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class BorderValue { | 36 class BorderValue { |
37 DISALLOW_NEW(); | 37 DISALLOW_NEW(); |
38 friend class ComputedStyle; | 38 friend class ComputedStyle; |
39 | 39 |
40 public: | 40 public: |
41 BorderValue() | 41 BorderValue() |
42 : color_(0), | 42 : color_(0), |
43 color_is_current_color_(true), | 43 color_is_current_color_(true), |
44 style_(kBorderStyleNone), | 44 style_(kBorderStyleNone), |
45 is_auto_(kOutlineIsAutoOff) { | 45 is_auto_(kOutlineIsAutoOff) { |
46 SetWidth(3); | 46 SetWidth(3); |
47 } | 47 } |
48 | 48 |
49 BorderValue(const BorderColorAndStyle& data, float width) { | 49 BorderValue(const BorderStyle& data, const StyleColor& color, float width) { |
shend
2017/05/11 00:41:13
Previously, BorderValue took a BorderColorAndStyle
nainar
2017/05/11 01:04:50
Yup.
| |
50 SetColor(data.GetColor()); | 50 SetColor(color.Resolve(Color())); |
51 SetColorIsCurrentColor(ColorIsCurrentColor()); | |
52 SetStyle(data.Style()); | 51 SetStyle(data.Style()); |
53 SetIsAuto(data.IsAuto()); | 52 SetIsAuto(data.IsAuto()); |
54 SetWidth(width); | 53 SetWidth(width); |
55 } | 54 } |
56 | 55 |
57 bool NonZero() const { return Width() && (style_ != kBorderStyleNone); } | 56 bool NonZero() const { return Width() && (style_ != kBorderStyleNone); } |
58 | 57 |
59 bool IsTransparent() const { | 58 bool IsTransparent() const { |
60 return !color_is_current_color_ && !color_.Alpha(); | 59 return !color_is_current_color_ && !color_.Alpha(); |
61 } | 60 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 unsigned width_ : 26; // Fixed point width | 121 unsigned width_ : 26; // Fixed point width |
123 unsigned style_ : 4; // EBorderStyle | 122 unsigned style_ : 4; // EBorderStyle |
124 | 123 |
125 // This is only used by OutlineValue but moved here to keep the bits packed. | 124 // This is only used by OutlineValue but moved here to keep the bits packed. |
126 unsigned is_auto_ : 1; // OutlineIsAuto | 125 unsigned is_auto_ : 1; // OutlineIsAuto |
127 }; | 126 }; |
128 | 127 |
129 } // namespace blink | 128 } // namespace blink |
130 | 129 |
131 #endif // BorderValue_h | 130 #endif // BorderValue_h |
OLD | NEW |