Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: third_party/WebKit/Source/core/style/BorderValue.h

Issue 2880573002: Store border-*-style on SurroundData in ComputedStyle (Closed)
Patch Set: Merge branch 'enumClass' into borderStyle Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/BorderStyle.h"
30 #include "core/style/ComputedStyleConstants.h" 29 #include "core/style/ComputedStyleConstants.h"
31 #include "platform/graphics/Color.h" 30 #include "platform/graphics/Color.h"
32 #include "platform/wtf/Allocator.h" 31 #include "platform/wtf/Allocator.h"
33 32
34 namespace blink { 33 namespace blink {
35 34
36 class BorderValue { 35 class BorderValue {
37 DISALLOW_NEW(); 36 DISALLOW_NEW();
38 friend class ComputedStyle; 37 friend class ComputedStyle;
39 38
40 public: 39 public:
41 BorderValue() 40 BorderValue()
42 : color_(0), 41 : color_(0),
43 color_is_current_color_(true), 42 color_is_current_color_(true),
44 style_(static_cast<unsigned>(EBorderStyle::kNone)), 43 style_(static_cast<unsigned>(EBorderStyle::kNone)),
45 is_auto_(kOutlineIsAutoOff) { 44 is_auto_(kOutlineIsAutoOff) {
46 SetWidth(3); 45 SetWidth(3);
47 } 46 }
48 47
49 BorderValue(const BorderStyle& data, const StyleColor& color, float width) { 48 BorderValue(EBorderStyle style,
49 const StyleColor& color,
50 float width,
51 OutlineIsAuto is_auto) {
50 SetColor(color.Resolve(Color())); 52 SetColor(color.Resolve(Color()));
51 SetStyle(data.Style()); 53 SetStyle(style);
52 SetIsAuto(data.IsAuto());
53 SetWidth(width); 54 SetWidth(width);
55 SetIsAuto(is_auto);
54 } 56 }
55 57
56 bool NonZero() const { 58 bool NonZero() const {
57 return Width() && (style_ != static_cast<unsigned>(EBorderStyle::kNone)); 59 return Width() && (style_ != static_cast<unsigned>(EBorderStyle::kNone));
58 } 60 }
59 61
60 bool IsTransparent() const { 62 bool IsTransparent() const {
61 return !color_is_current_color_ && !color_.Alpha(); 63 return !color_is_current_color_ && !color_.Alpha();
62 } 64 }
63 65
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 unsigned width_ : 26; // Fixed point width 127 unsigned width_ : 26; // Fixed point width
126 unsigned style_ : 4; // EBorderStyle 128 unsigned style_ : 4; // EBorderStyle
127 129
128 // This is only used by OutlineValue but moved here to keep the bits packed. 130 // This is only used by OutlineValue but moved here to keep the bits packed.
129 unsigned is_auto_ : 1; // OutlineIsAuto 131 unsigned is_auto_ : 1; // OutlineIsAuto
130 }; 132 };
131 133
132 } // namespace blink 134 } // namespace blink
133 135
134 #endif // BorderValue_h 136 #endif // BorderValue_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/BorderData.h ('k') | third_party/WebKit/Source/core/style/CachedUAStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698