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

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

Issue 2640143005: Support subpixel layout for borders. (Closed)
Patch Set: Created 3 years, 11 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
(...skipping 21 matching lines...) Expand all
32 32
33 namespace blink { 33 namespace blink {
34 34
35 class BorderValue { 35 class BorderValue {
36 DISALLOW_NEW(); 36 DISALLOW_NEW();
37 friend class ComputedStyle; 37 friend class ComputedStyle;
38 38
39 public: 39 public:
40 BorderValue() 40 BorderValue()
41 : m_color(0), 41 : m_color(0),
42 m_width(3),
42 m_colorIsCurrentColor(true), 43 m_colorIsCurrentColor(true),
43 m_width(3),
44 m_style(BorderStyleNone), 44 m_style(BorderStyleNone),
45 m_isAuto(OutlineIsAutoOff) {} 45 m_isAuto(OutlineIsAutoOff) {}
46 46
47 bool nonZero() const { return width() && (m_style != BorderStyleNone); } 47 bool nonZero() const { return width() && (m_style != BorderStyleNone); }
48 48
49 bool isTransparent() const { 49 bool isTransparent() const {
50 return !m_colorIsCurrentColor && !m_color.alpha(); 50 return !m_colorIsCurrentColor && !m_color.alpha();
51 } 51 }
52 52
53 bool operator==(const BorderValue& o) const { 53 bool operator==(const BorderValue& o) const {
(...skipping 17 matching lines...) Expand all
71 void setColor(const StyleColor& color) { 71 void setColor(const StyleColor& color) {
72 m_color = color.resolve(Color()); 72 m_color = color.resolve(Color());
73 m_colorIsCurrentColor = color.isCurrentColor(); 73 m_colorIsCurrentColor = color.isCurrentColor();
74 } 74 }
75 75
76 StyleColor color() const { 76 StyleColor color() const {
77 return m_colorIsCurrentColor ? StyleColor::currentColor() 77 return m_colorIsCurrentColor ? StyleColor::currentColor()
78 : StyleColor(m_color); 78 : StyleColor(m_color);
79 } 79 }
80 80
81 int width() const { return m_width; } 81 float width() const { return m_width; }
pdr. 2017/01/24 06:57:31 I'm a little worried about the compatibility of th
Karl Øygard 2017/01/24 22:42:58 I'm trying to figure out how WebKit and FF are han
82 82
83 EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); } 83 EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
84 void setStyle(EBorderStyle style) { m_style = style; } 84 void setStyle(EBorderStyle style) { m_style = style; }
85 85
86 protected: 86 protected:
87 Color m_color; 87 Color m_color;
88 float m_width;
pdr. 2017/01/24 06:57:31 What range of values does this need to store? I do
pdr. 2017/01/24 19:52:12 Looking at this a bit closer... border width is on
Karl Øygard 2017/01/24 22:42:58 Unless I overlooked something, outline-width uses
88 unsigned m_colorIsCurrentColor : 1; 89 unsigned m_colorIsCurrentColor : 1;
89 90
90 unsigned m_width : 26;
91 unsigned m_style : 4; // EBorderStyle 91 unsigned m_style : 4; // EBorderStyle
92 92
93 // This is only used by OutlineValue but moved here to keep the bits packed. 93 // This is only used by OutlineValue but moved here to keep the bits packed.
94 unsigned m_isAuto : 1; // OutlineIsAuto 94 unsigned m_isAuto : 1; // OutlineIsAuto
95 }; 95 };
96 96
97 } // namespace blink 97 } // namespace blink
98 98
99 #endif // BorderValue_h 99 #endif // BorderValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698