| Index: Source/core/css/CSSValue.h
|
| diff --git a/Source/core/css/CSSValue.h b/Source/core/css/CSSValue.h
|
| index 609dcbc85afcae15a768dc5b5debdca568aa6112..ac7df50a004ea2b8914057e1cfcd39f5a06dba76 100644
|
| --- a/Source/core/css/CSSValue.h
|
| +++ b/Source/core/css/CSSValue.h
|
| @@ -22,6 +22,7 @@
|
| #define CSSValue_h
|
|
|
| #include "core/CoreExport.h"
|
| +#include "core/css/CSSPrimitiveValue.h"
|
| #include "core/css/CSSValueObject.h"
|
| #include "platform/heap/Handle.h"
|
| #include "wtf/RefCounted.h"
|
| @@ -67,6 +68,13 @@ public:
|
| ref();
|
| }
|
|
|
| + // Implicit conversion from CSSPrimitiveValue.
|
| + CSSValue(CSSPrimitiveValue cssPrimitiveValue)
|
| + : m_data(static_cast<CSSValueObject*>(cssPrimitiveValue.get()))
|
| + {
|
| + ref();
|
| + }
|
| +
|
| ~CSSValue()
|
| {
|
| deref();
|
| @@ -221,12 +229,19 @@ public:
|
| ref();
|
| }
|
|
|
| + // Implicit conversion from CSSPrimitiveValue.
|
| + NullableCSSValue(CSSPrimitiveValue cssPrimitiveValue)
|
| + : m_data(static_cast<CSSValueObject*>(cssPrimitiveValue.get()))
|
| + {
|
| + ref();
|
| + }
|
| +
|
| ~NullableCSSValue()
|
| {
|
| deref();
|
| };
|
|
|
| - operator bool() const
|
| + explicit operator bool() const
|
| {
|
| return m_data;
|
| }
|
| @@ -239,12 +254,12 @@ public:
|
| return *this;
|
| }
|
|
|
| - bool operator==(const NullableCSSValue& rhs)
|
| + bool operator==(const NullableCSSValue& rhs) const
|
| {
|
| return m_data ? rhs.m_data && m_data->equals(*rhs.m_data) : !bool(rhs.m_data);
|
| }
|
|
|
| - bool operator!=(const NullableCSSValue& rhs)
|
| + bool operator!=(const NullableCSSValue& rhs) const
|
| {
|
| return !(*this == rhs);
|
| }
|
| @@ -348,6 +363,13 @@ inline bool compareCSSValueVector(const WillBeHeapVector<CSSValue, inlineCapacit
|
| return static_cast<thisType*>(value.get()); \
|
| }
|
|
|
| +// Returns by value on purpose.
|
| +inline CSSPrimitiveValue toCSSPrimitiveValue(const CSSValue& value)
|
| +{
|
| + ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue());
|
| + return CSSPrimitiveValue(static_cast<CSSPrimitiveValue::CSSLargePrimitiveValue*>(value.get()));
|
| +}
|
| +
|
| } // namespace blink
|
|
|
| WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::CSSValue);
|
|
|