Index: Source/core/css/CSSValue.h |
diff --git a/Source/core/css/CSSValue.h b/Source/core/css/CSSValue.h |
index b2f0a4ef382f1e1c301ec9e2f4a9503e59ef061c..b9d3b052e55182e2427b6a6f048856802d2d3724 100644 |
--- a/Source/core/css/CSSValue.h |
+++ b/Source/core/css/CSSValue.h |
@@ -72,7 +72,7 @@ public: |
} |
// Implicit conversion from CSSPrimitiveValue. |
- CSSValue(CSSPrimitiveValue cssPrimitiveValue) |
+ CSSValue(const CSSPrimitiveValue& cssPrimitiveValue) |
: m_data(static_cast<CSSValueObject*>(cssPrimitiveValue.get())) |
{ |
ref(); |
@@ -253,7 +253,7 @@ public: |
} |
// Implicit conversion from CSSPrimitiveValue. |
- NullableCSSValue(CSSPrimitiveValue cssPrimitiveValue) |
+ NullableCSSValue(const CSSPrimitiveValue& cssPrimitiveValue) |
: m_data(static_cast<CSSValueObject*>(cssPrimitiveValue.get())) |
{ |
ref(); |
@@ -363,6 +363,7 @@ private: |
static_assert(sizeof(CSSValue) == sizeof(void*), "CSSValue should be pointer-sized"); |
static_assert(sizeof(NullableCSSValue) == sizeof(void*), "CSSValue should be pointer-sized"); |
static_assert(sizeof(CSSValue) == sizeof(NullableCSSValue), "Both CSSValue containers must contain the same data"); |
+static_assert(sizeof(CSSValue) == sizeof(CSSPrimitiveValue), "Both CSSValue and CSSPrimitiveValue must contain the same data"); |
template<size_t inlineCapacity> |
inline bool compareCSSValueVector(const WillBeHeapVector<CSSValue, inlineCapacity>& firstVector, const WillBeHeapVector<CSSValue, inlineCapacity>& secondVector) |
@@ -397,11 +398,18 @@ inline bool compareCSSValueVector(const WillBeHeapVector<CSSValue, inlineCapacit |
} |
// Returns by value on purpose. |
-inline CSSPrimitiveValue toCSSPrimitiveValue(const CSSValue& value) |
+inline const CSSPrimitiveValue& toCSSPrimitiveValue(const CSSValue& value) |
{ |
ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue()); |
- return CSSPrimitiveValue(static_cast<CSSPrimitiveValue::CSSLargePrimitiveValue*>(value.get())); |
+ return *reinterpret_cast<const CSSPrimitiveValue*>(&value); |
} |
+/* |
+inline CSSPrimitiveValue& toCSSPrimitiveValue(const CSSValue& value) |
+{ |
+ ASSERT_WITH_SECURITY_IMPLICATION(value.isPrimitiveValue()); |
+ return *const_cast<CSSPrimitiveValue*>(reinterpret_cast<const CSSPrimitiveValue*>(&value)); |
+} |
+*/ |
} // namespace blink |