Index: Source/platform/BorderImageLength.h |
diff --git a/Source/platform/BorderImageLength.h b/Source/platform/BorderImageLength.h |
index 790f65f5ed11611069b184f40f98a3b32757f3c5..756a848ad46e08d6e17df05aea63cf2ae6c8bfd9 100644 |
--- a/Source/platform/BorderImageLength.h |
+++ b/Source/platform/BorderImageLength.h |
@@ -37,40 +37,54 @@ namespace WebCore { |
class PLATFORM_EXPORT BorderImageLength { |
public: |
+ // Default is 'auto' |
Julien - ping for review
2013/11/04 18:30:25
Default _Length_ is 'auto' if that changed, this w
|
BorderImageLength() |
+ : m_number(0) |
+ , m_type(LengthType) |
{ |
} |
BorderImageLength(double number) |
- : m_length(number, Relative) |
+ : m_length(Undefined) |
+ , m_number(number) |
+ , m_type(NumberType) |
{ |
} |
BorderImageLength(const Length& length) |
: m_length(length) |
+ , m_number(0) |
+ , m_type(LengthType) |
{ |
} |
- bool isNumber() const { return m_length.isRelative(); } |
- bool isLength() const { return !isNumber(); } |
+ bool isNumber() const { return m_type == NumberType; } |
+ bool isLength() const { return m_type == LengthType; } |
const Length& length() const { ASSERT(isLength()); return m_length; } |
Length& length() { ASSERT(isLength()); return m_length; } |
- double number() const { ASSERT(isNumber()); return m_length.value(); } |
+ double number() const { ASSERT(isNumber()); return m_number; } |
bool operator==(const BorderImageLength& o) const |
{ |
- return m_length == o.m_length; |
+ return m_length == o.m_length && m_number == o.m_number && m_type == o.m_type; |
Julien - ping for review
2013/11/04 18:30:25
Nit: Let's put m_type first. And |o| -> |other| ^_
|
} |
bool isZero() const |
{ |
- return m_length.isZero(); |
+ return (isLength() && m_length.isZero()) || (isNumber() && m_number); |
} |
private: |
+ // Ideally we would put the 2 following fields in a union, but Length has a constructor, |
+ // a destructor and a copy assignment which isn't allowed. |
Length m_length; |
+ double m_number; |
+ enum { |
+ LengthType, |
+ NumberType |
+ } m_type; |
}; |
} // namespace WebCore |