Index: Source/core/css/CSSValue.h |
diff --git a/Source/core/css/CSSValue.h b/Source/core/css/CSSValue.h |
index 609dcbc85afcae15a768dc5b5debdca568aa6112..28a560cbf2577f6e2fa604c60db5b89e25c0236b 100644 |
--- a/Source/core/css/CSSValue.h |
+++ b/Source/core/css/CSSValue.h |
@@ -69,7 +69,10 @@ public: |
~CSSValue() |
{ |
- deref(); |
+ // Although m_data can't be null, a move constructor from NullableCSSValue |
+ // could make it null for a short time. |
+ if (m_data) |
+ deref(); |
} |
CSSValue& operator=(const CSSValue& rhs) |
@@ -80,6 +83,18 @@ public: |
return *this; |
} |
+ CSSValue& operator=(CSSValue&& rhs) |
+ { |
+ m_data = rhs.m_data; |
+ rhs.m_data.clear(); |
+ return *this; |
+ } |
+ |
+ CSSValue(CSSValue&& rhs) |
+ { |
+ m_data = rhs.m_data; |
+ } |
+ |
bool operator==(const CSSValue& other) const |
{ |
return m_data->equals(*other.m_data); |
@@ -231,6 +246,12 @@ public: |
return m_data; |
} |
+ NullableCSSValue(NullableCSSValue&& rhs) |
+ { |
+ m_data = rhs.m_data; |
+ rhs.m_data = nullptr; |
+ } |
+ |
NullableCSSValue& operator=(const NullableCSSValue& rhs) |
{ |
rhs.ref(); |
@@ -239,7 +260,14 @@ public: |
return *this; |
} |
- bool operator==(const NullableCSSValue& rhs) |
+ NullableCSSValue& operator=(NullableCSSValue&& rhs) |
+ { |
+ m_data = rhs.m_data; |
+ rhs.m_data.clear(); |
+ return *this; |
+ } |
+ |
+ bool operator==(const NullableCSSValue& rhs) const |
{ |
return m_data ? rhs.m_data && m_data->equals(*rhs.m_data) : !bool(rhs.m_data); |
} |