| Index: Source/core/css/CSSBasicShapes.cpp
|
| diff --git a/Source/core/css/CSSBasicShapes.cpp b/Source/core/css/CSSBasicShapes.cpp
|
| index 6b8eac31794a17660a6bd045662465ce7bc57cf4..170755f704c6c841bd4c89c2208df17f543b1298 100644
|
| --- a/Source/core/css/CSSBasicShapes.cpp
|
| +++ b/Source/core/css/CSSBasicShapes.cpp
|
| @@ -69,23 +69,23 @@ static String buildCircleString(const String& radius, const String& centerX, con
|
|
|
| static String serializePositionOffset(const Pair& offset, const Pair& other)
|
| {
|
| - if ((offset.first()->getValueID() == CSSValueLeft && other.first()->getValueID() == CSSValueTop)
|
| - || (offset.first()->getValueID() == CSSValueTop && other.first()->getValueID() == CSSValueLeft))
|
| - return offset.second()->cssText();
|
| + if ((offset.first().getValueID() == CSSValueLeft && other.first().getValueID() == CSSValueTop)
|
| + || (offset.first().getValueID() == CSSValueTop && other.first().getValueID() == CSSValueLeft))
|
| + return offset.second().cssText();
|
| return offset.cssText();
|
| }
|
|
|
| -static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> buildSerializablePositionOffset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> offset, CSSValueID defaultSide)
|
| +static CSSPrimitiveValue buildSerializablePositionOffset(const NullableCSSValue& offset, CSSValueID defaultSide)
|
| {
|
| CSSValueID side = defaultSide;
|
| - RefPtrWillBeRawPtr<CSSPrimitiveValue> amount = nullptr;
|
| + NullableCSSValue amount;
|
|
|
| if (!offset) {
|
| side = CSSValueCenter;
|
| - } else if (offset->isValueID()) {
|
| - side = offset->getValueID();
|
| - } else if (Pair* pair = offset->getPairValue()) {
|
| - side = pair->first()->getValueID();
|
| + } else if (toCSSPrimitiveValue(offset).isValueID()) {
|
| + side = toCSSPrimitiveValue(offset).getValueID();
|
| + } else if (Pair* pair = toCSSPrimitiveValue(offset).getPairValue()) {
|
| + side = pair->first().getValueID();
|
| amount = pair->second();
|
| } else {
|
| amount = offset;
|
| @@ -95,10 +95,10 @@ static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> buildSerializablePositionOffset
|
| side = defaultSide;
|
| amount = cssValuePool().createValue(50, CSSPrimitiveValue::CSS_PERCENTAGE);
|
| } else if ((side == CSSValueRight || side == CSSValueBottom)
|
| - && amount->isPercentage()) {
|
| + && toCSSPrimitiveValue(amount).isPercentage()) {
|
| side = defaultSide;
|
| - amount = cssValuePool().createValue(100 - amount->getFloatValue(), CSSPrimitiveValue::CSS_PERCENTAGE);
|
| - } else if (amount->isLength() && !amount->getFloatValue()) {
|
| + amount = cssValuePool().createValue(100 - toCSSPrimitiveValue(amount).getFloatValue(), CSSPrimitiveValue::CSS_PERCENTAGE);
|
| + } else if (toCSSPrimitiveValue(amount).isLength() && !toCSSPrimitiveValue(amount).getFloatValue()) {
|
| if (side == CSSValueRight || side == CSSValueBottom)
|
| amount = cssValuePool().createValue(100, CSSPrimitiveValue::CSS_PERCENTAGE);
|
| else
|
| @@ -106,21 +106,21 @@ static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> buildSerializablePositionOffset
|
| side = defaultSide;
|
| }
|
|
|
| - return cssValuePool().createValue(Pair::create(cssValuePool().createValue(side), amount.release(), Pair::KeepIdenticalValues));
|
| + return cssValuePool().createValue(Pair::create(cssValuePool().createValue(side), toCSSPrimitiveValue(amount), Pair::KeepIdenticalValues));
|
| }
|
|
|
| String CSSBasicShapeCircle::cssText() const
|
| {
|
| - RefPtrWillBeRawPtr<CSSPrimitiveValue> normalizedCX = buildSerializablePositionOffset(m_centerX, CSSValueLeft);
|
| - RefPtrWillBeRawPtr<CSSPrimitiveValue> normalizedCY = buildSerializablePositionOffset(m_centerY, CSSValueTop);
|
| + CSSPrimitiveValue normalizedCX = buildSerializablePositionOffset(m_centerX, CSSValueLeft);
|
| + CSSPrimitiveValue normalizedCY = buildSerializablePositionOffset(m_centerY, CSSValueTop);
|
|
|
| String radius;
|
| - if (m_radius && m_radius->getValueID() != CSSValueClosestSide)
|
| + if (m_radius && toCSSPrimitiveValue(m_radius).getValueID() != CSSValueClosestSide)
|
| radius = m_radius->cssText();
|
|
|
| return buildCircleString(radius,
|
| - serializePositionOffset(*normalizedCX->getPairValue(), *normalizedCY->getPairValue()),
|
| - serializePositionOffset(*normalizedCY->getPairValue(), *normalizedCX->getPairValue()),
|
| + serializePositionOffset(*normalizedCX.getPairValue(), *normalizedCY.getPairValue()),
|
| + serializePositionOffset(*normalizedCY.getPairValue(), *normalizedCX.getPairValue()),
|
| m_referenceBox ? m_referenceBox->cssText() : String());
|
| }
|
|
|
| @@ -130,10 +130,10 @@ bool CSSBasicShapeCircle::equals(const CSSBasicShape& shape) const
|
| return false;
|
|
|
| const CSSBasicShapeCircle& other = toCSSBasicShapeCircle(shape);
|
| - return compareCSSValuePtr(m_centerX, other.m_centerX)
|
| - && compareCSSValuePtr(m_centerY, other.m_centerY)
|
| - && compareCSSValuePtr(m_radius, other.m_radius)
|
| - && compareCSSValuePtr(m_referenceBox, other.m_referenceBox);
|
| + return m_centerX == other.m_centerX
|
| + && m_centerY == other.m_centerY
|
| + && m_radius == other.m_radius
|
| + && m_referenceBox == other.m_referenceBox;
|
| }
|
|
|
| DEFINE_TRACE(CSSBasicShapeCircle)
|
| @@ -181,17 +181,17 @@ static String buildEllipseString(const String& radiusX, const String& radiusY, c
|
|
|
| String CSSBasicShapeEllipse::cssText() const
|
| {
|
| - RefPtrWillBeRawPtr<CSSPrimitiveValue> normalizedCX = buildSerializablePositionOffset(m_centerX, CSSValueLeft);
|
| - RefPtrWillBeRawPtr<CSSPrimitiveValue> normalizedCY = buildSerializablePositionOffset(m_centerY, CSSValueTop);
|
| + CSSPrimitiveValue normalizedCX = buildSerializablePositionOffset(m_centerX, CSSValueLeft);
|
| + CSSPrimitiveValue normalizedCY = buildSerializablePositionOffset(m_centerY, CSSValueTop);
|
|
|
| String radiusX;
|
| String radiusY;
|
| if (m_radiusX) {
|
| - bool shouldSerializeRadiusXValue = m_radiusX->getValueID() != CSSValueClosestSide;
|
| + bool shouldSerializeRadiusXValue = toCSSPrimitiveValue(m_radiusX).getValueID() != CSSValueClosestSide;
|
| bool shouldSerializeRadiusYValue = false;
|
|
|
| if (m_radiusY) {
|
| - shouldSerializeRadiusYValue = m_radiusY->getValueID() != CSSValueClosestSide;
|
| + shouldSerializeRadiusYValue = toCSSPrimitiveValue(m_radiusY).getValueID() != CSSValueClosestSide;
|
| if (shouldSerializeRadiusYValue)
|
| radiusY = m_radiusY->cssText();
|
| }
|
| @@ -200,8 +200,8 @@ String CSSBasicShapeEllipse::cssText() const
|
| }
|
|
|
| return buildEllipseString(radiusX, radiusY,
|
| - serializePositionOffset(*normalizedCX->getPairValue(), *normalizedCY->getPairValue()),
|
| - serializePositionOffset(*normalizedCY->getPairValue(), *normalizedCX->getPairValue()),
|
| + serializePositionOffset(*normalizedCX.getPairValue(), *normalizedCY.getPairValue()),
|
| + serializePositionOffset(*normalizedCY.getPairValue(), *normalizedCX.getPairValue()),
|
| m_referenceBox ? m_referenceBox->cssText() : String());
|
| }
|
|
|
| @@ -211,11 +211,11 @@ bool CSSBasicShapeEllipse::equals(const CSSBasicShape& shape) const
|
| return false;
|
|
|
| const CSSBasicShapeEllipse& other = toCSSBasicShapeEllipse(shape);
|
| - return compareCSSValuePtr(m_centerX, other.m_centerX)
|
| - && compareCSSValuePtr(m_centerY, other.m_centerY)
|
| - && compareCSSValuePtr(m_radiusX, other.m_radiusX)
|
| - && compareCSSValuePtr(m_radiusY, other.m_radiusY)
|
| - && compareCSSValuePtr(m_referenceBox, other.m_referenceBox);
|
| + return m_centerX == other.m_centerX
|
| + && m_centerY == other.m_centerY
|
| + && m_radiusX == other.m_radiusX
|
| + && m_radiusY == other.m_radiusY
|
| + && m_referenceBox == other.m_referenceBox;
|
| }
|
|
|
| DEFINE_TRACE(CSSBasicShapeEllipse)
|
| @@ -278,7 +278,7 @@ String CSSBasicShapePolygon::cssText() const
|
| points.reserveInitialCapacity(m_values.size());
|
|
|
| for (size_t i = 0; i < m_values.size(); ++i)
|
| - points.append(m_values.at(i)->cssText());
|
| + points.append(m_values.at(i).cssText());
|
|
|
| return buildPolygonString(m_windRule, points, m_referenceBox ? m_referenceBox->cssText() : String());
|
| }
|
| @@ -290,10 +290,10 @@ bool CSSBasicShapePolygon::equals(const CSSBasicShape& shape) const
|
|
|
| const CSSBasicShapePolygon& rhs = toCSSBasicShapePolygon(shape);
|
|
|
| - if (!compareCSSValuePtr(m_referenceBox, rhs.m_referenceBox))
|
| + if (m_referenceBox != rhs.m_referenceBox)
|
| return false;
|
|
|
| - return compareCSSValueObjectVector(m_values, rhs.m_values);
|
| + return compareCSSValueVector(m_values, rhs.m_values);
|
| }
|
|
|
| DEFINE_TRACE(CSSBasicShapePolygon)
|
| @@ -378,15 +378,14 @@ static String buildInsetString(const String& top, const String& right, const Str
|
| return result.toString();
|
| }
|
|
|
| -static inline void updateCornerRadiusWidthAndHeight(CSSPrimitiveValue* corner, String& width, String& height)
|
| +static inline void updateCornerRadiusWidthAndHeight(const NullableCSSValue& corner, String& width, String& height)
|
| {
|
| if (!corner)
|
| return;
|
|
|
| - Pair* radius = corner->getPairValue();
|
| - width = radius->first() ? radius->first()->cssText() : String("0");
|
| - if (radius->second())
|
| - height = radius->second()->cssText();
|
| + Pair* radius = toCSSPrimitiveValue(corner).getPairValue();
|
| + width = radius->first().cssText();
|
| + height = radius->second().cssText();
|
| }
|
|
|
| String CSSBasicShapeInset::cssText() const
|
| @@ -425,14 +424,14 @@ bool CSSBasicShapeInset::equals(const CSSBasicShape& shape) const
|
| return false;
|
|
|
| const CSSBasicShapeInset& other = toCSSBasicShapeInset(shape);
|
| - return compareCSSValuePtr(m_top, other.m_top)
|
| - && compareCSSValuePtr(m_right, other.m_right)
|
| - && compareCSSValuePtr(m_bottom, other.m_bottom)
|
| - && compareCSSValuePtr(m_left, other.m_left)
|
| - && compareCSSValuePtr(m_topLeftRadius, other.m_topLeftRadius)
|
| - && compareCSSValuePtr(m_topRightRadius, other.m_topRightRadius)
|
| - && compareCSSValuePtr(m_bottomRightRadius, other.m_bottomRightRadius)
|
| - && compareCSSValuePtr(m_bottomLeftRadius, other.m_bottomLeftRadius);
|
| + return m_top == other.m_top
|
| + && m_right == other.m_right
|
| + && m_bottom == other.m_bottom
|
| + && m_left == other.m_left
|
| + && m_topLeftRadius == other.m_topLeftRadius
|
| + && m_topRightRadius == other.m_topRightRadius
|
| + && m_bottomRightRadius == other.m_bottomRightRadius
|
| + && m_bottomLeftRadius == other.m_bottomLeftRadius;
|
| }
|
|
|
| DEFINE_TRACE(CSSBasicShapeInset)
|
|
|