summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/core/rendering/style/BorderValue.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/rendering/style/BorderValue.h')
-rw-r--r--chromium/third_party/WebKit/Source/core/rendering/style/BorderValue.h29
1 files changed, 20 insertions, 9 deletions
diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/BorderValue.h b/chromium/third_party/WebKit/Source/core/rendering/style/BorderValue.h
index dcd5096df0b..211f0be97f9 100644
--- a/chromium/third_party/WebKit/Source/core/rendering/style/BorderValue.h
+++ b/chromium/third_party/WebKit/Source/core/rendering/style/BorderValue.h
@@ -25,6 +25,7 @@
#ifndef BorderValue_h
#define BorderValue_h
+#include "core/css/StyleColor.h"
#include "core/rendering/style/RenderStyleConstants.h"
#include "platform/graphics/Color.h"
@@ -35,7 +36,7 @@ friend class RenderStyle;
public:
BorderValue()
: m_color(0)
- , m_colorIsValid(false)
+ , m_colorIsCurrentColor(true)
, m_width(3)
, m_style(BNONE)
, m_isAuto(AUTO_OFF)
@@ -49,7 +50,7 @@ public:
bool isTransparent() const
{
- return m_colorIsValid && !alphaChannel(m_color);
+ return !m_colorIsCurrentColor && !m_color.alpha();
}
bool isVisible(bool checkStyle = true) const
@@ -59,7 +60,17 @@ public:
bool operator==(const BorderValue& o) const
{
- return m_width == o.m_width && m_style == o.m_style && m_color == o.m_color && m_colorIsValid == o.m_colorIsValid;
+ return m_width == o.m_width && m_style == o.m_style && m_color == o.m_color && m_colorIsCurrentColor == o.m_colorIsCurrentColor;
+ }
+
+ // The default width is 3px, but if the style is none we compute a value of 0 (in RenderStyle itself)
+ bool visuallyEqual(const BorderValue& o) const
+ {
+ if (m_style == BNONE && o.m_style == BNONE)
+ return true;
+ if (m_style == BHIDDEN && o.m_style == BHIDDEN)
+ return true;
+ return *this == o;
}
bool operator!=(const BorderValue& o) const
@@ -67,20 +78,20 @@ public:
return !(*this == o);
}
- void setColor(const Color& color)
+ void setColor(const StyleColor& color)
{
- m_color = color.rgb();
- m_colorIsValid = color.isValid();
+ m_color = color.resolve(Color());
+ m_colorIsCurrentColor = color.isCurrentColor();
}
- Color color() const { return Color(m_color, m_colorIsValid); }
+ StyleColor color() const { return m_colorIsCurrentColor ? StyleColor::currentColor() : StyleColor(m_color); }
unsigned width() const { return m_width; }
EBorderStyle style() const { return static_cast<EBorderStyle>(m_style); }
protected:
- RGBA32 m_color;
- unsigned m_colorIsValid : 1;
+ Color m_color;
+ unsigned m_colorIsCurrentColor : 1;
unsigned m_width : 26;
unsigned m_style : 4; // EBorderStyle