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: Source/core/css/BasicShapeFunctions.cpp

Issue 1225553002: CSSValue Immediates: Make CSSPrimitiveValue a container (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_1
Patch Set: Rebase Created 5 years, 5 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
« no previous file with comments | « Source/core/animation/animatable/AnimatableUnknownTest.cpp ('k') | Source/core/css/CSSBasicShapes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/BasicShapeFunctions.cpp
diff --git a/Source/core/css/BasicShapeFunctions.cpp b/Source/core/css/BasicShapeFunctions.cpp
index 2880c07d4e1a3fc9955bf43b619524748dce5d38..5eb0551bca491aae11e08e580c8b8fe7ec4a278a 100644
--- a/Source/core/css/BasicShapeFunctions.cpp
+++ b/Source/core/css/BasicShapeFunctions.cpp
@@ -40,7 +40,7 @@
namespace blink {
-static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForCenterCoordinate(CSSValuePool& pool, const ComputedStyle& style, const BasicShapeCenterCoordinate& center, EBoxOrient orientation)
+static CSSPrimitiveValue valueForCenterCoordinate(CSSValuePool& pool, const ComputedStyle& style, const BasicShapeCenterCoordinate& center, EBoxOrient orientation)
{
if (center.direction() == BasicShapeCenterCoordinate::TopLeft)
return pool.createValue(center.length(), style);
@@ -50,7 +50,7 @@ static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForCenterCoordinate(CSSVal
return pool.createValue(Pair::create(pool.createIdentifierValue(keyword), pool.createValue(center.length(), style), Pair::DropIdenticalValues));
}
-static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> basicShapeRadiusToCSSValue(CSSValuePool& pool, const ComputedStyle& style, const BasicShapeRadius& radius)
+static CSSPrimitiveValue basicShapeRadiusToCSSValue(CSSValuePool& pool, const ComputedStyle& style, const BasicShapeRadius& radius)
{
switch (radius.type()) {
case BasicShapeRadius::Value:
@@ -62,7 +62,7 @@ static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> basicShapeRadiusToCSSValue(CSSV
}
ASSERT_NOT_REACHED();
- return nullptr;
+ return pool.createValue(radius.value(), style);
}
CSSValue valueForBasicShape(const ComputedStyle& style, const BasicShape* basicShape)
@@ -129,23 +129,23 @@ CSSValue valueForBasicShape(const ComputedStyle& style, const BasicShape* basicS
return pool.createValue(basicShapeValue.release());
}
-static Length convertToLength(const StyleResolverState& state, CSSPrimitiveValue* value)
+static Length convertToLength(const StyleResolverState& state, NullableCSSValue value)
{
if (!value)
return Length(0, Fixed);
- return value->convertToLength(state.cssToLengthConversionData());
+ return toCSSPrimitiveValue(*value).convertToLength(state.cssToLengthConversionData());
}
-static LengthSize convertToLengthSize(const StyleResolverState& state, CSSPrimitiveValue* value)
+static LengthSize convertToLengthSize(const StyleResolverState& state, NullableCSSValue value)
{
if (!value)
return LengthSize(Length(0, Fixed), Length(0, Fixed));
- Pair* pair = value->getPairValue();
+ Pair* pair = toCSSPrimitiveValue(*value).getPairValue();
return LengthSize(convertToLength(state, pair->first()), convertToLength(state, pair->second()));
}
-static BasicShapeCenterCoordinate convertToCenterCoordinate(const StyleResolverState& state, CSSPrimitiveValue* value)
+static BasicShapeCenterCoordinate convertToCenterCoordinate(const StyleResolverState& state, NullableCSSValue value)
{
BasicShapeCenterCoordinate::Direction direction;
Length offset = Length(0, Fixed);
@@ -153,10 +153,10 @@ static BasicShapeCenterCoordinate convertToCenterCoordinate(const StyleResolverS
CSSValueID keyword = CSSValueTop;
if (!value) {
keyword = CSSValueCenter;
- } else if (value->isValueID()) {
- keyword = value->getValueID();
- } else if (Pair* pair = value->getPairValue()) {
- keyword = pair->first()->getValueID();
+ } else if (toCSSPrimitiveValue(*value).isValueID()) {
+ keyword = toCSSPrimitiveValue(*value).getValueID();
+ } else if (Pair* pair = toCSSPrimitiveValue(*value).getPairValue()) {
+ keyword = toCSSPrimitiveValue(*pair->first()).getValueID();
offset = convertToLength(state, pair->second());
} else {
offset = convertToLength(state, value);
@@ -184,13 +184,13 @@ static BasicShapeCenterCoordinate convertToCenterCoordinate(const StyleResolverS
return BasicShapeCenterCoordinate(direction, offset);
}
-static BasicShapeRadius cssValueToBasicShapeRadius(const StyleResolverState& state, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radius)
+static BasicShapeRadius cssValueToBasicShapeRadius(const StyleResolverState& state, NullableCSSValue radius)
{
if (!radius)
return BasicShapeRadius(BasicShapeRadius::ClosestSide);
- if (radius->isValueID()) {
- switch (radius->getValueID()) {
+ if (toCSSPrimitiveValue(*radius).isValueID()) {
+ switch (toCSSPrimitiveValue(*radius).getValueID()) {
case CSSValueClosestSide:
return BasicShapeRadius(BasicShapeRadius::ClosestSide);
case CSSValueFarthestSide:
@@ -201,7 +201,7 @@ static BasicShapeRadius cssValueToBasicShapeRadius(const StyleResolverState& sta
}
}
- return BasicShapeRadius(convertToLength(state, radius.get()));
+ return BasicShapeRadius(convertToLength(state, radius));
}
PassRefPtr<BasicShape> basicShapeForValue(const StyleResolverState& state, const CSSBasicShape* basicShapeValue)
@@ -237,7 +237,7 @@ PassRefPtr<BasicShape> basicShapeForValue(const StyleResolverState& state, const
RefPtr<BasicShapePolygon> polygon = BasicShapePolygon::create();
polygon->setWindRule(polygonValue->windRule());
- const WillBeHeapVector<RefPtrWillBeMember<CSSPrimitiveValue>>& values = polygonValue->values();
+ const WillBeHeapVector<CSSValue>& values = polygonValue->values();
for (unsigned i = 0; i < values.size(); i += 2)
polygon->appendPoint(convertToLength(state, values.at(i).get()), convertToLength(state, values.at(i + 1).get()));
« no previous file with comments | « Source/core/animation/animatable/AnimatableUnknownTest.cpp ('k') | Source/core/css/CSSBasicShapes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698