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

Unified Diff: third_party/WebKit/Source/core/css/BasicShapeFunctions.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/BasicShapeFunctions.cpp
diff --git a/third_party/WebKit/Source/core/css/BasicShapeFunctions.cpp b/third_party/WebKit/Source/core/css/BasicShapeFunctions.cpp
index a1c7989088026f29210d1cadb9987342a244dd6a..a8f87afb55c6339415f79cb34c73c71bd1a9c869 100644
--- a/third_party/WebKit/Source/core/css/BasicShapeFunctions.cpp
+++ b/third_party/WebKit/Source/core/css/BasicShapeFunctions.cpp
@@ -30,6 +30,7 @@
#include "core/css/BasicShapeFunctions.h"
#include "core/css/CSSBasicShapeValues.h"
+#include "core/css/CSSIdentifierValue.h"
#include "core/css/CSSPrimitiveValueMappings.h"
#include "core/css/CSSValuePair.h"
#include "core/css/resolver/StyleResolverState.h"
@@ -41,33 +42,33 @@ namespace blink {
static CSSValue* valueForCenterCoordinate(const ComputedStyle& style, const BasicShapeCenterCoordinate& center, EBoxOrient orientation)
{
if (center.getDirection() == BasicShapeCenterCoordinate::TopLeft)
- return CSSPrimitiveValue::create(center.length(), style.effectiveZoom());
+ return CSSValue::create(center.length(), style.effectiveZoom());
CSSValueID keyword = orientation == HORIZONTAL ? CSSValueRight : CSSValueBottom;
return CSSValuePair::create(
- CSSPrimitiveValue::createIdentifier(keyword),
- CSSPrimitiveValue::create(center.length(), style.effectiveZoom()),
+ CSSIdentifierValue::create(keyword),
+ CSSValue::create(center.length(), style.effectiveZoom()),
CSSValuePair::DropIdenticalValues);
}
static CSSValuePair* valueForLengthSize(const LengthSize& lengthSize, const ComputedStyle& style)
{
return CSSValuePair::create(
- CSSPrimitiveValue::create(lengthSize.width(), style.effectiveZoom()),
- CSSPrimitiveValue::create(lengthSize.height(), style.effectiveZoom()),
+ CSSValue::create(lengthSize.width(), style.effectiveZoom()),
+ CSSValue::create(lengthSize.height(), style.effectiveZoom()),
CSSValuePair::KeepIdenticalValues);
}
-static CSSPrimitiveValue* basicShapeRadiusToCSSValue(const ComputedStyle& style, const BasicShapeRadius& radius)
+static CSSValue* basicShapeRadiusToCSSValue(const ComputedStyle& style, const BasicShapeRadius& radius)
{
switch (radius.type()) {
case BasicShapeRadius::Value:
- return CSSPrimitiveValue::create(radius.value(), style.effectiveZoom());
+ return CSSValue::create(radius.value(), style.effectiveZoom());
case BasicShapeRadius::ClosestSide:
- return CSSPrimitiveValue::createIdentifier(CSSValueClosestSide);
+ return CSSIdentifierValue::create(CSSValueClosestSide);
case BasicShapeRadius::FarthestSide:
- return CSSPrimitiveValue::createIdentifier(CSSValueFarthestSide);
+ return CSSIdentifierValue::create(CSSValueFarthestSide);
}
ASSERT_NOT_REACHED();
@@ -153,10 +154,10 @@ static BasicShapeCenterCoordinate convertToCenterCoordinate(const StyleResolverS
CSSValueID keyword = CSSValueTop;
if (!value) {
keyword = CSSValueCenter;
- } else if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->isValueID()) {
- keyword = toCSSPrimitiveValue(value)->getValueID();
+ } else if (value->isIdentifierValue()) {
+ keyword = toCSSIdentifierValue(value)->getValueID();
} else if (value->isValuePair()) {
- keyword = toCSSPrimitiveValue(toCSSValuePair(value)->first()).getValueID();
+ keyword = toCSSIdentifierValue(toCSSValuePair(value)->first()).getValueID();
offset = convertToLength(state, &toCSSPrimitiveValue(toCSSValuePair(value)->second()));
} else {
offset = convertToLength(state, toCSSPrimitiveValue(value));
@@ -184,13 +185,13 @@ static BasicShapeCenterCoordinate convertToCenterCoordinate(const StyleResolverS
return BasicShapeCenterCoordinate(direction, offset);
}
-static BasicShapeRadius cssValueToBasicShapeRadius(const StyleResolverState& state, const CSSPrimitiveValue* radius)
+static BasicShapeRadius cssValueToBasicShapeRadius(const StyleResolverState& state, const CSSValue* radius)
{
if (!radius)
return BasicShapeRadius(BasicShapeRadius::ClosestSide);
- if (radius->isValueID()) {
- switch (radius->getValueID()) {
+ if (radius->isIdentifierValue()) {
+ switch (toCSSIdentifierValue(radius)->getValueID()) {
case CSSValueClosestSide:
return BasicShapeRadius(BasicShapeRadius::ClosestSide);
case CSSValueFarthestSide:
@@ -201,7 +202,7 @@ static BasicShapeRadius cssValueToBasicShapeRadius(const StyleResolverState& sta
}
}
- return BasicShapeRadius(convertToLength(state, radius));
+ return BasicShapeRadius(convertToLength(state, toCSSPrimitiveValue(radius)));
}
PassRefPtr<BasicShape> basicShapeForValue(const StyleResolverState& state, const CSSValue& basicShapeValue)
« no previous file with comments | « third_party/WebKit/Source/core/css/BUILD.gn ('k') | third_party/WebKit/Source/core/css/CSSBasicShapeValues.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698