Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Unified Diff: third_party/WebKit/Source/core/css/CSSBasicShapeValues.cpp

Issue 2346193002: Split CSSPrimitiveValue into CSSPrimitiveValue and CSSIdentifierValue (Closed)
Patch Set: Rebase please work Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/CSSBasicShapeValues.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSBasicShapeValues.cpp b/third_party/WebKit/Source/core/css/CSSBasicShapeValues.cpp
index b361d43e3db6ad761c5e9090bec5e5f304a58a33..32982626e14c46fa3a0883dc2e4b91580bc2b45c 100644
--- a/third_party/WebKit/Source/core/css/CSSBasicShapeValues.cpp
+++ b/third_party/WebKit/Source/core/css/CSSBasicShapeValues.cpp
@@ -29,6 +29,7 @@
#include "core/css/CSSBasicShapeValues.h"
+#include "core/css/CSSIdentifierValue.h"
#include "core/css/CSSPrimitiveValue.h"
#include "core/css/CSSValuePair.h"
#include "platform/Length.h"
@@ -62,8 +63,8 @@ static String buildCircleString(const String& radius, const String& centerX, con
static String serializePositionOffset(const CSSValuePair& offset, const CSSValuePair& other)
{
- if ((toCSSPrimitiveValue(offset.first()).getValueID() == CSSValueLeft && toCSSPrimitiveValue(other.first()).getValueID() == CSSValueTop)
- || (toCSSPrimitiveValue(offset.first()).getValueID() == CSSValueTop && toCSSPrimitiveValue(other.first()).getValueID() == CSSValueLeft))
+ if ((toCSSIdentifierValue(offset.first()).getValueID() == CSSValueLeft && toCSSIdentifierValue(other.first()).getValueID() == CSSValueTop)
+ || (toCSSIdentifierValue(offset.first()).getValueID() == CSSValueTop && toCSSIdentifierValue(other.first()).getValueID() == CSSValueLeft))
return offset.second().cssText();
return offset.cssText();
}
@@ -75,10 +76,10 @@ static CSSValuePair* buildSerializablePositionOffset(CSSValue* offset, CSSValueI
if (!offset) {
side = CSSValueCenter;
- } else if (offset->isPrimitiveValue() && toCSSPrimitiveValue(offset)->isValueID()) {
- side = toCSSPrimitiveValue(offset)->getValueID();
+ } else if (offset->isIdentifierValue()) {
+ side = toCSSIdentifierValue(offset)->getValueID();
} else if (offset->isValuePair()) {
- side = toCSSPrimitiveValue(toCSSValuePair(*offset).first()).getValueID();
+ side = toCSSIdentifierValue(toCSSValuePair(*offset).first()).getValueID();
amount = &toCSSPrimitiveValue(toCSSValuePair(*offset).second());
if ((side == CSSValueRight || side == CSSValueBottom) && amount->isPercentage()) {
side = defaultSide;
@@ -99,7 +100,7 @@ static CSSValuePair* buildSerializablePositionOffset(CSSValue* offset, CSSValueI
side = defaultSide;
}
- return CSSValuePair::create(CSSPrimitiveValue::createIdentifier(side), amount, CSSValuePair::KeepIdenticalValues);
+ return CSSValuePair::create(CSSIdentifierValue::create(side), amount, CSSValuePair::KeepIdenticalValues);
}
String CSSBasicShapeCircleValue::customCSSText() const
@@ -108,7 +109,7 @@ String CSSBasicShapeCircleValue::customCSSText() const
CSSValuePair* normalizedCY = buildSerializablePositionOffset(m_centerY, CSSValueTop);
String radius;
- if (m_radius && m_radius->getValueID() != CSSValueClosestSide)
+ if (m_radius && !(m_radius->isIdentifierValue() && toCSSIdentifierValue(*m_radius).getValueID() == CSSValueClosestSide))
radius = m_radius->cssText();
return buildCircleString(radius,
@@ -170,11 +171,11 @@ String CSSBasicShapeEllipseValue::customCSSText() const
String radiusX;
String radiusY;
if (m_radiusX) {
- bool shouldSerializeRadiusXValue = m_radiusX->getValueID() != CSSValueClosestSide;
+ bool shouldSerializeRadiusXValue = !(m_radiusX->isIdentifierValue() && toCSSIdentifierValue(*m_radiusX).getValueID() == CSSValueClosestSide);
bool shouldSerializeRadiusYValue = false;
if (m_radiusY) {
- shouldSerializeRadiusYValue = m_radiusY->getValueID() != CSSValueClosestSide;
+ shouldSerializeRadiusYValue = !(m_radiusY->isIdentifierValue() && toCSSIdentifierValue(*m_radiusY).getValueID() == CSSValueClosestSide);
if (shouldSerializeRadiusYValue)
radiusY = m_radiusY->cssText();
}

Powered by Google App Engine
This is Rietveld 408576698