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

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 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/css/ComputedStyleCSSValueMapping.h ('k') | Source/core/css/FontFace.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/ComputedStyleCSSValueMapping.cpp
diff --git a/Source/core/css/ComputedStyleCSSValueMapping.cpp b/Source/core/css/ComputedStyleCSSValueMapping.cpp
index 06fa017c5f3c2e22a1b6f5a94e67795d9a40c9b7..686ee759e82e4eea12caf81dd07f250fbdf60b41 100644
--- a/Source/core/css/ComputedStyleCSSValueMapping.cpp
+++ b/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -109,7 +109,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);
@@ -126,7 +126,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.
@@ -143,7 +143,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:
@@ -153,11 +153,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) {
@@ -174,7 +173,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()) {
@@ -313,7 +312,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;
@@ -326,13 +325,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();
@@ -340,18 +339,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);
@@ -406,9 +405,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();
}
@@ -417,9 +415,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();
}
@@ -432,11 +429,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));
@@ -543,7 +539,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);
@@ -554,7 +550,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:
@@ -566,7 +562,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)
@@ -581,7 +577,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();
@@ -626,7 +622,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);
@@ -656,7 +652,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();
@@ -673,7 +669,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();
@@ -689,7 +685,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> renderTextDecorationFlagsToCSSValue(int
return list.release();
}
-static PassRefPtrWillBeRawPtr<CSSValue> valueForTextDecorationStyle(TextDecorationStyle textDecorationStyle)
+static CSSValue valueForTextDecorationStyle(TextDecorationStyle textDecorationStyle)
{
switch (textDecorationStyle) {
case TextDecorationStyleSolid:
@@ -708,7 +704,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)
@@ -738,7 +734,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)
@@ -752,7 +748,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) {
@@ -764,7 +760,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:
@@ -777,11 +773,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) {
@@ -793,7 +789,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:
@@ -806,18 +802,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);
@@ -825,7 +821,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:
@@ -848,7 +844,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> createTimingFunctionValue(const TimingFu
break;
default:
ASSERT_NOT_REACHED();
- return nullptr;
+ valueId = CSSValueEase;
}
return cssValuePool().createIdentifierValue(valueId);
}
@@ -873,7 +869,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) {
@@ -899,10 +895,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();
}
@@ -946,7 +942,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);
@@ -965,7 +961,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);
@@ -977,7 +973,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) {
@@ -989,7 +985,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);
@@ -1012,7 +1008,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()) {
@@ -1029,7 +1025,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()) {
@@ -1042,7 +1038,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)
@@ -1065,7 +1061,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);
@@ -1073,7 +1069,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);
}
@@ -1090,26 +1086,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 != leftValue;
+ bool showBottom = (topValue != bottomValue) || showLeft;
+ bool showRight = (topValue != 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();
}
@@ -1151,7 +1147,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();
@@ -1173,7 +1169,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);
@@ -1185,7 +1181,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 {
@@ -1206,7 +1202,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();
@@ -1232,7 +1228,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);
@@ -1243,7 +1239,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);
@@ -1255,7 +1251,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);
@@ -1325,7 +1321,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();
@@ -1343,7 +1339,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));
@@ -1351,7 +1347,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);
@@ -1362,7 +1358,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);
@@ -1379,7 +1375,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());
@@ -1395,7 +1391,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));
}
@@ -1591,15 +1587,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());
@@ -2378,17 +2374,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);
« no previous file with comments | « Source/core/css/ComputedStyleCSSValueMapping.h ('k') | Source/core/css/FontFace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698