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

Unified Diff: Source/core/css/ComputedStyleCSSValueMapping.cpp

Issue 1164573002: CSSValue Immediates: Change CSSValue to an object instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase and oilpan feedback Created 5 years, 6 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: Source/core/css/ComputedStyleCSSValueMapping.cpp
diff --git a/Source/core/css/ComputedStyleCSSValueMapping.cpp b/Source/core/css/ComputedStyleCSSValueMapping.cpp
index 6e7bf2485fdd8e6e13ef455c9247cfe963628249..2ac64f2d3f48d421a42ddbddd210a2e0b9fb1159 100644
--- a/Source/core/css/ComputedStyleCSSValueMapping.cpp
+++ b/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -108,7 +108,7 @@ PassRefPtrWillBeRawPtr<CSSPrimitiveValue> ComputedStyleCSSValueMapping::currentC
return cssValuePool().createColorValue(color.resolve(style.color()).rgb());
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSize(const FillSize& fillSize, const ComputedStyle& style)
+static CSSValue valueForFillSize(const FillSize& fillSize, const ComputedStyle& style)
{
if (fillSize.type == Contain)
return cssValuePool().createIdentifierValue(CSSValueContain);
@@ -125,7 +125,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSize(const FillSize& fillSiz
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForFillRepeat(EFillRepeat xRepeat, EFillRepeat yRepeat)
+static CSSValue valueForFillRepeat(EFillRepeat xRepeat, EFillRepeat yRepeat)
{
// For backwards compatibility, if both values are equal, just return one of them. And
// if the two values are equivalent to repeat-x or repeat-y, just return the shorthand.
@@ -142,7 +142,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForFillRepeat(EFillRepeat xRepeat,
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSourceType(EMaskSourceType type)
+static CSSValue valueForFillSourceType(EMaskSourceType type)
{
switch (type) {
case MaskAlpha:
@@ -152,11 +152,10 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForFillSourceType(EMaskSourceType t
}
ASSERT_NOT_REACHED();
-
- return nullptr;
+ return cssValuePool().createValue(CSSValueAlpha);
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForPositionOffset(const ComputedStyle& style, CSSPropertyID propertyID, const LayoutObject* layoutObject)
+static CSSValue valueForPositionOffset(const ComputedStyle& style, CSSPropertyID propertyID, const LayoutObject* layoutObject)
{
Length offset;
switch (propertyID) {
@@ -173,7 +172,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForPositionOffset(const ComputedSty
offset = style.bottom();
break;
default:
- return nullptr;
+ return cssValuePool().createIdentifierValue(CSSValueAuto);
}
if (offset.hasPercent() && layoutObject && layoutObject->isBox() && layoutObject->isPositioned()) {
@@ -312,7 +311,7 @@ static CSSValueID valueForRepeatRule(int rule)
}
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImageRepeat(const NinePieceImage& image)
+static CSSValue valueForNinePieceImageRepeat(const NinePieceImage& image)
{
RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalRepeat = nullptr;
RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalRepeat = nullptr;
@@ -325,13 +324,13 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImageRepeat(const NineP
return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), verticalRepeat.release(), Pair::DropIdenticalValues));
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image, const ComputedStyle& style)
+static CSSValue valueForNinePieceImage(const NinePieceImage& image, const ComputedStyle& style)
{
if (!image.hasImage())
return cssValuePool().createIdentifierValue(CSSValueNone);
// Image first.
- RefPtrWillBeRawPtr<CSSValue> imageValue = nullptr;
+ NullableCSSValue imageValue;
if (image.image())
imageValue = image.image()->cssValue();
@@ -339,18 +338,18 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForNinePieceImage(const NinePieceIm
RefPtrWillBeRawPtr<CSSBorderImageSliceValue> imageSlices = valueForNinePieceImageSlice(image);
// Create the border area slices.
- RefPtrWillBeRawPtr<CSSValue> borderSlices = valueForNinePieceImageQuad(image.borderSlices(), style);
+ CSSValue borderSlices = valueForNinePieceImageQuad(image.borderSlices(), style);
// Create the border outset.
- RefPtrWillBeRawPtr<CSSValue> outset = valueForNinePieceImageQuad(image.outset(), style);
+ CSSValue outset = valueForNinePieceImageQuad(image.outset(), style);
// Create the repeat rules.
- RefPtrWillBeRawPtr<CSSValue> repeat = valueForNinePieceImageRepeat(image);
+ CSSValue repeat = valueForNinePieceImageRepeat(image);
- return createBorderImageValue(imageValue.release(), imageSlices.release(), borderSlices.release(), outset.release(), repeat.release());
+ return createBorderImageValue(imageValue, imageSlices, borderSlices, outset, repeat);
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForReflection(const StyleReflection* reflection, const ComputedStyle& style)
+static CSSValue valueForReflection(const StyleReflection* reflection, const ComputedStyle& style)
{
if (!reflection)
return cssValuePool().createIdentifierValue(CSSValueNone);
@@ -405,9 +404,8 @@ static PassRefPtrWillBeRawPtr<CSSValueList> valuesForGridShorthand(const StylePr
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
for (size_t i = 0; i < shorthand.length(); ++i) {
- RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(shorthand.properties()[i], style, layoutObject, styledNode, allowVisitedStyle);
- ASSERT(value);
- list->append(value.release());
+ NullableCSSValue value = ComputedStyleCSSValueMapping::get(shorthand.properties()[i], style, layoutObject, styledNode, allowVisitedStyle);
+ list->append(*value);
}
return list.release();
}
@@ -416,9 +414,8 @@ static PassRefPtrWillBeRawPtr<CSSValueList> valuesForShorthandProperty(const Sty
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
for (size_t i = 0; i < shorthand.length(); ++i) {
- RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(shorthand.properties()[i], style, layoutObject, styledNode, allowVisitedStyle);
- ASSERT(value);
- list->append(value);
+ NullableCSSValue value = ComputedStyleCSSValueMapping::get(shorthand.properties()[i], style, layoutObject, styledNode, allowVisitedStyle);
+ list->append(*value);
}
return list.release();
}
@@ -431,11 +428,10 @@ static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBackgroundShorthand(const C
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
RefPtrWillBeRawPtr<CSSValueList> beforeSlash = CSSValueList::createSpaceSeparated();
if (!currLayer->next()) { // color only for final layer
- RefPtrWillBeRawPtr<CSSValue> value = ComputedStyleCSSValueMapping::get(CSSPropertyBackgroundColor, style, layoutObject, styledNode, allowVisitedStyle);
- ASSERT(value);
- beforeSlash->append(value);
+ 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() : cssValuePool().createIdentifierValue(CSSValueNone));
beforeSlash->append(valueForFillRepeat(currLayer->repeatX(), currLayer->repeatY()));
beforeSlash->append(cssValuePool().createValue(currLayer->attachment()));
beforeSlash->append(createPositionListForLayer(CSSPropertyBackgroundPosition, *currLayer, style));
@@ -542,7 +538,7 @@ static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> valueForFontWeight(const Comput
return cssValuePool().createValue(style.fontDescription().weight());
}
-static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackBreadth(const GridLength& trackBreadth, const ComputedStyle& style)
+static CSSValue specifiedValueForGridTrackBreadth(const GridLength& trackBreadth, const ComputedStyle& style)
{
if (!trackBreadth.isLength())
return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue::CSS_FR);
@@ -553,7 +549,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackBreadth(const
return zoomAdjustedPixelValueForLength(trackBreadthLength, style);
}
-static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackSize(const GridTrackSize& trackSize, const ComputedStyle& style)
+static CSSValue specifiedValueForGridTrackSize(const GridTrackSize& trackSize, const ComputedStyle& style)
{
switch (trackSize.type()) {
case LengthTrackSizing:
@@ -565,7 +561,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> specifiedValueForGridTrackSize(const Gri
return minMaxTrackBreadths.release();
}
ASSERT_NOT_REACHED();
- return nullptr;
+ return specifiedValueForGridTrackBreadth(trackSize.length(), style);
}
static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& orderedNamedGridLines, size_t i, CSSValueList& list)
@@ -580,7 +576,7 @@ static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& order
list.append(lineNames.release());
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDirection direction, const LayoutObject* layoutObject, const ComputedStyle& style)
+static CSSValue valueForGridTrackList(GridTrackSizingDirection direction, const LayoutObject* layoutObject, const ComputedStyle& style)
{
const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gridTemplateColumns() : style.gridTemplateRows();
const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns ? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines();
@@ -625,7 +621,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDir
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForGridPosition(const GridPosition& position)
+static CSSValue valueForGridPosition(const GridPosition& position)
{
if (position.isAuto())
return cssValuePool().createIdentifierValue(CSSValueAuto);
@@ -655,7 +651,7 @@ static LayoutRect sizingBox(const LayoutObject* layoutObject)
return box->style()->boxSizing() == BORDER_BOX ? box->borderBoxRect() : box->computedCSSContentBoxRect();
}
-static PassRefPtrWillBeRawPtr<CSSValue> scrollBlocksOnFlagsToCSSValue(WebScrollBlocksOn scrollBlocksOn)
+static CSSValue scrollBlocksOnFlagsToCSSValue(WebScrollBlocksOn scrollBlocksOn)
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
@@ -672,7 +668,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> scrollBlocksOnFlagsToCSSValue(WebScrollB
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration)
+static CSSValue renderTextDecorationFlagsToCSSValue(int textDecoration)
{
// Blink value is ignored.
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
@@ -688,7 +684,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForTextDecorationStyle(TextDecorationStyle textDecorationStyle)
+static CSSValue valueForTextDecorationStyle(TextDecorationStyle textDecorationStyle)
{
switch (textDecorationStyle) {
case TextDecorationStyleSolid:
@@ -707,7 +703,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForTextDecorationStyle(TextDecorati
return cssValuePool().createExplicitInitialValue();
}
-static PassRefPtrWillBeRawPtr<CSSValue> touchActionFlagsToCSSValue(TouchAction touchAction)
+static CSSValue touchActionFlagsToCSSValue(TouchAction touchAction)
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
if (touchAction == TouchActionAuto)
@@ -737,7 +733,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> touchActionFlagsToCSSValue(TouchAction t
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForWillChange(const Vector<CSSPropertyID>& willChangeProperties, bool willChangeContents, bool willChangeScrollPosition)
+static CSSValue valueForWillChange(const Vector<CSSPropertyID>& willChangeProperties, bool willChangeContents, bool willChangeScrollPosition)
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
if (willChangeContents)
@@ -751,7 +747,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForWillChange(const Vector<CSSPrope
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDelay(const CSSTimingData* timingData)
+static CSSValue valueForAnimationDelay(const CSSTimingData* timingData)
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
if (timingData) {
@@ -763,7 +759,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDelay(const CSSTimingDa
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDirection(Timing::PlaybackDirection direction)
+static CSSValue valueForAnimationDirection(Timing::PlaybackDirection direction)
{
switch (direction) {
case Timing::PlaybackDirectionNormal:
@@ -776,11 +772,11 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDirection(Timing::Playb
return cssValuePool().createIdentifierValue(CSSValueAlternateReverse);
default:
ASSERT_NOT_REACHED();
- return nullptr;
+ return cssValuePool().createIdentifierValue(CSSValueNormal);
}
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDuration(const CSSTimingData* timingData)
+static CSSValue valueForAnimationDuration(const CSSTimingData* timingData)
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
if (timingData) {
@@ -792,7 +788,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationDuration(const CSSTimin
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationFillMode(Timing::FillMode fillMode)
+static CSSValue valueForAnimationFillMode(Timing::FillMode fillMode)
{
switch (fillMode) {
case Timing::FillModeNone:
@@ -805,18 +801,18 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationFillMode(Timing::FillMo
return cssValuePool().createIdentifierValue(CSSValueBoth);
default:
ASSERT_NOT_REACHED();
- return nullptr;
+ return cssValuePool().createIdentifierValue(CSSValueNone);
}
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationIterationCount(double iterationCount)
+static CSSValue valueForAnimationIterationCount(double iterationCount)
{
if (iterationCount == std::numeric_limits<double>::infinity())
return cssValuePool().createIdentifierValue(CSSValueInfinite);
return cssValuePool().createValue(iterationCount, CSSPrimitiveValue::CSS_NUMBER);
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationPlayState(EAnimPlayState playState)
+static CSSValue valueForAnimationPlayState(EAnimPlayState playState)
{
if (playState == AnimPlayStatePlaying)
return cssValuePool().createIdentifierValue(CSSValueRunning);
@@ -824,7 +820,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationPlayState(EAnimPlayStat
return cssValuePool().createIdentifierValue(CSSValuePaused);
}
-static PassRefPtrWillBeRawPtr<CSSValue> createTimingFunctionValue(const TimingFunction* timingFunction)
+static CSSValue createTimingFunctionValue(const TimingFunction* timingFunction)
{
switch (timingFunction->type()) {
case TimingFunction::CubicBezierFunction:
@@ -847,7 +843,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> createTimingFunctionValue(const TimingFu
break;
default:
ASSERT_NOT_REACHED();
- return nullptr;
+ valueId = CSSValueEase;
}
return cssValuePool().createIdentifierValue(valueId);
}
@@ -872,7 +868,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> createTimingFunctionValue(const TimingFu
}
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForAnimationTimingFunction(const CSSTimingData* timingData)
+static CSSValue valueForAnimationTimingFunction(const CSSTimingData* timingData)
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
if (timingData) {
@@ -898,10 +894,10 @@ static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBorderRadiusCorner(LengthSi
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForBorderRadiusCorner(LengthSize radius, const ComputedStyle& style)
+static CSSValue valueForBorderRadiusCorner(LengthSize radius, const ComputedStyle& style)
{
RefPtrWillBeRawPtr<CSSValueList> list = valuesForBorderRadiusCorner(radius, style);
- if (list->item(0)->equals(*list->item(1)))
+ if (list->item(0).equals(list->item(1)))
return list->item(0);
return list.release();
}
@@ -945,7 +941,7 @@ static PassRefPtrWillBeRawPtr<CSSFunctionValue> valueForMatrixTransform(const Tr
return transformValue.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> computedTransform(const LayoutObject* layoutObject, const ComputedStyle& style)
+static CSSValue computedTransform(const LayoutObject* layoutObject, const ComputedStyle& style)
{
if (!layoutObject || !layoutObject->hasTransformRelatedProperty() || !style.hasTransform())
return cssValuePool().createIdentifierValue(CSSValueNone);
@@ -964,7 +960,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> computedTransform(const LayoutObject* la
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> createTransitionPropertyValue(const CSSTransitionData::TransitionProperty& property)
+static CSSValue createTransitionPropertyValue(const CSSTransitionData::TransitionProperty& property)
{
if (property.propertyType == CSSTransitionData::TransitionNone)
return cssValuePool().createIdentifierValue(CSSValueNone);
@@ -976,7 +972,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> createTransitionPropertyValue(const CSST
return cssValuePool().createValue(getPropertyNameString(property.unresolvedProperty), CSSPrimitiveValue::CSS_CUSTOM_IDENT);
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForTransitionProperty(const CSSTransitionData* transitionData)
+static CSSValue valueForTransitionProperty(const CSSTransitionData* transitionData)
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
if (transitionData) {
@@ -988,7 +984,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForTransitionProperty(const CSSTran
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> createLineBoxContainValue(unsigned lineBoxContain)
+static CSSValue createLineBoxContainValue(unsigned lineBoxContain)
{
if (!lineBoxContain)
return cssValuePool().createIdentifierValue(CSSValueNone);
@@ -1011,7 +1007,7 @@ CSSValueID valueForQuoteType(const QuoteType quoteType)
return CSSValueInvalid;
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForContentData(const ComputedStyle& style)
+static CSSValue valueForContentData(const ComputedStyle& style)
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
for (const ContentData* contentData = style.contentData(); contentData; contentData = contentData->next()) {
@@ -1028,7 +1024,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForContentData(const ComputedStyle&
} else if (contentData->isImage()) {
const StyleImage* image = toImageContentData(contentData)->image();
ASSERT(image);
- list->append(image->cssValue());
+ list->append(*image->cssValue());
} else if (contentData->isText()) {
list->append(cssValuePool().createValue(toTextContentData(contentData)->text(), CSSPrimitiveValue::CSS_STRING));
} else if (contentData->isQuote()) {
@@ -1041,7 +1037,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForContentData(const ComputedStyle&
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForCounterDirectives(const ComputedStyle& style, CSSPropertyID propertyID)
+static CSSValue valueForCounterDirectives(const ComputedStyle& style, CSSPropertyID propertyID)
{
const CounterDirectiveMap* map = style.counterDirectives();
if (!map)
@@ -1064,7 +1060,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForCounterDirectives(const Computed
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForShape(const ComputedStyle& style, ShapeValue* shapeValue)
+static CSSValue valueForShape(const ComputedStyle& style, ShapeValue* shapeValue)
{
if (!shapeValue)
return cssValuePool().createIdentifierValue(CSSValueNone);
@@ -1072,7 +1068,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForShape(const ComputedStyle& style
return cssValuePool().createValue(shapeValue->cssBox());
if (shapeValue->type() == ShapeValue::Image) {
if (shapeValue->image())
- return shapeValue->image()->cssValue();
+ return *shapeValue->image()->cssValue();
return cssValuePool().createIdentifierValue(CSSValueNone);
}
@@ -1089,26 +1085,26 @@ static PassRefPtrWillBeRawPtr<CSSValueList> valuesForSidesShorthand(const StyleP
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
// Assume the properties are in the usual order top, right, bottom, left.
- RefPtrWillBeRawPtr<CSSValue> topValue = ComputedStyleCSSValueMapping::get(shorthand.properties()[0], style, layoutObject, styledNode, allowVisitedStyle);
- RefPtrWillBeRawPtr<CSSValue> rightValue = ComputedStyleCSSValueMapping::get(shorthand.properties()[1], style, layoutObject, styledNode, allowVisitedStyle);
- RefPtrWillBeRawPtr<CSSValue> bottomValue = ComputedStyleCSSValueMapping::get(shorthand.properties()[2], style, layoutObject, styledNode, allowVisitedStyle);
- RefPtrWillBeRawPtr<CSSValue> leftValue = ComputedStyleCSSValueMapping::get(shorthand.properties()[3], style, layoutObject, styledNode, allowVisitedStyle);
+ NullableCSSValue topValue = ComputedStyleCSSValueMapping::get(shorthand.properties()[0], style, layoutObject, styledNode, allowVisitedStyle);
+ NullableCSSValue rightValue = ComputedStyleCSSValueMapping::get(shorthand.properties()[1], style, layoutObject, styledNode, allowVisitedStyle);
+ NullableCSSValue bottomValue = ComputedStyleCSSValueMapping::get(shorthand.properties()[2], style, layoutObject, styledNode, allowVisitedStyle);
+ NullableCSSValue leftValue = ComputedStyleCSSValueMapping::get(shorthand.properties()[3], style, layoutObject, styledNode, allowVisitedStyle);
// All 4 properties must be specified.
if (!topValue || !rightValue || !bottomValue || !leftValue)
return nullptr;
- bool showLeft = !compareCSSValuePtr(rightValue, leftValue);
- bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft;
- bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom;
+ bool showLeft = !rightValue->equals(*leftValue);
+ bool showBottom = !topValue->equals(*bottomValue) || showLeft;
+ bool showRight = !topValue->equals(*rightValue) || showBottom;
- list->append(topValue.release());
+ list->append(*topValue);
if (showRight)
- list->append(rightValue.release());
+ list->append(*rightValue);
if (showBottom)
- list->append(bottomValue.release());
+ list->append(*bottomValue);
if (showLeft)
- list->append(leftValue.release());
+ list->append(*leftValue);
return list.release();
}
@@ -1150,7 +1146,7 @@ static PassRefPtrWillBeRawPtr<CSSValueList> valueForBorderRadiusShorthand(const
if (showVerticalBottomLeft)
verticalRadii->append(bottomLeftRadius->item(1));
- if (!verticalRadii->equals(*toCSSValueList(list->item(0))))
+ if (!verticalRadii->equals(toCSSValueList(list->item(0))))
list->append(verticalRadii.release());
return list.release();
@@ -1172,7 +1168,7 @@ static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> glyphOrientationToCSSPrimitiveV
}
}
-static PassRefPtrWillBeRawPtr<CSSValue> strokeDashArrayToCSSValueList(const SVGDashArray& dashes, const ComputedStyle& style)
+static CSSValue strokeDashArrayToCSSValueList(const SVGDashArray& dashes, const ComputedStyle& style)
{
if (dashes.isEmpty())
return CSSPrimitiveValue::createIdentifier(CSSValueNone);
@@ -1184,7 +1180,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> strokeDashArrayToCSSValueList(const SVGD
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> paintOrderToCSSValueList(EPaintOrder paintorder)
+static CSSValue paintOrderToCSSValueList(EPaintOrder paintorder)
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
do {
@@ -1205,7 +1201,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> paintOrderToCSSValueList(EPaintOrder pai
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaintType paintType, const String& url, const Color& color, const Color& currentColor)
+static CSSValue adjustSVGPaintForCurrentColor(SVGPaintType paintType, const String& url, const Color& color, const Color& currentColor)
{
if (paintType >= SVG_PAINTTYPE_URI_NONE) {
RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
@@ -1231,7 +1227,7 @@ static inline String serializeAsFragmentIdentifier(const AtomicString& resource)
return "#" + resource;
}
-PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowData(const ShadowData& shadow, const ComputedStyle& style, bool useSpread)
+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);
@@ -1242,7 +1238,7 @@ PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowDat
return CSSShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), shadowStyle.release(), color.release());
}
-PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowList(const ShadowList* shadowList, const ComputedStyle& style, bool useSpread)
+CSSValue ComputedStyleCSSValueMapping::valueForShadowList(const ShadowList* shadowList, const ComputedStyle& style, bool useSpread)
{
if (!shadowList)
return cssValuePool().createIdentifierValue(CSSValueNone);
@@ -1254,7 +1250,7 @@ PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForShadowLis
return list.release();
}
-PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFilter(const ComputedStyle& style)
+CSSValue ComputedStyleCSSValueMapping::valueForFilter(const ComputedStyle& style)
{
if (style.filter().operations().isEmpty())
return cssValuePool().createIdentifierValue(CSSValueNone);
@@ -1324,7 +1320,7 @@ PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFilter(co
return list.release();
}
-PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFont(const ComputedStyle& style)
+CSSValue ComputedStyleCSSValueMapping::valueForFont(const ComputedStyle& style)
{
// Add a slash between size and line-height.
RefPtrWillBeRawPtr<CSSValueList> sizeAndLineHeight = CSSValueList::createSlashSeparated();
@@ -1342,7 +1338,7 @@ PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::valueForFont(cons
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapDestination(const LengthPoint& destination, const ComputedStyle& style)
+static CSSValue valueForScrollSnapDestination(const LengthPoint& destination, const ComputedStyle& style)
{
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
list->append(zoomAdjustedPixelValueForLength(destination.x(), style));
@@ -1350,7 +1346,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapDestination(const Leng
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapPoints(const ScrollSnapPoints& points, const ComputedStyle& style)
+static CSSValue valueForScrollSnapPoints(const ScrollSnapPoints& points, const ComputedStyle& style)
{
if (points.hasRepeat) {
RefPtrWillBeRawPtr<CSSFunctionValue> repeat = CSSFunctionValue::create(CSSValueRepeat);
@@ -1361,7 +1357,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapPoints(const ScrollSna
return cssValuePool().createIdentifierValue(CSSValueNone);
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapCoordinate(const Vector<LengthPoint>& coordinates, const ComputedStyle& style)
+static CSSValue valueForScrollSnapCoordinate(const Vector<LengthPoint>& coordinates, const ComputedStyle& style)
{
if (coordinates.isEmpty())
return cssValuePool().createIdentifierValue(CSSValueNone);
@@ -1378,7 +1374,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> valueForScrollSnapCoordinate(const Vecto
return list.release();
}
-PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle)
+NullableCSSValue ComputedStyleCSSValueMapping::get(CSSPropertyID propertyID, const ComputedStyle& style, const LayoutObject* layoutObject, Node* styledNode, bool allowVisitedStyle)
{
const SVGComputedStyle& svgStyle = style.svgStyle();
propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style.direction(), style.writingMode());
@@ -1394,7 +1390,7 @@ PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID
const FillLayer* currLayer = propertyID == CSSPropertyWebkitMaskImage ? &style.maskLayers() : &style.backgroundLayers();
for (; currLayer; currLayer = currLayer->next()) {
if (currLayer->image())
- list->append(currLayer->image()->cssValue());
+ list->append(*currLayer->image()->cssValue());
else
list->append(cssValuePool().createIdentifierValue(CSSValueNone));
}
@@ -1590,15 +1586,15 @@ PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID
list = CSSValueList::createCommaSeparated();
for (unsigned i = 0; i < cursors->size(); ++i) {
if (StyleImage* image = cursors->at(i).image())
- list->append(image->cssValue());
+ list->append(*image->cssValue());
}
}
- RefPtrWillBeRawPtr<CSSValue> value = cssValuePool().createValue(style.cursor());
+ CSSValue value = cssValuePool().createValue(style.cursor());
if (list) {
- list->append(value.release());
+ list->append(value);
return list.release();
}
- return value.release();
+ return value;
}
case CSSPropertyDirection:
return cssValuePool().createValue(style.direction());
@@ -2363,17 +2359,17 @@ PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(CSSPropertyID
case CSSPropertyBackground:
return valuesForBackgroundShorthand(style, layoutObject, styledNode, allowVisitedStyle);
case CSSPropertyBorder: {
- RefPtrWillBeRawPtr<CSSValue> value = get(CSSPropertyBorderTop, style, layoutObject, styledNode, allowVisitedStyle);
+ NullableCSSValue value = get(CSSPropertyBorderTop, style, layoutObject, styledNode, allowVisitedStyle);
const CSSPropertyID properties[] = {
CSSPropertyBorderRight,
CSSPropertyBorderBottom,
CSSPropertyBorderLeft
};
for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) {
- if (!compareCSSValuePtr<CSSValue>(value, get(properties[i], style, layoutObject, styledNode, allowVisitedStyle)))
+ if (value != get(properties[i], style, layoutObject, styledNode, allowVisitedStyle))
return nullptr;
}
- return value.release();
+ return *value;
}
case CSSPropertyBorderBottom:
return valuesForShorthandProperty(borderBottomShorthand(), style, layoutObject, styledNode, allowVisitedStyle);

Powered by Google App Engine
This is Rietveld 408576698