Index: Source/core/css/ComputedStyleCSSValueMapping.cpp |
diff --git a/Source/core/css/ComputedStyleCSSValueMapping.cpp b/Source/core/css/ComputedStyleCSSValueMapping.cpp |
index 686ee759e82e4eea12caf81dd07f250fbdf60b41..227178b291f37d7701ee9dd1ee630f9ae016b46c 100644 |
--- a/Source/core/css/ComputedStyleCSSValueMapping.cpp |
+++ b/Source/core/css/ComputedStyleCSSValueMapping.cpp |
@@ -62,24 +62,24 @@ inline static bool isFlexOrGrid(Node* element) |
&& element->ensureComputedStyle()->isDisplayFlexibleOrGridBox(); |
} |
-inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(double value, const ComputedStyle& style) |
+inline static CSSPrimitiveValue zoomAdjustedPixelValue(double value, const ComputedStyle& style) |
{ |
return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style), CSSPrimitiveValue::CSS_PX); |
} |
-inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(double value, const ComputedStyle& style) |
+inline static CSSPrimitiveValue zoomAdjustedNumberValue(double value, const ComputedStyle& style) |
{ |
return cssValuePool().createValue(value / style.effectiveZoom(), CSSPrimitiveValue::CSS_NUMBER); |
} |
-static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValueForLength(const Length& length, const ComputedStyle& style) |
+static CSSPrimitiveValue zoomAdjustedPixelValueForLength(const Length& length, const ComputedStyle& style) |
{ |
if (length.isFixed()) |
return zoomAdjustedPixelValue(length.value(), style); |
return cssValuePool().createValue(length, style); |
} |
-static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> pixelValueForUnzoomedLength(const UnzoomedLength& unzoomedLength, const ComputedStyle& style) |
+static CSSPrimitiveValue pixelValueForUnzoomedLength(const UnzoomedLength& unzoomedLength, const ComputedStyle& style) |
{ |
const Length& length = unzoomedLength.length(); |
if (length.isFixed()) |
@@ -103,7 +103,7 @@ static PassRefPtrWillBeRawPtr<CSSValueList> createPositionListForLayer(CSSProper |
return positionList.release(); |
} |
-PassRefPtrWillBeRawPtr<CSSPrimitiveValue> ComputedStyleCSSValueMapping::currentColorOrValidColor(const ComputedStyle& style, const StyleColor& color) |
+CSSPrimitiveValue ComputedStyleCSSValueMapping::currentColorOrValidColor(const ComputedStyle& style, const StyleColor& color) |
{ |
// This function does NOT look at visited information, so that computed style doesn't expose that. |
return cssValuePool().createColorValue(color.resolve(style.color()).rgb()); |
@@ -195,10 +195,10 @@ static CSSValue valueForPositionOffset(const ComputedStyle& style, CSSPropertyID |
static PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> valueForNinePieceImageSlice(const NinePieceImage& image) |
{ |
// Create the slices. |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr; |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr; |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr; |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr; |
+ NullableCSSValue top; |
+ NullableCSSValue right; |
+ NullableCSSValue bottom; |
+ NullableCSSValue left; |
// TODO(alancutter): Make this code aware of calc lengths. |
if (image.imageSlices().top().hasPercent()) |
@@ -238,21 +238,21 @@ static PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> valueForNinePieceImageSl |
} |
RefPtrWillBeRawPtr<Quad> quad = Quad::create(); |
- quad->setTop(top); |
- quad->setRight(right); |
- quad->setBottom(bottom); |
- quad->setLeft(left); |
+ quad->setTop(toCSSPrimitiveValue(*top)); |
+ quad->setRight(toCSSPrimitiveValue(*right)); |
+ quad->setBottom(toCSSPrimitiveValue(*bottom)); |
+ quad->setLeft(toCSSPrimitiveValue(*left)); |
return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.release()), image.fill()); |
} |
-static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForNinePieceImageQuad(const BorderImageLengthBox& box, const ComputedStyle& style) |
+static CSSPrimitiveValue valueForNinePieceImageQuad(const BorderImageLengthBox& box, const ComputedStyle& style) |
{ |
// Create the slices. |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr; |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr; |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr; |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr; |
+ NullableCSSValue top; |
+ NullableCSSValue right; |
+ NullableCSSValue bottom; |
+ NullableCSSValue left; |
if (box.top().isNumber()) |
top = cssValuePool().createValue(box.top().number(), CSSPrimitiveValue::CSS_NUMBER); |
@@ -290,10 +290,10 @@ static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForNinePieceImageQuad(cons |
} |
RefPtrWillBeRawPtr<Quad> quad = Quad::create(); |
- quad->setTop(top); |
- quad->setRight(right); |
- quad->setBottom(bottom); |
- quad->setLeft(left); |
+ quad->setTop(toCSSPrimitiveValue(*top)); |
+ quad->setRight(toCSSPrimitiveValue(*right)); |
+ quad->setBottom(toCSSPrimitiveValue(*bottom)); |
+ quad->setLeft(toCSSPrimitiveValue(*left)); |
return cssValuePool().createValue(quad.release()); |
} |
@@ -314,15 +314,15 @@ static CSSValueID valueForRepeatRule(int rule) |
static CSSValue valueForNinePieceImageRepeat(const NinePieceImage& image) |
{ |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalRepeat = nullptr; |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalRepeat = nullptr; |
+ NullableCSSValue horizontalRepeat; |
+ NullableCSSValue verticalRepeat; |
horizontalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(image.horizontalRule())); |
if (image.horizontalRule() == image.verticalRule()) |
verticalRepeat = horizontalRepeat; |
else |
verticalRepeat = cssValuePool().createIdentifierValue(valueForRepeatRule(image.verticalRule())); |
- return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), verticalRepeat.release(), Pair::DropIdenticalValues)); |
+ return cssValuePool().createValue(Pair::create(toCSSPrimitiveValue(*horizontalRepeat), toCSSPrimitiveValue(*verticalRepeat), Pair::DropIdenticalValues)); |
} |
static CSSValue valueForNinePieceImage(const NinePieceImage& image, const ComputedStyle& style) |
@@ -355,14 +355,14 @@ static CSSValue valueForReflection(const StyleReflection* reflection, const Comp |
if (!reflection) |
return cssValuePool().createIdentifierValue(CSSValueNone); |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> offset = nullptr; |
+ NullableCSSValue offset; |
// TODO(alancutter): Make this work correctly for calc lengths. |
if (reflection->offset().hasPercent()) |
offset = cssValuePool().createValue(reflection->offset().percent(), CSSPrimitiveValue::CSS_PERCENTAGE); |
else |
offset = zoomAdjustedPixelValue(reflection->offset().value(), style); |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> direction = nullptr; |
+ NullableCSSValue direction; |
switch (reflection->direction()) { |
case ReflectionBelow: |
direction = cssValuePool().createIdentifierValue(CSSValueBelow); |
@@ -378,7 +378,7 @@ static CSSValue valueForReflection(const StyleReflection* reflection, const Comp |
break; |
} |
- return CSSReflectValue::create(direction.release(), offset.release(), valueForNinePieceImage(reflection->mask(), style)); |
+ return CSSReflectValue::create(toCSSPrimitiveValue(*direction), toCSSPrimitiveValue(*offset), valueForNinePieceImage(reflection->mask(), style)); |
} |
static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element) |
@@ -432,7 +432,7 @@ static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBackgroundShorthand(const C |
NullableCSSValue value = ComputedStyleCSSValueMapping::get(CSSPropertyBackgroundColor, style, layoutObject, styledNode, allowVisitedStyle); |
beforeSlash->append(*value); |
} |
- beforeSlash->append(currLayer->image() ? *currLayer->image()->cssValue() : cssValuePool().createIdentifierValue(CSSValueNone)); |
+ beforeSlash->append(currLayer->image() ? *currLayer->image()->cssValue() : CSSValue(cssValuePool().createIdentifierValue(CSSValueNone))); |
beforeSlash->append(valueForFillRepeat(currLayer->repeatX(), currLayer->repeatY())); |
beforeSlash->append(cssValuePool().createValue(currLayer->attachment())); |
beforeSlash->append(createPositionListForLayer(CSSPropertyBackgroundPosition, *currLayer, style)); |
@@ -472,7 +472,7 @@ static PassRefPtrWillBeRawPtr<CSSValueList> valueForContentPositionAndDistributi |
return result.release(); |
} |
-static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForLineHeight(const ComputedStyle& style) |
+static CSSPrimitiveValue valueForLineHeight(const ComputedStyle& style) |
{ |
Length length = style.lineHeight(); |
if (length.isNegative()) |
@@ -498,7 +498,7 @@ static CSSValueID identifierForFamily(const AtomicString& family) |
return CSSValueInvalid; |
} |
-static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFamily(const AtomicString& family) |
+static CSSPrimitiveValue valueForFamily(const AtomicString& family) |
{ |
if (CSSValueID familyIdentifier = identifierForFamily(family)) |
return cssValuePool().createIdentifierValue(familyIdentifier); |
@@ -514,27 +514,27 @@ static PassRefPtrWillBeRawPtr<CSSValueList> valueForFontFamily(const ComputedSty |
return list.release(); |
} |
-static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontSize(const ComputedStyle& style) |
+static CSSPrimitiveValue valueForFontSize(const ComputedStyle& style) |
{ |
return zoomAdjustedPixelValue(style.fontDescription().computedSize(), style); |
} |
-static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStretch(const ComputedStyle& style) |
+static CSSPrimitiveValue valueForFontStretch(const ComputedStyle& style) |
{ |
return cssValuePool().createValue(style.fontDescription().stretch()); |
} |
-static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontStyle(const ComputedStyle& style) |
+static CSSPrimitiveValue valueForFontStyle(const ComputedStyle& style) |
{ |
return cssValuePool().createValue(style.fontDescription().style()); |
} |
-static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontVariant(const ComputedStyle& style) |
+static CSSPrimitiveValue valueForFontVariant(const ComputedStyle& style) |
{ |
return cssValuePool().createValue(style.fontDescription().variant()); |
} |
-static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontWeight(const ComputedStyle& style) |
+static CSSPrimitiveValue valueForFontWeight(const ComputedStyle& style) |
{ |
return cssValuePool().createValue(style.fontDescription().weight()); |
} |
@@ -1015,13 +1015,13 @@ static CSSValue valueForContentData(const ComputedStyle& style) |
if (contentData->isCounter()) { |
const CounterContent* counter = toCounterContentData(contentData)->counter(); |
ASSERT(counter); |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = cssValuePool().createValue(counter->identifier(), CSSPrimitiveValue::CSS_CUSTOM_IDENT); |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> separator = cssValuePool().createValue(counter->separator(), CSSPrimitiveValue::CSS_CUSTOM_IDENT); |
+ CSSPrimitiveValue identifier = cssValuePool().createValue(counter->identifier(), CSSPrimitiveValue::CSS_CUSTOM_IDENT); |
+ CSSPrimitiveValue separator = cssValuePool().createValue(counter->separator(), CSSPrimitiveValue::CSS_CUSTOM_IDENT); |
CSSValueID listStyleIdent = CSSValueNone; |
if (counter->listStyle() != NoneListStyle) |
listStyleIdent = static_cast<CSSValueID>(CSSValueDisc + counter->listStyle()); |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = cssValuePool().createIdentifierValue(listStyleIdent); |
- list->append(cssValuePool().createValue(Counter::create(identifier.release(), listStyle.release(), separator.release()))); |
+ CSSPrimitiveValue listStyle = cssValuePool().createIdentifierValue(listStyleIdent); |
+ list->append(cssValuePool().createValue(Counter::create(identifier, listStyle, separator))); |
} else if (contentData->isImage()) { |
const StyleImage* image = toImageContentData(contentData)->image(); |
ASSERT(image); |
@@ -1153,7 +1153,7 @@ static PassRefPtrWillBeRawPtr<CSSValueList> valueForBorderRadiusShorthand(const |
return list.release(); |
} |
-static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> glyphOrientationToCSSPrimitiveValue(EGlyphOrientation orientation) |
+static NullableCSSValue glyphOrientationToCSSPrimitiveValue(EGlyphOrientation orientation) |
{ |
switch (orientation) { |
case GO_0DEG: |
@@ -1230,13 +1230,13 @@ static inline String serializeAsFragmentIdentifier(const AtomicString& resource) |
CSSValue ComputedStyleCSSValueMapping::valueForShadowData(const ShadowData& shadow, const ComputedStyle& style, bool useSpread) |
{ |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(shadow.x(), style); |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> y = zoomAdjustedPixelValue(shadow.y(), style); |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = zoomAdjustedPixelValue(shadow.blur(), style); |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = useSpread ? zoomAdjustedPixelValue(shadow.spread(), style) : PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullptr); |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> shadowStyle = shadow.style() == Normal ? PassRefPtrWillBeRawPtr<CSSPrimitiveValue>(nullptr) : cssValuePool().createIdentifierValue(CSSValueInset); |
- RefPtrWillBeRawPtr<CSSPrimitiveValue> color = currentColorOrValidColor(style, shadow.color()); |
- return CSSShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), shadowStyle.release(), color.release()); |
+ CSSPrimitiveValue x = zoomAdjustedPixelValue(shadow.x(), style); |
+ CSSPrimitiveValue y = zoomAdjustedPixelValue(shadow.y(), style); |
+ CSSPrimitiveValue blur = zoomAdjustedPixelValue(shadow.blur(), style); |
+ NullableCSSValue spread = useSpread ? NullableCSSValue(zoomAdjustedPixelValue(shadow.spread(), style)) : nullptr; |
+ NullableCSSValue shadowStyle = shadow.style() == Normal ? nullptr : NullableCSSValue(cssValuePool().createIdentifierValue(CSSValueInset)); |
+ CSSPrimitiveValue color = currentColorOrValidColor(style, shadow.color()); |
+ return CSSShadowValue::create(x, y, blur, spread, shadowStyle, color); |
} |
CSSValue ComputedStyleCSSValueMapping::valueForShadowList(const ShadowList* shadowList, const ComputedStyle& style, bool useSpread) |
@@ -2608,8 +2608,8 @@ NullableCSSValue ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, con |
case CSSPropertyGlyphOrientationHorizontal: |
return glyphOrientationToCSSPrimitiveValue(svgStyle.glyphOrientationHorizontal()); |
case CSSPropertyGlyphOrientationVertical: { |
- if (RefPtrWillBeRawPtr<CSSPrimitiveValue> value = glyphOrientationToCSSPrimitiveValue(svgStyle.glyphOrientationVertical())) |
- return value.release(); |
+ if (NullableCSSValue value = glyphOrientationToCSSPrimitiveValue(svgStyle.glyphOrientationVertical())) |
+ return value; |
if (svgStyle.glyphOrientationVertical() == GO_AUTO) |
return CSSPrimitiveValue::createIdentifier(CSSValueAuto); |
return nullptr; |