namespace WebCore {
-static PassRefPtr<CSSPrimitiveValue> valueForCenterCoordinate(CSSValuePool& pool, const RenderStyle& style, const BasicShapeCenterCoordinate& center)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForCenterCoordinate(CSSValuePool& pool, const RenderStyle& style, const BasicShapeCenterCoordinate& center)
{
CSSValueID keyword = CSSValueInvalid;
switch (center.keyword()) {
return pool.createValue(Pair::create(pool.createIdentifierValue(keyword), pool.createValue(center.length(), style), Pair::DropIdenticalValues));
}
-static PassRefPtr<CSSPrimitiveValue> basicShapeRadiusToCSSValue(CSSValuePool& pool, const RenderStyle& style, const BasicShapeRadius& radius)
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> basicShapeRadiusToCSSValue(CSSValuePool& pool, const RenderStyle& style, const BasicShapeRadius& radius)
{
switch (radius.type()) {
case BasicShapeRadius::Value:
basicShapeValue = rectangleValue.release();
break;
}
+ case BasicShape::BasicShapeInsetType: {
+ const BasicShapeInset* inset = static_cast<const BasicShapeInset*>(basicShape);
+ RefPtr<CSSBasicShapeInset> insetValue = CSSBasicShapeInset::create();
+
+ insetValue->setTop(CSSPrimitiveValue::create(inset->top()));
+ insetValue->setRight(CSSPrimitiveValue::create(inset->right()));
+ insetValue->setBottom(CSSPrimitiveValue::create(inset->bottom()));
+ insetValue->setLeft(CSSPrimitiveValue::create(inset->left()));
+
+ insetValue->setTopLeftRadius(CSSPrimitiveValue::create(inset->topLeftRadius()));
+ insetValue->setTopRightRadius(CSSPrimitiveValue::create(inset->topRightRadius()));
+ insetValue->setBottomRightRadius(CSSPrimitiveValue::create(inset->bottomRightRadius()));
+ insetValue->setBottomLeftRadius(CSSPrimitiveValue::create(inset->bottomLeftRadius()));
+
+ basicShapeValue = insetValue.release();
+ break;
+ }
default:
break;
}
static Length convertToLength(const StyleResolverState& state, CSSPrimitiveValue* value)
{
+ if (!value)
+ return Length(0, Fixed);
return value->convertToLength<FixedConversion | PercentConversion>(state.cssToLengthConversionData());
}
+static LengthSize convertToLengthSize(const StyleResolverState& state, CSSPrimitiveValue* value)
+{
+ if (!value)
+ return LengthSize(Length(0, Fixed), Length(0, Fixed));
+
+ Pair* pair = value->getPairValue();
+ return LengthSize(convertToLength(state, pair->first()), convertToLength(state, pair->second()));
+}
+
static BasicShapeCenterCoordinate convertToCenterCoordinate(const StyleResolverState& state, CSSPrimitiveValue* value)
{
if (Pair* pair = value->getPairValue()) {
return BasicShapeCenterCoordinate(convertToLength(state, value));
}
-static BasicShapeRadius cssValueToBasicShapeRadius(const StyleResolverState& state, PassRefPtr<CSSPrimitiveValue> radius)
+static BasicShapeRadius cssValueToBasicShapeRadius(const StyleResolverState& state, PassRefPtrWillBeRawPtr<CSSPrimitiveValue> radius)
{
if (!radius)
return BasicShapeRadius(BasicShapeRadius::ClosestSide);
basicShape = rect.release();
break;
}
+ case CSSBasicShape::CSSBasicShapeInsetType: {
+ const CSSBasicShapeInset* rectValue = static_cast<const CSSBasicShapeInset* >(basicShapeValue);
+ RefPtr<BasicShapeInset> rect = BasicShapeInset::create();
+
+ rect->setTop(convertToLength(state, rectValue->top()));
+ rect->setRight(convertToLength(state, rectValue->right()));
+ rect->setBottom(convertToLength(state, rectValue->bottom()));
+ rect->setLeft(convertToLength(state, rectValue->left()));
+
+ rect->setTopLeftRadius(convertToLengthSize(state, rectValue->topLeftRadius()));
+ rect->setTopRightRadius(convertToLengthSize(state, rectValue->topRightRadius()));
+ rect->setBottomRightRadius(convertToLengthSize(state, rectValue->bottomRightRadius()));
+ rect->setBottomLeftRadius(convertToLengthSize(state, rectValue->bottomLeftRadius()));
+
+ basicShape = rect.release();
+ break;
+ }
default:
break;
}