Title: [172536] trunk/Source/WebCore
Revision
172536
Author
akl...@apple.com
Date
2014-08-13 14:06:23 -0700 (Wed, 13 Aug 2014)

Log Message

CSSValueList should never contain null values.
<https://webkit.org/b/135887>

It's not legal for a CSSValueList to contain null CSSValues, so make
it store a Vector of Ref<CSSValue> internally instead.

This allows the compiler to avoid emitting a number of null checks.
It will also allow a future patch to make CSSValueList vend CSSValue&
instead of CSSValue*.

Most of the patch is fixing up things on their way into a CSSValueList
to not be null at the call site, now that append() and prepend() are
taking PassRef instead of PassRefPtr.

Reviewed by Sam Weinig.

* css/BasicShapeFunctions.cpp:
(WebCore::valueForBasicShape):
* css/BasicShapeFunctions.h:
* css/CSSBorderImage.cpp:
(WebCore::createBorderImageValue):
* css/CSSBorderImage.h:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForImageSliceSide):
(WebCore::valueForNinePieceImageSlice):
(WebCore::valueForNinePieceImageQuad):
(WebCore::valueForNinePieceImage):
(WebCore::getBorderRadiusShorthandValue):
(WebCore::ComputedStyleExtractor::valueForShadow):
(WebCore::ComputedStyleExtractor::valueForFilter):
(WebCore::specifiedValueForGridTrackSize):
(WebCore::addValuesForNamedGridLinesAtIndex):
(WebCore::scrollSnapCoordinates):
(WebCore::createTimingFunctionValue):
(WebCore::fillSourceTypeToCSSValue):
(WebCore::contentToCSSValue):
(WebCore::shapePropertyValue):
(WebCore::ComputedStyleExtractor::propertyValue):
(WebCore::ComputedStyleExtractor::getCSSPropertyValuesForShorthandProperties):
(WebCore::ComputedStyleExtractor::getCSSPropertyValuesForSidesShorthand):
(WebCore::ComputedStyleExtractor::getCSSPropertyValuesForGridShorthand):
(WebCore::ComputedStyleExtractor::getBackgroundShorthandValue):
* css/CSSComputedStyleDeclaration.h:
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::addFontFaceRule):
* css/CSSParser.cpp:
(WebCore::createPrimitiveValuePair):
(WebCore::parseTranslateTransformValue):
(WebCore::CSSParser::createPrimitiveNumericValue):
(WebCore::CSSParser::createPrimitiveStringValue):
(WebCore::CSSParser::addFillValue):
(WebCore::CSSParser::parseNonElementSnapPoints):
(WebCore::CSSParser::parseScrollSnapDestination):
(WebCore::CSSParser::parseFillShorthand):
(WebCore::CSSParser::addAnimationValue):
(WebCore::CSSParser::parseAnimationShorthand):
(WebCore::CSSParser::parseTransitionShorthand):
(WebCore::CSSParser::parseQuotes):
(WebCore::CSSParser::parseContent):
(WebCore::CSSParser::parseFillProperty):
(WebCore::CSSParser::parseAnimationProperty):
(WebCore::CSSParser::parseGridPosition):
(WebCore::CSSParser::parseGridTemplateRowsAndAreas):
(WebCore::CSSParser::parseGridLineNames):
(WebCore::CSSParser::parseGridTrackList):
(WebCore::CSSParser::parseGridTrackRepeatFunction):
(WebCore::CSSParser::parseGridTrackSize):
(WebCore::CSSParser::parseBasicShapeAndOrBox):
(WebCore::CSSParser::parseFontVariant):
(WebCore::CSSParser::parseTransform):
(WebCore::CSSParser::parseBuiltinFilterArguments):
(WebCore::CSSParser::parseFilter):
(WebCore::CSSParser::parseTextEmphasisStyle):
* css/CSSParser.h:
* css/CSSProperty.cpp:
(WebCore::CSSProperty::wrapValueInCommaSeparatedList):
* css/CSSValueList.cpp:
(WebCore::CSSValueList::CSSValueList):
(WebCore::CSSValueList::removeAll):
(WebCore::CSSValueList::hasValue):
(WebCore::CSSValueList::copy):
(WebCore::CSSValueList::customCSSText):
(WebCore::CSSValueList::equals):
(WebCore::CSSValueList::addSubresourceStyleURLs):
(WebCore::CSSValueList::hasFailedOrCanceledSubresources):
* css/CSSValueList.h:
(WebCore::CSSValueList::item):
(WebCore::CSSValueList::itemWithoutBoundsCheck):
(WebCore::CSSValueList::append):
(WebCore::CSSValueList::prepend):
* css/SVGCSSComputedStyleDeclaration.cpp:
(WebCore::paintOrder):
* css/SVGCSSParser.cpp:
(WebCore::CSSParser::parsePaintOrder):
* editing/EditingStyle.cpp:
(WebCore::mergeTextDecorationValues):
* editing/EditorCommand.cpp:
(WebCore::executeToggleStyleInList):
* svg/SVGFontFaceSrcElement.cpp:
(WebCore::SVGFontFaceSrcElement::srcValue):
* svg/SVGLength.cpp:
(WebCore::SVGLength::toCSSPrimitiveValue):
* svg/SVGLength.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (172535 => 172536)


--- trunk/Source/WebCore/ChangeLog	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/ChangeLog	2014-08-13 21:06:23 UTC (rev 172536)
@@ -1,3 +1,109 @@
+2014-08-13  Andreas Kling  <akl...@apple.com>
+
+        CSSValueList should never contain null values.
+        <https://webkit.org/b/135887>
+
+        It's not legal for a CSSValueList to contain null CSSValues, so make
+        it store a Vector of Ref<CSSValue> internally instead.
+
+        This allows the compiler to avoid emitting a number of null checks.
+        It will also allow a future patch to make CSSValueList vend CSSValue&
+        instead of CSSValue*.
+
+        Most of the patch is fixing up things on their way into a CSSValueList
+        to not be null at the call site, now that append() and prepend() are
+        taking PassRef instead of PassRefPtr.
+
+        Reviewed by Sam Weinig.
+
+        * css/BasicShapeFunctions.cpp:
+        (WebCore::valueForBasicShape):
+        * css/BasicShapeFunctions.h:
+        * css/CSSBorderImage.cpp:
+        (WebCore::createBorderImageValue):
+        * css/CSSBorderImage.h:
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::valueForImageSliceSide):
+        (WebCore::valueForNinePieceImageSlice):
+        (WebCore::valueForNinePieceImageQuad):
+        (WebCore::valueForNinePieceImage):
+        (WebCore::getBorderRadiusShorthandValue):
+        (WebCore::ComputedStyleExtractor::valueForShadow):
+        (WebCore::ComputedStyleExtractor::valueForFilter):
+        (WebCore::specifiedValueForGridTrackSize):
+        (WebCore::addValuesForNamedGridLinesAtIndex):
+        (WebCore::scrollSnapCoordinates):
+        (WebCore::createTimingFunctionValue):
+        (WebCore::fillSourceTypeToCSSValue):
+        (WebCore::contentToCSSValue):
+        (WebCore::shapePropertyValue):
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForShorthandProperties):
+        (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForSidesShorthand):
+        (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForGridShorthand):
+        (WebCore::ComputedStyleExtractor::getBackgroundShorthandValue):
+        * css/CSSComputedStyleDeclaration.h:
+        * css/CSSFontSelector.cpp:
+        (WebCore::CSSFontSelector::addFontFaceRule):
+        * css/CSSParser.cpp:
+        (WebCore::createPrimitiveValuePair):
+        (WebCore::parseTranslateTransformValue):
+        (WebCore::CSSParser::createPrimitiveNumericValue):
+        (WebCore::CSSParser::createPrimitiveStringValue):
+        (WebCore::CSSParser::addFillValue):
+        (WebCore::CSSParser::parseNonElementSnapPoints):
+        (WebCore::CSSParser::parseScrollSnapDestination):
+        (WebCore::CSSParser::parseFillShorthand):
+        (WebCore::CSSParser::addAnimationValue):
+        (WebCore::CSSParser::parseAnimationShorthand):
+        (WebCore::CSSParser::parseTransitionShorthand):
+        (WebCore::CSSParser::parseQuotes):
+        (WebCore::CSSParser::parseContent):
+        (WebCore::CSSParser::parseFillProperty):
+        (WebCore::CSSParser::parseAnimationProperty):
+        (WebCore::CSSParser::parseGridPosition):
+        (WebCore::CSSParser::parseGridTemplateRowsAndAreas):
+        (WebCore::CSSParser::parseGridLineNames):
+        (WebCore::CSSParser::parseGridTrackList):
+        (WebCore::CSSParser::parseGridTrackRepeatFunction):
+        (WebCore::CSSParser::parseGridTrackSize):
+        (WebCore::CSSParser::parseBasicShapeAndOrBox):
+        (WebCore::CSSParser::parseFontVariant):
+        (WebCore::CSSParser::parseTransform):
+        (WebCore::CSSParser::parseBuiltinFilterArguments):
+        (WebCore::CSSParser::parseFilter):
+        (WebCore::CSSParser::parseTextEmphasisStyle):
+        * css/CSSParser.h:
+        * css/CSSProperty.cpp:
+        (WebCore::CSSProperty::wrapValueInCommaSeparatedList):
+        * css/CSSValueList.cpp:
+        (WebCore::CSSValueList::CSSValueList):
+        (WebCore::CSSValueList::removeAll):
+        (WebCore::CSSValueList::hasValue):
+        (WebCore::CSSValueList::copy):
+        (WebCore::CSSValueList::customCSSText):
+        (WebCore::CSSValueList::equals):
+        (WebCore::CSSValueList::addSubresourceStyleURLs):
+        (WebCore::CSSValueList::hasFailedOrCanceledSubresources):
+        * css/CSSValueList.h:
+        (WebCore::CSSValueList::item):
+        (WebCore::CSSValueList::itemWithoutBoundsCheck):
+        (WebCore::CSSValueList::append):
+        (WebCore::CSSValueList::prepend):
+        * css/SVGCSSComputedStyleDeclaration.cpp:
+        (WebCore::paintOrder):
+        * css/SVGCSSParser.cpp:
+        (WebCore::CSSParser::parsePaintOrder):
+        * editing/EditingStyle.cpp:
+        (WebCore::mergeTextDecorationValues):
+        * editing/EditorCommand.cpp:
+        (WebCore::executeToggleStyleInList):
+        * svg/SVGFontFaceSrcElement.cpp:
+        (WebCore::SVGFontFaceSrcElement::srcValue):
+        * svg/SVGLength.cpp:
+        (WebCore::SVGLength::toCSSPrimitiveValue):
+        * svg/SVGLength.h:
+
 2014-08-13  Alex Christensen  <achristen...@webkit.org>
 
         Removed dead plugins code.

Modified: trunk/Source/WebCore/css/BasicShapeFunctions.cpp (172535 => 172536)


--- trunk/Source/WebCore/css/BasicShapeFunctions.cpp	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/css/BasicShapeFunctions.cpp	2014-08-13 21:06:23 UTC (rev 172536)
@@ -64,7 +64,7 @@
     return 0;
 }
 
-PassRefPtr<CSSValue> valueForBasicShape(const RenderStyle* style, const BasicShape* basicShape)
+PassRef<CSSValue> valueForBasicShape(const RenderStyle* style, const BasicShape* basicShape)
 {
     CSSValuePool& pool = cssValuePool();
 

Modified: trunk/Source/WebCore/css/BasicShapeFunctions.h (172535 => 172536)


--- trunk/Source/WebCore/css/BasicShapeFunctions.h	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/css/BasicShapeFunctions.h	2014-08-13 21:06:23 UTC (rev 172536)
@@ -42,7 +42,7 @@
 class CSSValue;
 class RenderStyle;
 
-PassRefPtr<CSSValue> valueForBasicShape(const RenderStyle*, const BasicShape*);
+PassRef<CSSValue> valueForBasicShape(const RenderStyle*, const BasicShape*);
 PassRefPtr<BasicShape> basicShapeForValue(const CSSToLengthConversionData&, const CSSBasicShape*);
 
 float floatValueForCenterCoordinate(const BasicShapeCenterCoordinate&, float);

Modified: trunk/Source/WebCore/css/CSSBorderImage.cpp (172535 => 172536)


--- trunk/Source/WebCore/css/CSSBorderImage.cpp	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/css/CSSBorderImage.cpp	2014-08-13 21:06:23 UTC (rev 172536)
@@ -22,30 +22,29 @@
 
 namespace WebCore {
 
-PassRefPtr<CSSValueList> createBorderImageValue(PassRefPtr<CSSValue> image, PassRefPtr<CSSValue> imageSlice, PassRefPtr<CSSValue> borderSlice,
-                                                PassRefPtr<CSSValue> outset, PassRefPtr<CSSValue> repeat)
+PassRef<CSSValueList> createBorderImageValue(PassRefPtr<CSSValue> image, PassRefPtr<CSSValue> imageSlice, PassRefPtr<CSSValue> borderSlice, PassRefPtr<CSSValue> outset, PassRefPtr<CSSValue> repeat)
 {
-    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    auto list = CSSValueList::createSpaceSeparated();
     if (image)
-        list->append(image);
+        list.get().append(*image);
 
     if (borderSlice || outset) {
-        RefPtr<CSSValueList> listSlash = CSSValueList::createSlashSeparated();
+        auto listSlash = CSSValueList::createSlashSeparated();
         if (imageSlice)
-            listSlash->append(imageSlice);
+            listSlash.get().append(*imageSlice);
 
         if (borderSlice)
-            listSlash->append(borderSlice);
+            listSlash.get().append(*borderSlice);
 
         if (outset)
-            listSlash->append(outset);
+            listSlash.get().append(*outset);
 
-        list->append(listSlash);
+        list.get().append(WTF::move(listSlash));
     } else if (imageSlice)
-        list->append(imageSlice);
+        list.get().append(*imageSlice);
     if (repeat)
-        list->append(repeat);
-    return list.release();
+        list.get().append(*repeat);
+    return list;
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/css/CSSBorderImage.h (172535 => 172536)


--- trunk/Source/WebCore/css/CSSBorderImage.h	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/css/CSSBorderImage.h	2014-08-13 21:06:23 UTC (rev 172536)
@@ -27,8 +27,7 @@
 
 namespace WebCore {
 
-PassRefPtr<CSSValueList> createBorderImageValue(PassRefPtr<CSSValue> image, PassRefPtr<CSSValue> imageSlice, PassRefPtr<CSSValue> borderSlice,
-                                                PassRefPtr<CSSValue> outset, PassRefPtr<CSSValue> repeat);
+PassRef<CSSValueList> createBorderImageValue(PassRefPtr<CSSValue> image, PassRefPtr<CSSValue> imageSlice, PassRefPtr<CSSValue> borderSlice, PassRefPtr<CSSValue> outset, PassRefPtr<CSSValue> repeat);
 
 } // namespace WebCore
 

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (172535 => 172536)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2014-08-13 21:06:23 UTC (rev 172536)
@@ -461,7 +461,7 @@
     }
 }
 
-static PassRefPtr<CSSPrimitiveValue> valueForImageSliceSide(const Length& length)
+static PassRef<CSSPrimitiveValue> valueForImageSliceSide(const Length& length)
 {
     // These values can be percentages, numbers, or while an animation of mixed types is in progress,
     // a calculation that combines a percentage and a number.
@@ -477,7 +477,7 @@
     return cssValuePool().createValue(0, CSSPrimitiveValue::CSS_NUMBER);
 }
 
-static PassRefPtr<CSSBorderImageSliceValue> valueForNinePieceImageSlice(const NinePieceImage& image)
+static PassRef<CSSBorderImageSliceValue> valueForNinePieceImageSlice(const NinePieceImage& image)
 {
     auto& slices = image.imageSlices();
 
@@ -516,7 +516,7 @@
     return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.release()), image.fill());
 }
 
-static PassRefPtr<CSSPrimitiveValue> valueForNinePieceImageQuad(const LengthBox& box)
+static PassRef<CSSPrimitiveValue> valueForNinePieceImageQuad(const LengthBox& box)
 {
     RefPtr<CSSPrimitiveValue> top;
     RefPtr<CSSPrimitiveValue> right;
@@ -580,7 +580,7 @@
     return cssValuePool().createValue(Pair::create(horizontalRepeat.release(), verticalRepeat.release()));
 }
 
-static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image)
+static PassRef<CSSValue> valueForNinePieceImage(const NinePieceImage& image)
 {
     if (!image.hasImage())
         return cssValuePool().createIdentifierValue(CSSValueNone);
@@ -757,27 +757,27 @@
     RefPtr<CSSValueList> bottomLeftRadius = getBorderRadiusCornerValues(style->borderBottomLeftRadius(), style);
 
     RefPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated();
-    horizontalRadii->append(topLeftRadius->item(0));
+    horizontalRadii->append(*topLeftRadius->item(0));
     if (showHorizontalTopRight)
-        horizontalRadii->append(topRightRadius->item(0));
+        horizontalRadii->append(*topRightRadius->item(0));
     if (showHorizontalBottomRight)
-        horizontalRadii->append(bottomRightRadius->item(0));
+        horizontalRadii->append(*bottomRightRadius->item(0));
     if (showHorizontalBottomLeft)
-        horizontalRadii->append(bottomLeftRadius->item(0));
+        horizontalRadii->append(*bottomLeftRadius->item(0));
 
-    list.get().append(horizontalRadii.release());
+    list.get().append(horizontalRadii.releaseNonNull());
 
     RefPtr<CSSValueList> verticalRadiiList = CSSValueList::createSpaceSeparated();
-    verticalRadiiList->append(topLeftRadius->item(1));
+    verticalRadiiList->append(*topLeftRadius->item(1));
     if (showVerticalTopRight)
-        verticalRadiiList->append(topRightRadius->item(1));
+        verticalRadiiList->append(*topRightRadius->item(1));
     if (showVerticalBottomRight)
-        verticalRadiiList->append(bottomRightRadius->item(1));
+        verticalRadiiList->append(*bottomRightRadius->item(1));
     if (showVerticalBottomLeft)
-        verticalRadiiList->append(bottomLeftRadius->item(1));
+        verticalRadiiList->append(*bottomLeftRadius->item(1));
 
     if (!verticalRadiiList->equals(*toCSSValueList(list.get().item(0))))
-        list.get().append(verticalRadiiList.release());
+        list.get().append(verticalRadiiList.releaseNonNull());
 
     return list;
 }
@@ -859,12 +859,12 @@
     return adjust == AdjustPixelValues ? zoomAdjustedPixelValue(length.value(), style) : cssValuePool().createValue(length);
 }
 
-PassRefPtr<CSSValue> ComputedStyleExtractor::valueForShadow(const ShadowData* shadow, CSSPropertyID propertyID, const RenderStyle* style, AdjustPixelValuesForComputedStyle adjust)
+PassRef<CSSValue> ComputedStyleExtractor::valueForShadow(const ShadowData* shadow, CSSPropertyID propertyID, const RenderStyle* style, AdjustPixelValuesForComputedStyle adjust)
 {
     if (!shadow)
         return cssValuePool().createIdentifierValue(CSSValueNone);
 
-    RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+    auto list = CSSValueList::createCommaSeparated();
     for (const ShadowData* currShadowData = shadow; currShadowData; currShadowData = currShadowData->next()) {
         RefPtr<CSSPrimitiveValue> x = adjustLengthForZoom(currShadowData->x(), style, adjust);
         RefPtr<CSSPrimitiveValue> y = adjustLengthForZoom(currShadowData->y(), style, adjust);
@@ -872,9 +872,9 @@
         RefPtr<CSSPrimitiveValue> spread = propertyID == CSSPropertyTextShadow ? PassRefPtr<CSSPrimitiveValue>() : adjustLengthForZoom(currShadowData->spread(), style, adjust);
         RefPtr<CSSPrimitiveValue> style = propertyID == CSSPropertyTextShadow || currShadowData->style() == Normal ? PassRefPtr<CSSPrimitiveValue>() : cssValuePool().createIdentifierValue(CSSValueInset);
         RefPtr<CSSPrimitiveValue> color = cssValuePool().createColorValue(currShadowData->color().rgb());
-        list->prepend(CSSShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release()));
+        list.get().prepend(CSSShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release()));
     }
-    return list.release();
+    return WTF::move(list);
 }
 
 #if ENABLE(CSS_FILTERS)
@@ -963,7 +963,7 @@
             filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::UnknownFilterOperation);
             break;
         }
-        list.get().append(filterValue.release());
+        list.get().append(filterValue.releaseNonNull());
     }
 
     return WTF::move(list);
@@ -982,19 +982,18 @@
     return zoomAdjustedPixelValueForLength(trackBreadthLength, style);
 }
 
-static PassRefPtr<CSSValue> specifiedValueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle* style)
+static PassRef<CSSValue> specifiedValueForGridTrackSize(const GridTrackSize& trackSize, const RenderStyle* style)
 {
     switch (trackSize.type()) {
     case LengthTrackSizing:
         return specifiedValueForGridTrackBreadth(trackSize.length(), style);
-    case MinMaxTrackSizing:
+    default:
+        ASSERT(trackSize.type() == MinMaxTrackSizing);
         RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSeparated();
         minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.minTrackBreadth(), style));
         minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.maxTrackBreadth(), style));
         return CSSFunctionValue::create("minmax(", minMaxTrackBreadths);
     }
-    ASSERT_NOT_REACHED();
-    return 0;
 }
 
 static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLinesMap& orderedNamedGridLines, size_t i, CSSValueList& list)
@@ -1006,7 +1005,7 @@
     RefPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue::create();
     for (size_t i = 0; i < namedGridLines.size(); ++i)
         lineNames->append(cssValuePool().createValue(namedGridLines[i], CSSPrimitiveValue::CSS_STRING));
-    list.append(lineNames.release());
+    list.append(lineNames.releaseNonNull());
 }
 
 static PassRef<CSSValue> valueForGridTrackList(GridTrackSizingDirection direction, RenderObject* renderer, const RenderStyle* style)
@@ -1136,7 +1135,7 @@
         else
             currentCoordinate->append(zoomAdjustedPixelValue(valueForLength(point, 0), style));
 
-        snapCoordinatesValue->append(PassRefPtr<CSSValueList>(WTF::move(currentCoordinate)));
+        snapCoordinatesValue->append(currentCoordinate.releaseNonNull());
     }
     return snapCoordinatesValue.releaseNonNull();
 }
@@ -1168,7 +1167,7 @@
     return list;
 }
 
-static PassRefPtr<CSSValue> createTimingFunctionValue(const TimingFunction* timingFunction)
+static PassRef<CSSValue> createTimingFunctionValue(const TimingFunction* timingFunction)
 {
     switch (timingFunction->type()) {
     case TimingFunction::CubicBezierFunction: {
@@ -1185,12 +1184,10 @@
             case CubicBezierTimingFunction::EaseOut:
                 valueId = CSSValueEaseOut;
                 break;
-            case CubicBezierTimingFunction::EaseInOut:
+            default:
+                ASSERT(bezierTimingFunction->timingFunctionPreset() == CubicBezierTimingFunction::EaseInOut);
                 valueId = CSSValueEaseInOut;
                 break;
-            default:
-                ASSERT_NOT_REACHED();
-                return 0;
             }
             return cssValuePool().createIdentifierValue(valueId);
         }
@@ -1200,11 +1197,10 @@
         const StepsTimingFunction* stepsTimingFunction = static_cast<const StepsTimingFunction*>(timingFunction);
         return CSSStepsTimingFunctionValue::create(stepsTimingFunction->numberOfSteps(), stepsTimingFunction->stepAtStart());
     }
-    case TimingFunction::LinearFunction:
+    default:
+        ASSERT(timingFunction->type() == TimingFunction::LinearFunction);
         return cssValuePool().createIdentifierValue(CSSValueLinear);
     }
-    ASSERT_NOT_REACHED();
-    return 0;
 }
 
 static PassRef<CSSValueList> getTimingFunctionValue(const AnimationList* animList)
@@ -1434,18 +1430,15 @@
     return WTF::move(list);
 }
 
-static PassRefPtr<CSSValue> fillSourceTypeToCSSValue(EMaskSourceType type)
+static PassRef<CSSValue> fillSourceTypeToCSSValue(EMaskSourceType type)
 {
     switch (type) {
     case MaskAlpha:
         return cssValuePool().createValue(CSSValueAlpha);
-    case MaskLuminance:
+    default:
+        ASSERT(type == MaskLuminance);
         return cssValuePool().createValue(CSSValueLuminance);
     }
-
-    ASSERT_NOT_REACHED();
-
-    return 0;
 }
 
 static PassRef<CSSValue> fillSizeToCSSValue(const FillSize& fillSize, const RenderStyle* style)
@@ -1477,7 +1470,7 @@
         if (contentData->isCounter())
             list.get().append(cssValuePool().createValue(toCounterContentData(contentData)->counter().identifier(), CSSPrimitiveValue::CSS_COUNTER_NAME));
         else if (contentData->isImage())
-            list.get().append(toImageContentData(contentData)->image().cssValue());
+            list.get().append(*toImageContentData(contentData)->image().cssValue());
         else if (contentData->isText())
             list.get().append(cssValuePool().createValue(toTextContentData(contentData)->text(), CSSPrimitiveValue::CSS_STRING));
     }
@@ -1690,7 +1683,7 @@
 }
 
 #if ENABLE(CSS_SHAPES)
-static PassRefPtr<CSSValue> shapePropertyValue(const RenderStyle* style, const ShapeValue* shapeValue)
+static PassRef<CSSValue> shapePropertyValue(const RenderStyle* style, const ShapeValue* shapeValue)
 {
     if (!shapeValue)
         return cssValuePool().createIdentifierValue(CSSValueNone);
@@ -1698,8 +1691,11 @@
     if (shapeValue->type() == ShapeValue::Type::Box)
         return cssValuePool().createValue(shapeValue->cssBox());
 
-    if (shapeValue->type() == ShapeValue::Type::Image)
-        return shapeValue->image() ? shapeValue->image()->cssValue() : cssValuePool().createIdentifierValue(CSSValueNone);
+    if (shapeValue->type() == ShapeValue::Type::Image) {
+        if (shapeValue->image())
+            return *shapeValue->image()->cssValue();
+        return cssValuePool().createIdentifierValue(CSSValueNone);
+    }
 
     ASSERT(shapeValue->type() == ShapeValue::Type::Shape);
 
@@ -1707,7 +1703,7 @@
     list->append(valueForBasicShape(style, shapeValue->shape()));
     if (shapeValue->cssBox() != BoxMissing)
         list->append(cssValuePool().createValue(shapeValue->cssBox()));
-    return list.release();
+    return list.releaseNonNull();
 }
 #endif
 
@@ -1779,7 +1775,7 @@
             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
             for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
                 if (currLayer->image())
-                    list->append(currLayer->image()->cssValue());
+                    list->append(*currLayer->image()->cssValue());
                 else
                     list->append(cssValuePool().createIdentifierValue(CSSValueNone));
             }
@@ -2032,14 +2028,14 @@
                 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());
             }
-            RefPtr<CSSValue> value = cssValuePool().createValue(style->cursor());
+            auto value = cssValuePool().createValue(style->cursor());
             if (list) {
-                list->append(value.release());
+                list->append(WTF::move(value));
                 return list.release();
             }
-            return value.release();
+            return WTF::move(value);
         }
 #if ENABLE(CURSOR_VISIBILITY)
         case CSSPropertyWebkitCursorVisibility:
@@ -2421,7 +2417,7 @@
             // getPropertyCSSValue() returns CSSValueList.
             if (style->textIndentLine() == TextIndentEachLine || style->textIndentType() == TextIndentHanging) {
                 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
-                list->append(textIndent.release());
+                list->append(textIndent.releaseNonNull());
                 if (style->textIndentLine() == TextIndentEachLine)
                     list->append(cssValuePool().createIdentifierValue(CSSValueWebkitEachLine));
                 if (style->textIndentType() == TextIndentHanging)
@@ -2819,7 +2815,7 @@
                     list->append(cssValuePool().createValue(animation.duration(), CSSPrimitiveValue::CSS_S));
                     list->append(createTimingFunctionValue(animation.timingFunction().get()));
                     list->append(cssValuePool().createValue(animation.delay(), CSSPrimitiveValue::CSS_S));
-                    transitionsList->append(list);
+                    transitionsList->append(list.releaseNonNull());
                 }
                 return transitionsList.release();
             }
@@ -3190,7 +3186,7 @@
     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
     for (size_t i = 0; i < shorthand.length(); ++i) {
         RefPtr<CSSValue> value = propertyValue(shorthand.properties()[i], DoNotUpdateLayout);
-        list->append(value);
+        list->append(value.releaseNonNull());
     }
     return list.release();
 }
@@ -3212,13 +3208,13 @@
     bool showBottom = !compareCSSValuePtr(topValue, bottomValue) || showLeft;
     bool showRight = !compareCSSValuePtr(topValue, rightValue) || showBottom;
 
-    list->append(topValue.release());
+    list->append(topValue.releaseNonNull());
     if (showRight)
-        list->append(rightValue.release());
+        list->append(rightValue.releaseNonNull());
     if (showBottom)
-        list->append(bottomValue.release());
+        list->append(bottomValue.releaseNonNull());
     if (showLeft)
-        list->append(leftValue.release());
+        list->append(leftValue.releaseNonNull());
 
     return list.release();
 }
@@ -3228,7 +3224,7 @@
     RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
     for (size_t i = 0; i < shorthand.length(); ++i) {
         RefPtr<CSSValue> value = propertyValue(shorthand.properties()[i], DoNotUpdateLayout);
-        list->append(value.release());
+        list->append(value.releaseNonNull());
     }
     return list.release();
 }
@@ -3318,8 +3314,8 @@
                                                                     CSSPropertyBackgroundClip };
 
     RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
-    list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlashSeperator))));
-    list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSeperator))));
+    list->append(*getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlashSeperator))));
+    list->append(*getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSeperator))));
     return list.release();
 }
 

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h (172535 => 172536)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h	2014-08-13 21:06:23 UTC (rev 172536)
@@ -72,7 +72,7 @@
     PassRefPtr<CSSValue> svgPropertyValue(CSSPropertyID, EUpdateLayout) const;
     PassRefPtr<SVGPaint> adjustSVGPaintForCurrentColor(PassRefPtr<SVGPaint>, RenderStyle*) const;
 
-    static PassRefPtr<CSSValue> valueForShadow(const ShadowData*, CSSPropertyID, const RenderStyle*, AdjustPixelValuesForComputedStyle = AdjustPixelValues);
+    static PassRef<CSSValue> valueForShadow(const ShadowData*, CSSPropertyID, const RenderStyle*, AdjustPixelValuesForComputedStyle = AdjustPixelValues);
     PassRefPtr<CSSPrimitiveValue> currentColorOrValidColor(RenderStyle*, const Color&) const;
 
     PassRefPtr<CSSValueList> getCSSPropertyValuesForShorthandProperties(const StylePropertyShorthand&) const;

Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (172535 => 172536)


--- trunk/Source/WebCore/css/CSSFontSelector.cpp	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp	2014-08-13 21:06:23 UTC (rev 172536)
@@ -168,8 +168,8 @@
         // font-variant descriptor can be a value list.
         if (fontVariant->isPrimitiveValue()) {
             RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
-            list->append(fontVariant);
-            fontVariant = list;
+            list->append(fontVariant.releaseNonNull());
+            fontVariant = list.releaseNonNull();
         } else if (!fontVariant->isValueList())
             return;
 

Modified: trunk/Source/WebCore/css/CSSParser.cpp (172535 => 172536)


--- trunk/Source/WebCore/css/CSSParser.cpp	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2014-08-13 21:06:23 UTC (rev 172536)
@@ -195,7 +195,7 @@
     return false;
 }
 
-static PassRefPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second)
+static PassRef<CSSPrimitiveValue> createPrimitiveValuePair(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second)
 {
     return cssValuePool().createValue(Pair::create(first, second));
 }
@@ -1256,7 +1256,7 @@
     if (!success)
         return false;
     RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated();
-    result->append(transformValue.release());
+    result->append(transformValue.releaseNonNull());
     properties->addParsedProperty(CSSProperty(CSSPropertyWebkitTransform, result.release(), important));
     return true;
 }
@@ -1697,7 +1697,7 @@
     return b;
 }
 
-inline PassRefPtr<CSSPrimitiveValue> CSSParser::createPrimitiveNumericValue(CSSParserValue* value)
+inline PassRef<CSSPrimitiveValue> CSSParser::createPrimitiveNumericValue(CSSParserValue* value)
 {
     if (m_parsedCalculation) {
         ASSERT(isCalculation(value));
@@ -1717,7 +1717,7 @@
     return cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit));
 }
 
-inline PassRefPtr<CSSPrimitiveValue> CSSParser::createPrimitiveStringValue(CSSParserValue* value)
+inline PassRef<CSSPrimitiveValue> CSSParser::createPrimitiveStringValue(CSSParserValue* value)
 {
     ASSERT(value->unit == CSSPrimitiveValue::CSS_STRING || value->unit == CSSPrimitiveValue::CSS_IDENT);
     return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRING);
@@ -3093,21 +3093,22 @@
     return false;
 }
 
-void CSSParser::addFillValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval)
+void CSSParser::addFillValue(RefPtr<CSSValue>& lval, PassRef<CSSValue> rval)
 {
-    if (lval) {
-        if (lval->isBaseValueList())
-            toCSSValueList(lval.get())->append(rval);
-        else {
-            PassRefPtr<CSSValue> oldlVal(lval.release());
-            PassRefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
-            list->append(oldlVal);
-            list->append(rval);
-            lval = list;
-        }
+    if (!lval) {
+        lval = WTF::move(rval);
+        return;
     }
-    else
-        lval = rval;
+
+    if (lval->isBaseValueList()) {
+        toCSSValueList(*lval).append(WTF::move(rval));
+        return;
+    }
+
+    auto list = CSSValueList::createCommaSeparated();
+    list.get().append(lval.releaseNonNull());
+    list.get().append(WTF::move(rval));
+    lval = WTF::move(list);
 }
 
 static bool isItemPositionKeyword(CSSValueID id)
@@ -3187,11 +3188,9 @@
 {
     RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated();
     while (CSSParserValue* val = m_valueList->current()) {
-        RefPtr<CSSValue> parsedValue;
-        if (validUnit(val, FPercent | FLength)) {
-            parsedValue = createPrimitiveNumericValue(val);
-            values->append(parsedValue.release());
-        } else if (val->unit == CSSParserValue::Function
+        if (validUnit(val, FPercent | FLength))
+            values->append(createPrimitiveNumericValue(val));
+        else if (val->unit == CSSParserValue::Function
             && val->function->args != 0
             && val->function->args->size() == 1
             && equalIgnoringCase(val->function->name, "repeat(")) {
@@ -3229,8 +3228,8 @@
     if (!validUnit(curParserVal, FPercent | FLength))
         return false;
     RefPtr<CSSValue> cssValueY = createPrimitiveNumericValue(curParserVal);
-    position->append(cssValueX.release());
-    position->append(cssValueY.release());
+    position->append(cssValueX.releaseNonNull());
+    position->append(cssValueY.releaseNonNull());
     addProperty(propId, position, important);
     m_valueList->next();
     return true;
@@ -3328,15 +3327,15 @@
                 CSSParserValue* parserValue = m_valueList->current();
                 if (parseFillProperty(properties[i], propId1, propId2, val1, val2)) {
                     parsedProperty[i] = found = true;
-                    addFillValue(values[i], val1.release());
+                    addFillValue(values[i], val1.releaseNonNull());
                     if (properties[i] == CSSPropertyBackgroundPosition || properties[i] == CSSPropertyWebkitMaskPosition)
-                        addFillValue(positionYValue, val2.release());
+                        addFillValue(positionYValue, val2.releaseNonNull());
                     if (properties[i] == CSSPropertyBackgroundRepeat || properties[i] == CSSPropertyWebkitMaskRepeat)
-                        addFillValue(repeatYValue, val2.release());
+                        addFillValue(repeatYValue, val2.releaseNonNull());
                     if (properties[i] == CSSPropertyBackgroundOrigin || properties[i] == CSSPropertyWebkitMaskOrigin) {
                         // Reparse the value as a clip, and see if we succeed.
                         if (parseBackgroundClip(parserValue, val1))
-                            addFillValue(clipValue, val1.release()); // The property parsed successfully.
+                            addFillValue(clipValue, val1.releaseNonNull()); // The property parsed successfully.
                         else
                             addFillValue(clipValue, cssValuePool().createImplicitInitialValue()); // Some value was used for origin that is not supported by clip. Just reset clip instead.
                     }
@@ -3402,21 +3401,22 @@
     return true;
 }
 
-void CSSParser::addAnimationValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval)
+void CSSParser::addAnimationValue(RefPtr<CSSValue>& lval, PassRef<CSSValue> rval)
 {
-    if (lval) {
-        if (lval->isValueList())
-            toCSSValueList(lval.get())->append(rval);
-        else {
-            PassRefPtr<CSSValue> oldVal(lval.release());
-            PassRefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
-            list->append(oldVal);
-            list->append(rval);
-            lval = list;
-        }
+    if (!lval) {
+        lval = WTF::move(rval);
+        return;
     }
-    else
-        lval = rval;
+
+    if (lval->isValueList()) {
+        toCSSValueList(*lval).append(WTF::move(rval));
+        return;
+    }
+
+    auto list = CSSValueList::createCommaSeparated();
+    list.get().append(lval.releaseNonNull());
+    list.get().append(WTF::move(rval));
+    lval = WTF::move(list);
 }
 
 bool CSSParser::parseAnimationShorthand(bool important)
@@ -3458,7 +3458,7 @@
                 RefPtr<CSSValue> val;
                 if (parseAnimationProperty(animationProperties.properties()[i], val, context)) {
                     parsedProperty[i] = found = true;
-                    addAnimationValue(values[i], val.release());
+                    addAnimationValue(values[i], val.releaseNonNull());
                     break;
                 }
             }
@@ -3519,7 +3519,7 @@
                 RefPtr<CSSValue> val;
                 if (parseAnimationProperty(shorthand.properties()[i], val, context)) {
                     parsedProperty[i] = found = true;
-                    addAnimationValue(values[i], val.release());
+                    addAnimationValue(values[i], val.releaseNonNull());
                 }
 
                 // There are more values to process but 'none' or 'all' were already defined as the animation property, the declaration becomes invalid.
@@ -3753,12 +3753,9 @@
 {
     RefPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
     while (CSSParserValue* val = m_valueList->current()) {
-        RefPtr<CSSValue> parsedValue;
-        if (val->unit == CSSPrimitiveValue::CSS_STRING)
-            parsedValue = CSSPrimitiveValue::create(val->string, CSSPrimitiveValue::CSS_STRING);
-        else
+        if (val->unit != CSSPrimitiveValue::CSS_STRING)
             break;
-        values->append(parsedValue.release());
+        values->append(CSSPrimitiveValue::create(val->string, CSSPrimitiveValue::CSS_STRING));
         m_valueList->next();
     }
     if (values->length()) {
@@ -3859,7 +3856,7 @@
         }
         if (!parsedValue)
             break;
-        values->append(parsedValue.release());
+        values->append(parsedValue.releaseNonNull());
         m_valueList->next();
     }
 
@@ -4506,21 +4503,21 @@
 
             if (value && !values) {
                 values = CSSValueList::createCommaSeparated();
-                values->append(value.release());
+                values->append(value.releaseNonNull());
             }
 
             if (value2 && !values2) {
                 values2 = CSSValueList::createCommaSeparated();
-                values2->append(value2.release());
+                values2->append(value2.releaseNonNull());
             }
 
             if (values)
-                values->append(currValue.release());
+                values->append(currValue.releaseNonNull());
             else
                 value = currValue.release();
             if (currValue2) {
                 if (values2)
-                    values2->append(currValue2.release());
+                    values2->append(currValue2.releaseNonNull());
                 else
                     value2 = currValue2.release();
             }
@@ -4815,11 +4812,11 @@
 
             if (value && !values) {
                 values = CSSValueList::createCommaSeparated();
-                values->append(value.release());
+                values->append(value.releaseNonNull());
             }
 
             if (values)
-                values->append(currValue.release());
+                values->append(currValue.releaseNonNull());
             else
                 value = currValue.release();
 
@@ -4923,9 +4920,9 @@
     if (hasSeenSpanKeyword)
         values->append(cssValuePool().createIdentifierValue(CSSValueSpan));
     if (numericValue)
-        values->append(numericValue.release());
+        values->append(numericValue.releaseNonNull());
     if (gridLineName)
-        values->append(gridLineName.release());
+        values->append(gridLineName.releaseNonNull());
     ASSERT(values->length());
     return values.release();
 }
@@ -4999,7 +4996,7 @@
             RefPtr<CSSValue> value = parseGridTrackSize(*m_valueList);
             if (!value)
                 return false;
-            templateRows->append(value.release());
+            templateRows->append(value.releaseNonNull());
         } else
             templateRows->append(cssValuePool().createIdentifierValue(CSSValueAuto));
 
@@ -5204,7 +5201,7 @@
         identList->next();
     }
     if (!previousNamedAreaTrailingLineNames)
-        valueList.append(lineNames.release());
+        valueList.append(lineNames.releaseNonNull());
 
     inputList.next();
 }
@@ -5234,7 +5231,7 @@
             RefPtr<CSSValue> value = parseGridTrackSize(*m_valueList);
             if (!value)
                 return nullptr;
-            values->append(value.release());
+            values->append(value.releaseNonNull());
         }
         seenTrackSizeOrRepeatFunction = true;
 
@@ -5276,7 +5273,7 @@
         if (!trackSize)
             return false;
 
-        repeatedValues->append(trackSize.release());
+        repeatedValues->append(trackSize.releaseNonNull());
 
         // This takes care of any trailing <custom-ident>* in the grammar.
         currentValue = arguments->current();
@@ -5286,7 +5283,7 @@
 
     for (size_t i = 0; i < repetitions; ++i) {
         for (size_t j = 0; j < repeatedValues->length(); ++j)
-            list.append(repeatedValues->itemWithoutBoundsCheck(j));
+            list.append(*repeatedValues->itemWithoutBoundsCheck(j));
     }
 
     m_valueList->next();
@@ -5316,8 +5313,8 @@
             return 0;
 
         RefPtr<CSSValueList> parsedArguments = CSSValueList::createCommaSeparated();
-        parsedArguments->append(minTrackBreadth);
-        parsedArguments->append(maxTrackBreadth);
+        parsedArguments->append(minTrackBreadth.releaseNonNull());
+        parsedArguments->append(maxTrackBreadth.releaseNonNull());
         return CSSFunctionValue::create("minmax(", parsedArguments);
     }
 
@@ -6046,10 +6043,11 @@
             RefPtr<CSSPrimitiveValue> shapeValue = parseBasicShape();
             if (!shapeValue)
                 return nullptr;
-            list->append(shapeValue.release());
+            list->append(shapeValue.releaseNonNull());
             shapeFound = true;
         } else if (isBoxValue(valueId, propId) && !boxFound) {
-            list->append(parseValidPrimitive(valueId, value));
+            RefPtr<CSSPrimitiveValue> parsedValue = parseValidPrimitive(valueId, value);
+            list->append(parsedValue.releaseNonNull());
             boxFound = true;
             m_valueList->next();
         } else
@@ -6375,7 +6373,7 @@
         m_valueList->next();
 
         if (values)
-            values->append(parsedValue.release());
+            values->append(parsedValue.releaseNonNull());
         else {
             addProperty(CSSPropertyFontVariant, parsedValue.release(), important);
             return true;
@@ -9148,7 +9146,7 @@
         if (!parsedTransformValue)
             return 0;
 
-        list->append(parsedTransformValue.release());
+        list->append(parsedTransformValue.releaseNonNull());
     }
 
     return list.release();
@@ -9343,7 +9341,7 @@
         if (!shadowValueList || shadowValueList->length() != 1)
             return 0;
         
-        filterValue->append((shadowValueList.release())->itemWithoutBoundsCheck(0));
+        filterValue->append(*shadowValueList->itemWithoutBoundsCheck(0));
         break;
     }
     default:
@@ -9369,7 +9367,7 @@
         if (value->unit == CSSPrimitiveValue::CSS_URI) {
             RefPtr<WebKitCSSFilterValue> referenceFilterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::ReferenceFilterOperation);
             referenceFilterValue->append(CSSPrimitiveValue::create(value->string, CSSPrimitiveValue::CSS_URI));
-            list->append(referenceFilterValue.release());
+            list->append(referenceFilterValue.releaseNonNull());
         } else {
             const CSSParserString name = value->function->name;
             unsigned maximumArgumentCount = 1;
@@ -9387,7 +9385,7 @@
             if (!filterValue)
                 return false;
             
-            list->append(filterValue.release());
+            list->append(filterValue.releaseNonNull());
         }
     }
 
@@ -9695,8 +9693,8 @@
 
     if (fill && shape) {
         RefPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated();
-        parsedValues->append(fill.release());
-        parsedValues->append(shape.release());
+        parsedValues->append(fill.releaseNonNull());
+        parsedValues->append(shape.releaseNonNull());
         addProperty(CSSPropertyWebkitTextEmphasisStyle, parsedValues.release(), important);
         return true;
     }

Modified: trunk/Source/WebCore/css/CSSParser.h (172535 => 172536)


--- trunk/Source/WebCore/css/CSSParser.h	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/css/CSSParser.h	2014-08-13 21:06:23 UTC (rev 172536)
@@ -141,10 +141,9 @@
     bool parseFillProperty(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
     bool parseFillShorthand(CSSPropertyID, const CSSPropertyID* properties, int numProperties, bool important);
 
-    void addFillValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval);
+    void addFillValue(RefPtr<CSSValue>& lval, PassRef<CSSValue> rval);
+    void addAnimationValue(RefPtr<CSSValue>& lval, PassRef<CSSValue> rval);
 
-    void addAnimationValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval);
-
     PassRefPtr<CSSValue> parseAnimationDelay();
     PassRefPtr<CSSValue> parseAnimationDirection();
     PassRefPtr<CSSValue> parseAnimationDuration();
@@ -413,8 +412,8 @@
     PassRefPtr<StyleRuleBase> createViewportRule();
 #endif
 
-    PassRefPtr<CSSPrimitiveValue> createPrimitiveNumericValue(CSSParserValue*);
-    PassRefPtr<CSSPrimitiveValue> createPrimitiveStringValue(CSSParserValue*);
+    PassRef<CSSPrimitiveValue> createPrimitiveNumericValue(CSSParserValue*);
+    PassRef<CSSPrimitiveValue> createPrimitiveStringValue(CSSParserValue*);
 
     static URL completeURL(const CSSParserContext&, const String& url);
 

Modified: trunk/Source/WebCore/css/CSSProperty.cpp (172535 => 172536)


--- trunk/Source/WebCore/css/CSSProperty.cpp	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/css/CSSProperty.cpp	2014-08-13 21:06:23 UTC (rev 172536)
@@ -49,9 +49,9 @@
 
 void CSSProperty::wrapValueInCommaSeparatedList()
 {
-    RefPtr<CSSValue> value = m_value.release();
-    m_value = CSSValueList::createCommaSeparated();
-    toCSSValueList(m_value.get())->append(value.release());
+    auto list = CSSValueList::createCommaSeparated();
+    list.get().append(m_value.releaseNonNull());
+    m_value = WTF::move(list);
 }
 
 enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide };

Modified: trunk/Source/WebCore/css/CSSValueList.cpp (172535 => 172536)


--- trunk/Source/WebCore/css/CSSValueList.cpp	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/css/CSSValueList.cpp	2014-08-13 21:06:23 UTC (rev 172536)
@@ -43,17 +43,23 @@
 {
     m_valueListSeparator = SpaceSeparator;
     m_values.reserveInitialCapacity(parserValues.size());
-    for (unsigned i = 0, size = parserValues.size(); i < size; ++i)
-        m_values.uncheckedAppend(parserValues.valueAt(i)->createCSSValue());
+    for (unsigned i = 0, size = parserValues.size(); i < size; ++i) {
+        RefPtr<CSSValue> value = parserValues.valueAt(i)->createCSSValue();
+        ASSERT(value);
+        m_values.uncheckedAppend(value.releaseNonNull());
+    }
 }
 
 bool CSSValueList::removeAll(CSSValue* val)
 {
+    // FIXME: Why even take a pointer?
+    if (!val)
+        return false;
+
     bool found = false;
-    for (size_t index = 0; index < m_values.size(); index++) {
-        RefPtr<CSSValue>& value = m_values.at(index);
-        if (value && val && value->equals(*val)) {
-            m_values.remove(index);
+    for (unsigned i = 0; i < m_values.size(); ++i) {
+        if (m_values[i].get().equals(*val)) {
+            m_values.remove(i);
             found = true;
         }
     }
@@ -63,9 +69,12 @@
 
 bool CSSValueList::hasValue(CSSValue* val) const
 {
-    for (size_t index = 0; index < m_values.size(); index++) {
-        const RefPtr<CSSValue>& value = m_values.at(index);
-        if (value && val && value->equals(*val))
+    // FIXME: Why even take a pointer?
+    if (!val)
+        return false;
+
+    for (unsigned i = 0, size = m_values.size(); i < size; ++i) {
+        if (m_values[i].get().equals(*val))
             return true;
     }
     return false;
@@ -87,8 +96,8 @@
     default:
         ASSERT_NOT_REACHED();
     }
-    for (size_t index = 0; index < m_values.size(); index++)
-        newList->append(m_values[index]);
+    for (unsigned i = 0, size = m_values.size(); i < size; ++i)
+        newList->append(m_values[i].get());
     return newList.release();
 }
 
@@ -110,11 +119,10 @@
         ASSERT_NOT_REACHED();
     }
 
-    unsigned size = m_values.size();
-    for (unsigned i = 0; i < size; i++) {
+    for (unsigned i = 0, size = m_values.size(); i < size; i++) {
         if (!result.isEmpty())
             result.append(separator);
-        result.append(m_values[i]->cssText());
+        result.append(m_values[i].get().cssText());
     }
 
     return result.toString();
@@ -122,7 +130,17 @@
 
 bool CSSValueList::equals(const CSSValueList& other) const
 {
-    return m_valueListSeparator == other.m_valueListSeparator && compareCSSValueVector<CSSValue>(m_values, other.m_values);
+    if (m_valueListSeparator != other.m_valueListSeparator)
+        return false;
+
+    if (m_values.size() != other.m_values.size())
+        return false;
+
+    for (unsigned i = 0, size = m_values.size(); i < size; ++i) {
+        if (!m_values[i].get().equals(other.m_values[i].get()))
+            return false;
+    }
+    return true;
 }
 
 bool CSSValueList::equals(const CSSValue& other) const
@@ -130,21 +148,19 @@
     if (m_values.size() != 1)
         return false;
 
-    const RefPtr<CSSValue>& value = m_values[0];
-    return value && value->equals(other);
+    return m_values[0].get().equals(other);
 }
 
 void CSSValueList::addSubresourceStyleURLs(ListHashSet<URL>& urls, const StyleSheetContents* styleSheet) const
 {
-    size_t size = m_values.size();
-    for (size_t i = 0; i < size; ++i)
-        m_values[i]->addSubresourceStyleURLs(urls, styleSheet);
+    for (unsigned i = 0, size = m_values.size(); i < size; ++i)
+        m_values[i].get().addSubresourceStyleURLs(urls, styleSheet);
 }
 
 bool CSSValueList::hasFailedOrCanceledSubresources() const
 {
     for (unsigned i = 0; i < m_values.size(); ++i) {
-        if (m_values[i]->hasFailedOrCanceledSubresources())
+        if (m_values[i].get().hasFailedOrCanceledSubresources())
             return true;
     }
     return false;
@@ -154,9 +170,9 @@
     : CSSValue(cloneFrom.classType(), /* isCSSOMSafe */ true)
 {
     m_valueListSeparator = cloneFrom.m_valueListSeparator;
-    m_values.resize(cloneFrom.m_values.size());
-    for (unsigned i = 0; i < m_values.size(); ++i)
-        m_values[i] = cloneFrom.m_values[i]->cloneForCSSOM();
+    m_values.reserveInitialCapacity(cloneFrom.m_values.size());
+    for (unsigned i = 0, size = cloneFrom.m_values.size(); i < size; ++i)
+        m_values.uncheckedAppend(*cloneFrom.m_values[i]->cloneForCSSOM());
 }
 
 PassRefPtr<CSSValueList> CSSValueList::cloneForCSSOM() const

Modified: trunk/Source/WebCore/css/CSSValueList.h (172535 => 172536)


--- trunk/Source/WebCore/css/CSSValueList.h	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/css/CSSValueList.h	2014-08-13 21:06:23 UTC (rev 172536)
@@ -49,13 +49,13 @@
     }
 
     size_t length() const { return m_values.size(); }
-    CSSValue* item(size_t index) { return index < m_values.size() ? m_values[index].get() : 0; }
-    const CSSValue* item(size_t index) const { return index < m_values.size() ? m_values[index].get() : 0; }
-    CSSValue* itemWithoutBoundsCheck(size_t index) { return m_values[index].get(); }
-    const CSSValue* itemWithoutBoundsCheck(size_t index) const { ASSERT(index < m_values.size()); return m_values[index].get(); }
+    CSSValue* item(size_t index) { return index < m_values.size() ? &m_values[index].get() : nullptr; }
+    const CSSValue* item(size_t index) const { return index < m_values.size() ? &m_values[index].get() : nullptr; }
+    CSSValue* itemWithoutBoundsCheck(size_t index) { return &m_values[index].get(); }
+    const CSSValue* itemWithoutBoundsCheck(size_t index) const { ASSERT(index < m_values.size()); return &m_values[index].get(); }
 
-    void append(PassRefPtr<CSSValue>);
-    void prepend(PassRefPtr<CSSValue>);
+    void append(PassRef<CSSValue>);
+    void prepend(PassRef<CSSValue>);
     bool removeAll(CSSValue*);
     bool hasValue(CSSValue*) const;
     PassRefPtr<CSSValueList> copy();
@@ -78,21 +78,19 @@
     explicit CSSValueList(ValueListSeparator);
     explicit CSSValueList(CSSParserValueList&);
 
-    Vector<RefPtr<CSSValue>, 4> m_values;
+    Vector<Ref<CSSValue>, 4> m_values;
 };
 
 CSS_VALUE_TYPE_CASTS(CSSValueList, isValueList())
 
-inline void CSSValueList::append(PassRefPtr<CSSValue> value)
+inline void CSSValueList::append(PassRef<CSSValue> value)
 {
-    ASSERT(value);
-    m_values.append(value);
+    m_values.append(WTF::move(value));
 }
 
-inline void CSSValueList::prepend(PassRefPtr<CSSValue> value)
+inline void CSSValueList::prepend(PassRef<CSSValue> value)
 {
-    ASSERT(value);
-    m_values.insert(0, value);
+    m_values.insert(0, WTF::move(value));
 }
 
 // Objects of this class are intended to be stack-allocated and scoped to a single function.

Modified: trunk/Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp (172535 => 172536)


--- trunk/Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp	2014-08-13 21:06:23 UTC (rev 172536)
@@ -40,25 +40,25 @@
     case PaintOrderNormal:
         return CSSPrimitiveValue::createIdentifier(CSSValueNormal);
     case PaintOrderFill:
-        paintOrderList->append(fill.release());
+        paintOrderList->append(fill.releaseNonNull());
         break;
     case PaintOrderFillMarkers:
-        paintOrderList->append(fill.release());
-        paintOrderList->append(markers.release());
+        paintOrderList->append(fill.releaseNonNull());
+        paintOrderList->append(markers.releaseNonNull());
         break;
     case PaintOrderStroke:
-        paintOrderList->append(stroke.release());
+        paintOrderList->append(stroke.releaseNonNull());
         break;
     case PaintOrderStrokeMarkers:
-        paintOrderList->append(stroke.release());
-        paintOrderList->append(markers.release());
+        paintOrderList->append(stroke.releaseNonNull());
+        paintOrderList->append(markers.releaseNonNull());
         break;
     case PaintOrderMarkers:
-        paintOrderList->append(markers.release());
+        paintOrderList->append(markers.releaseNonNull());
         break;
     case PaintOrderMarkersStroke:
-        paintOrderList->append(markers.release());
-        paintOrderList->append(stroke.release());
+        paintOrderList->append(markers.releaseNonNull());
+        paintOrderList->append(stroke.releaseNonNull());
         break;
     }
     return paintOrderList.release();

Modified: trunk/Source/WebCore/css/SVGCSSParser.cpp (172535 => 172536)


--- trunk/Source/WebCore/css/SVGCSSParser.cpp	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/css/SVGCSSParser.cpp	2014-08-13 21:06:23 UTC (rev 172536)
@@ -402,17 +402,17 @@
     case CSSValueFill:
         FALLTHROUGH;
     case CSSValueStroke:
-        paintOrderList->append(firstPaintOrderType == CSSValueFill ? fill.release() : stroke.release());
+        paintOrderList->append(firstPaintOrderType == CSSValueFill ? fill.releaseNonNull() : stroke.releaseNonNull());
         if (paintTypeList.size() > 1) {
             if (paintTypeList.at(1) == CSSValueMarkers)
-                paintOrderList->append(markers.release());
+                paintOrderList->append(markers.releaseNonNull());
         }
         break;
     case CSSValueMarkers:
-        paintOrderList->append(markers.release());
+        paintOrderList->append(markers.releaseNonNull());
         if (paintTypeList.size() > 1) {
             if (paintTypeList.at(1) == CSSValueStroke)
-                paintOrderList->append(stroke.release());
+                paintOrderList->append(stroke.releaseNonNull());
         }
         break;
     default:

Modified: trunk/Source/WebCore/editing/EditingStyle.cpp (172535 => 172536)


--- trunk/Source/WebCore/editing/EditingStyle.cpp	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/editing/EditingStyle.cpp	2014-08-13 21:06:23 UTC (rev 172536)
@@ -1051,10 +1051,10 @@
     RefPtr<CSSPrimitiveValue> lineThrough = cssValuePool().createIdentifierValue(CSSValueLineThrough);
 
     if (valueToMerge->hasValue(underline.get()) && !mergedValue->hasValue(underline.get()))
-        mergedValue->append(underline.get());
+        mergedValue->append(underline.releaseNonNull());
 
     if (valueToMerge->hasValue(lineThrough.get()) && !mergedValue->hasValue(lineThrough.get()))
-        mergedValue->append(lineThrough.get());
+        mergedValue->append(lineThrough.releaseNonNull());
 }
 
 void EditingStyle::mergeStyle(const StyleProperties* style, CSSPropertyOverrideMode mode)

Modified: trunk/Source/WebCore/editing/EditorCommand.cpp (172535 => 172536)


--- trunk/Source/WebCore/editing/EditorCommand.cpp	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/editing/EditorCommand.cpp	2014-08-13 21:06:23 UTC (rev 172536)
@@ -142,7 +142,7 @@
     if (selectedCSSValue->isValueList()) {
         RefPtr<CSSValueList> selectedCSSValueList = toCSSValueList(selectedCSSValue.get());
         if (!selectedCSSValueList->removeAll(value))
-            selectedCSSValueList->append(value);
+            selectedCSSValueList->append(*value);
         if (selectedCSSValueList->length())
             newStyle = selectedCSSValueList->cssText();
 

Modified: trunk/Source/WebCore/svg/SVGFontFaceSrcElement.cpp (172535 => 172536)


--- trunk/Source/WebCore/svg/SVGFontFaceSrcElement.cpp	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/svg/SVGFontFaceSrcElement.cpp	2014-08-13 21:06:23 UTC (rev 172536)
@@ -55,7 +55,7 @@
         else if (isSVGFontFaceNameElement(child))
             srcValue = toSVGFontFaceNameElement(child).srcValue();
         if (srcValue && srcValue->resource().length())
-            list->append(srcValue.release());
+            list->append(srcValue.releaseNonNull());
     }
     return list;
 }

Modified: trunk/Source/WebCore/svg/SVGLength.cpp (172535 => 172536)


--- trunk/Source/WebCore/svg/SVGLength.cpp	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/svg/SVGLength.cpp	2014-08-13 21:06:23 UTC (rev 172536)
@@ -335,7 +335,7 @@
     return length;
 }
 
-PassRefPtr<CSSPrimitiveValue> SVGLength::toCSSPrimitiveValue(const SVGLength& length)
+PassRef<CSSPrimitiveValue> SVGLength::toCSSPrimitiveValue(const SVGLength& length)
 {
     CSSPrimitiveValue::UnitTypes cssType = CSSPrimitiveValue::CSS_UNKNOWN;
     switch (length.unitType()) {

Modified: trunk/Source/WebCore/svg/SVGLength.h (172535 => 172536)


--- trunk/Source/WebCore/svg/SVGLength.h	2014-08-13 20:31:34 UTC (rev 172535)
+++ trunk/Source/WebCore/svg/SVGLength.h	2014-08-13 21:06:23 UTC (rev 172536)
@@ -99,7 +99,7 @@
     }
 
     static SVGLength fromCSSPrimitiveValue(CSSPrimitiveValue*);
-    static PassRefPtr<CSSPrimitiveValue> toCSSPrimitiveValue(const SVGLength&);
+    static PassRef<CSSPrimitiveValue> toCSSPrimitiveValue(const SVGLength&);
     static SVGLengthMode lengthModeForAnimatedLengthAttribute(const QualifiedName&);
 
     SVGLength blend(const SVGLength& from, float progress) const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to