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

Unified Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 209433004: Do not zero-initialize RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments. Created 6 years, 9 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/parser/CSSPropertyParser.h ('k') | Source/core/dom/StyleEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/CSSPropertyParser.cpp
diff --git a/Source/core/css/parser/CSSPropertyParser.cpp b/Source/core/css/parser/CSSPropertyParser.cpp
index de115bb91133da23bbbc11178ebc7941aec60aa2..8423cd01ccbd09c431ae9edcc1d7edafb57f9ba8 100644
--- a/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/Source/core/css/parser/CSSPropertyParser.cpp
@@ -493,7 +493,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
}
bool validPrimitive = false;
- RefPtrWillBeRawPtr<CSSValue> parsedValue;
+ RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
switch (propId) {
case CSSPropertySize: // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ]
@@ -534,7 +534,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
if (num != 1 || !parseValue(CSSPropertyOverflowY, important))
return false;
- RefPtrWillBeRawPtr<CSSValue> overflowXValue;
+ RefPtrWillBeRawPtr<CSSValue> overflowXValue = nullptr;
// FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y. If this value has been
// set using the shorthand, then for now overflow-x will default to auto, but once we implement
@@ -629,7 +629,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
// ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | text | wait | help |
// vertical-text | cell | context-menu | alias | copy | no-drop | not-allowed | -webkit-zoom-in
// -webkit-zoom-out | all-scroll | -webkit-grab | -webkit-grabbing ] ] | inherit
- RefPtrWillBeRawPtr<CSSValueList> list;
+ RefPtrWillBeRawPtr<CSSValueList> list = nullptr;
while (value) {
RefPtrWillBeRawPtr<CSSValue> image = nullptr;
if (value->unit == CSSPrimitiveValue::CSS_URI) {
@@ -722,8 +722,8 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
case CSSPropertyWebkitMaskRepeatX:
case CSSPropertyWebkitMaskRepeatY:
{
- RefPtrWillBeRawPtr<CSSValue> val1;
- RefPtrWillBeRawPtr<CSSValue> val2;
+ RefPtrWillBeRawPtr<CSSValue> val1 = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> val2 = nullptr;
CSSPropertyID propId1, propId2;
bool result = false;
if (parseFillProperty(propId, propId1, propId2, val1, val2)) {
@@ -949,7 +949,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
case CSSPropertyBorderImageOutset:
case CSSPropertyWebkitMaskBoxImageOutset: {
- RefPtrWillBeRawPtr<CSSPrimitiveValue> result;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> result = nullptr;
if (parseBorderImageOutset(result)) {
addProperty(propId, result, important);
return true;
@@ -958,7 +958,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
}
case CSSPropertyBorderImageRepeat:
case CSSPropertyWebkitMaskBoxImageRepeat: {
- RefPtrWillBeRawPtr<CSSValue> result;
+ RefPtrWillBeRawPtr<CSSValue> result = nullptr;
if (parseBorderImageRepeat(result)) {
addProperty(propId, result, important);
return true;
@@ -967,7 +967,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
}
case CSSPropertyBorderImageSlice:
case CSSPropertyWebkitMaskBoxImageSlice: {
- RefPtrWillBeRawPtr<CSSBorderImageSliceValue> result;
+ RefPtrWillBeRawPtr<CSSBorderImageSliceValue> result = nullptr;
if (parseBorderImageSlice(propId, result)) {
addProperty(propId, result, important);
return true;
@@ -976,7 +976,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
}
case CSSPropertyBorderImageWidth:
case CSSPropertyWebkitMaskBoxImageWidth: {
- RefPtrWillBeRawPtr<CSSPrimitiveValue> result;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> result = nullptr;
if (parseBorderImageWidth(result)) {
addProperty(propId, result, important);
return true;
@@ -993,7 +993,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
if (!validPrimitive)
return false;
RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = createPrimitiveNumericValue(value);
- RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2 = nullptr;
if (num == 2) {
value = m_valueList->next();
validPrimitive = validUnit(value, FLength | FPercent | FNonNeg);
@@ -1120,9 +1120,9 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
case CSSPropertyWebkitTransformOriginX:
case CSSPropertyWebkitTransformOriginY:
case CSSPropertyWebkitTransformOriginZ: {
- RefPtrWillBeRawPtr<CSSValue> val1;
- RefPtrWillBeRawPtr<CSSValue> val2;
- RefPtrWillBeRawPtr<CSSValue> val3;
+ RefPtrWillBeRawPtr<CSSValue> val1 = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> val2 = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> val3 = nullptr;
CSSPropertyID propId1, propId2, propId3;
if (parseTransformOrigin(propId, propId1, propId2, propId3, val1, val2, val3)) {
addProperty(propId1, val1.release(), important);
@@ -1152,8 +1152,8 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
case CSSPropertyWebkitPerspectiveOrigin:
case CSSPropertyWebkitPerspectiveOriginX:
case CSSPropertyWebkitPerspectiveOriginY: {
- RefPtrWillBeRawPtr<CSSValue> val1;
- RefPtrWillBeRawPtr<CSSValue> val2;
+ RefPtrWillBeRawPtr<CSSValue> val1 = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> val2 = nullptr;
CSSPropertyID propId1, propId2;
if (parsePerspectiveOrigin(propId, propId1, propId2, val1, val2)) {
addProperty(propId1, val1.release(), important);
@@ -1189,7 +1189,7 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
case CSSPropertyWebkitTransitionDuration:
case CSSPropertyWebkitTransitionTimingFunction:
case CSSPropertyWebkitTransitionProperty: {
- RefPtrWillBeRawPtr<CSSValue> val;
+ RefPtrWillBeRawPtr<CSSValue> val = nullptr;
AnimationParseContext context;
if (parseAnimationProperty(propId, val, context)) {
addPropertyWithPrefixingVariant(propId, val.release(), important);
@@ -1669,9 +1669,13 @@ bool CSSPropertyParser::parseFillShorthand(CSSPropertyID propId, const CSSProper
bool parsedProperty[cMaxFillProperties] = { false };
RefPtrWillBeRawPtr<CSSValue> values[cMaxFillProperties];
- RefPtrWillBeRawPtr<CSSValue> clipValue;
- RefPtrWillBeRawPtr<CSSValue> positionYValue;
- RefPtrWillBeRawPtr<CSSValue> repeatYValue;
+#if ENABLE(OILPAN)
+ // Zero initialize the array of raw pointers.
+ memset(&values, 0, sizeof(values));
+#endif
+ RefPtrWillBeRawPtr<CSSValue> clipValue = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> positionYValue = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> repeatYValue = nullptr;
bool foundClip = false;
int i;
bool foundPositionCSSProperty = false;
@@ -1720,8 +1724,8 @@ bool CSSPropertyParser::parseFillShorthand(CSSPropertyID propId, const CSSProper
continue;
if (!parsedProperty[i]) {
- RefPtrWillBeRawPtr<CSSValue> val1;
- RefPtrWillBeRawPtr<CSSValue> val2;
+ RefPtrWillBeRawPtr<CSSValue> val1 = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> val2 = nullptr;
CSSPropertyID propId1, propId2;
CSSParserValue* parserValue = m_valueList->current();
// parseFillProperty() may modify m_implicitShorthand, so we MUST reset it
@@ -1841,6 +1845,10 @@ bool CSSPropertyParser::parseAnimationShorthand(CSSPropertyID propId, bool impor
bool parsedProperty[numProperties] = { false };
AnimationParseContext context;
RefPtrWillBeRawPtr<CSSValue> values[numProperties];
+#if ENABLE(OILPAN)
+ // Zero initialize the array of raw pointers.
+ memset(&values, 0, sizeof(values));
+#endif
unsigned i;
while (m_valueList->current()) {
@@ -1861,7 +1869,7 @@ bool CSSPropertyParser::parseAnimationShorthand(CSSPropertyID propId, bool impor
bool found = false;
for (i = 0; i < numProperties; ++i) {
if (!parsedProperty[i]) {
- RefPtrWillBeRawPtr<CSSValue> val;
+ RefPtrWillBeRawPtr<CSSValue> val = nullptr;
if (parseAnimationProperty(animationProperties.properties()[i], val, context)) {
parsedProperty[i] = found = true;
addAnimationValue(values[i], val.release());
@@ -1901,6 +1909,10 @@ bool CSSPropertyParser::parseTransitionShorthand(CSSPropertyID propId, bool impo
bool parsedProperty[numProperties] = { false };
AnimationParseContext context;
RefPtrWillBeRawPtr<CSSValue> values[numProperties];
+#if ENABLE(OILPAN)
+ // Zero initialize the array of raw pointers.
+ memset(&values, 0, sizeof(values));
+#endif
unsigned i;
while (m_valueList->current()) {
@@ -1921,7 +1933,7 @@ bool CSSPropertyParser::parseTransitionShorthand(CSSPropertyID propId, bool impo
bool found = false;
for (i = 0; !found && i < numProperties; ++i) {
if (!parsedProperty[i]) {
- RefPtrWillBeRawPtr<CSSValue> val;
+ RefPtrWillBeRawPtr<CSSValue> val = nullptr;
if (parseAnimationProperty(shorthand.properties()[i], val, context)) {
parsedProperty[i] = found = true;
addAnimationValue(values[i], val.release());
@@ -1980,8 +1992,8 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseColumnCount()
bool CSSPropertyParser::parseColumnsShorthand(bool important)
{
- RefPtrWillBeRawPtr<CSSValue> columnWidth;
- RefPtrWillBeRawPtr<CSSValue> columnCount;
+ RefPtrWillBeRawPtr<CSSValue> columnWidth = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> columnCount = nullptr;
bool hasPendingExplicitAuto = false;
for (unsigned propertiesParsed = 0; CSSParserValue* value = m_valueList->current(); propertiesParsed++) {
@@ -2239,7 +2251,7 @@ bool CSSPropertyParser::parseQuotes(CSSPropertyID propId, bool important)
{
RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
while (CSSParserValue* val = m_valueList->current()) {
- RefPtrWillBeRawPtr<CSSValue> parsedValue;
+ RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
if (val->unit == CSSPrimitiveValue::CSS_STRING)
parsedValue = CSSPrimitiveValue::create(val->string, CSSPrimitiveValue::CSS_STRING);
else
@@ -2263,7 +2275,7 @@ bool CSSPropertyParser::parseContent(CSSPropertyID propId, bool important)
RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
while (CSSParserValue* val = m_valueList->current()) {
- RefPtrWillBeRawPtr<CSSValue> parsedValue;
+ RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
if (val->unit == CSSPrimitiveValue::CSS_URI) {
// url
parsedValue = CSSImageValue::create(val->string, completeURL(val->string));
@@ -2579,8 +2591,8 @@ void CSSPropertyParser::parse3ValuesFillPosition(CSSParserValueList* valueList,
value1 = createPrimitiveValuePair(parsedValue1, parsedValue2);
value2 = createPrimitiveValuePair(cssValuePool().createIdentifierValue(secondPositionKeyword), cssValuePool().createValue(50, CSSPrimitiveValue::CSS_PERCENTAGE));
} else {
- RefPtrWillBeRawPtr<CSSPrimitiveValue> firstPositionValue;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> secondPositionValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> firstPositionValue = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> secondPositionValue = nullptr;
if (isFillPositionKeyword(ident2)) {
// To match CSS grammar, we should only accept: [ center | left | right | bottom | top ] [ left | right | top | bottom ] [ <percentage> | <length> ].
@@ -2781,7 +2793,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseFillSize(CSSPropertyID
if (value->id == CSSValueContain || value->id == CSSValueCover)
return cssValuePool().createIdentifierValue(value->id);
- RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue1 = nullptr;
if (value->id == CSSValueAuto)
parsedValue1 = cssValuePool().createIdentifierValue(CSSValueAuto);
@@ -2791,7 +2803,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseFillSize(CSSPropertyID
parsedValue1 = createPrimitiveNumericValue(value);
}
- RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue2 = nullptr;
if ((value = m_valueList->next())) {
if (value->unit == CSSParserValue::Operator && value->iValue == ',')
allowComma = false;
@@ -2819,11 +2831,11 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseFillSize(CSSPropertyID
bool CSSPropertyParser::parseFillProperty(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2,
RefPtrWillBeRawPtr<CSSValue>& retValue1, RefPtrWillBeRawPtr<CSSValue>& retValue2)
{
- RefPtrWillBeRawPtr<CSSValueList> values;
- RefPtrWillBeRawPtr<CSSValueList> values2;
+ RefPtrWillBeRawPtr<CSSValueList> values = nullptr;
+ RefPtrWillBeRawPtr<CSSValueList> values2 = nullptr;
CSSParserValue* val;
- RefPtrWillBeRawPtr<CSSValue> value;
- RefPtrWillBeRawPtr<CSSValue> value2;
+ RefPtrWillBeRawPtr<CSSValue> value = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> value2 = nullptr;
bool allowComma = false;
@@ -2845,8 +2857,8 @@ bool CSSPropertyParser::parseFillProperty(CSSPropertyID propId, CSSPropertyID& p
}
while ((val = m_valueList->current())) {
- RefPtrWillBeRawPtr<CSSValue> currValue;
- RefPtrWillBeRawPtr<CSSValue> currValue2;
+ RefPtrWillBeRawPtr<CSSValue> currValue = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> currValue2 = nullptr;
if (allowComma) {
if (!isComma(val))
@@ -3206,15 +3218,15 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationTimingFunction
bool CSSPropertyParser::parseAnimationProperty(CSSPropertyID propId, RefPtrWillBeRawPtr<CSSValue>& result, AnimationParseContext& context)
{
- RefPtrWillBeRawPtr<CSSValueList> values;
+ RefPtrWillBeRawPtr<CSSValueList> values = nullptr;
CSSParserValue* val;
- RefPtrWillBeRawPtr<CSSValue> value;
+ RefPtrWillBeRawPtr<CSSValue> value = nullptr;
bool allowComma = false;
result = nullptr;
while ((val = m_valueList->current())) {
- RefPtrWillBeRawPtr<CSSValue> currValue;
+ RefPtrWillBeRawPtr<CSSValue> currValue = nullptr;
if (allowComma) {
if (!isComma(val))
return false;
@@ -3365,8 +3377,8 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridPosition()
return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRING);
}
- RefPtrWillBeRawPtr<CSSPrimitiveValue> numericValue;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> gridLineName;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> numericValue = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> gridLineName = nullptr;
bool hasSeenSpanKeyword = false;
if (parseIntegerOrStringFromGridPosition(numericValue, gridLineName)) {
@@ -3423,7 +3435,7 @@ bool CSSPropertyParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId
if (!startValue)
return false;
- RefPtrWillBeRawPtr<CSSValue> endValue;
+ RefPtrWillBeRawPtr<CSSValue> endValue = nullptr;
if (m_valueList->current()) {
if (!isForwardSlashOperator(m_valueList->current()))
return false;
@@ -3455,15 +3467,15 @@ bool CSSPropertyParser::parseGridAreaShorthand(bool important)
if (!rowStartValue)
return false;
- RefPtrWillBeRawPtr<CSSValue> columnStartValue;
+ RefPtrWillBeRawPtr<CSSValue> columnStartValue = nullptr;
if (!parseSingleGridAreaLonghand(columnStartValue))
return false;
- RefPtrWillBeRawPtr<CSSValue> rowEndValue;
+ RefPtrWillBeRawPtr<CSSValue> rowEndValue = nullptr;
if (!parseSingleGridAreaLonghand(rowEndValue))
return false;
- RefPtrWillBeRawPtr<CSSValue> columnEndValue;
+ RefPtrWillBeRawPtr<CSSValue> columnEndValue = nullptr;
if (!parseSingleGridAreaLonghand(columnEndValue))
return false;
@@ -3747,7 +3759,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounterContent(CSSParse
return nullptr;
RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = createPrimitiveStringValue(i);
- RefPtrWillBeRawPtr<CSSPrimitiveValue> separator;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> separator = nullptr;
if (!counters)
separator = cssValuePool().createValue(String(), CSSPrimitiveValue::CSS_STRING);
else {
@@ -3762,7 +3774,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounterContent(CSSParse
separator = createPrimitiveStringValue(i);
}
- RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = nullptr;
i = args->next();
if (!i) // Make the list style default decimal
listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal);
@@ -3868,6 +3880,10 @@ PassRefPtrWillBeRawPtr<CSSBasicShape> CSSPropertyParser::parseInsetRoundedCorner
// FIXME: Refactor completeBorderRadii and the array
RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[2][4];
+#if ENABLE(OILPAN)
+ // Zero initialize the array of raw pointers.
+ memset(&radii, 0, sizeof(radii));
+#endif
unsigned indexAfterSlash = 0;
for (unsigned i = 0; i < num; ++i) {
@@ -4060,8 +4076,8 @@ PassRefPtrWillBeRawPtr<CSSBasicShape> CSSPropertyParser::parseBasicShapeCircle(C
}
if (argument->id == CSSValueAt && args->next()) {
- RefPtrWillBeRawPtr<CSSValue> centerX;
- RefPtrWillBeRawPtr<CSSValue> centerY;
+ RefPtrWillBeRawPtr<CSSValue> centerX = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> centerY = nullptr;
parseFillPosition(args, centerX, centerY);
if (centerX && centerY && !args->current()) {
ASSERT(centerX->isPrimitiveValue());
@@ -4112,8 +4128,8 @@ PassRefPtrWillBeRawPtr<CSSBasicShape> CSSPropertyParser::parseBasicShapeEllipse(
if (argument->id != CSSValueAt || !args->next()) // expecting ellipse(.. at <position>)
return nullptr;
- RefPtrWillBeRawPtr<CSSValue> centerX;
- RefPtrWillBeRawPtr<CSSValue> centerY;
+ RefPtrWillBeRawPtr<CSSValue> centerX = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> centerY = nullptr;
parseFillPosition(args, centerX, centerY);
if (!centerX || !centerY || args->current())
return nullptr;
@@ -4200,8 +4216,6 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseShapeProperty(CSSProper
CSSParserValue* value = m_valueList->current();
CSSValueID valueId = value->id;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> boxValue;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue;
if (valueId == CSSValueNone
|| (valueId == CSSValueOutsideShape && propId == CSSPropertyShapeInside)) {
@@ -4210,7 +4224,7 @@ PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseShapeProperty(CSSProper
return keywordValue.release();
}
- RefPtrWillBeRawPtr<CSSValue> imageValue;
+ RefPtrWillBeRawPtr<CSSValue> imageValue = nullptr;
if (valueId != CSSValueNone && parseFillImage(m_valueList.get(), imageValue)) {
m_valueList->next();
return imageValue.release();
@@ -4264,7 +4278,7 @@ PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseBasicShape()
if (!args)
return nullptr;
- RefPtrWillBeRawPtr<CSSBasicShape> shape;
+ RefPtrWillBeRawPtr<CSSBasicShape> shape = nullptr;
if (equalIgnoringCase(value->function->name, "circle("))
shape = parseBasicShapeCircle(args);
else if (equalIgnoringCase(value->function->name, "ellipse("))
@@ -4497,13 +4511,13 @@ bool CSSPropertyParser::parseFontSize(bool important)
bool CSSPropertyParser::parseFontVariant(bool important)
{
- RefPtrWillBeRawPtr<CSSValueList> values;
+ RefPtrWillBeRawPtr<CSSValueList> values = nullptr;
if (m_valueList->size() > 1)
values = CSSValueList::createCommaSeparated();
CSSParserValue* val;
bool expectComma = false;
while ((val = m_valueList->current())) {
- RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue = nullptr;
if (!expectComma) {
expectComma = true;
if (val->id == CSSValueNormal || val->id == CSSValueSmallCaps)
@@ -5328,13 +5342,13 @@ public:
CSSPropertyID property;
CSSPropertyParser* m_parser;
- RefPtrWillBeRawPtr<CSSValueList> values;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> x;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> y;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> blur;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> spread;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> style;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> color;
+ RefPtrWillBeRawPtr<CSSValueList> values = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> x = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> y = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> blur = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> spread = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> style = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> color = nullptr;
haraken 2014/03/24 14:39:06 These should be RefPtrWillBeMembers.
zerny-chromium 2014/03/24 14:41:41 QQ: where these not caught by the current plugin T
Mads Ager (chromium) 2014/03/24 14:43:16 Look at the rebased version. They are Members now.
zerny-chromium 2014/03/24 14:45:06 Ah, good. I did my review on that and incorrectly
bool allowX;
bool allowY;
@@ -5377,7 +5391,7 @@ PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseShadow(CSSParserVal
context.commitStyle(val);
} else {
// The only other type of value that's ok is a color value.
- RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedColor;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedColor = nullptr;
bool isColor = ((val->id >= CSSValueAqua && val->id <= CSSValueWindowtext) || val->id == CSSValueMenu
|| (val->id >= CSSValueWebkitFocusRingColor && val->id <= CSSValueWebkitText && inQuirksMode())
|| val->id == CSSValueCurrentcolor);
@@ -5416,7 +5430,7 @@ bool CSSPropertyParser::parseReflect(CSSPropertyID propId, bool important)
// Direction comes first.
CSSParserValue* val = m_valueList->current();
- RefPtrWillBeRawPtr<CSSPrimitiveValue> direction;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> direction = nullptr;
switch (val->id) {
case CSSValueAbove:
case CSSValueBelow:
@@ -5430,7 +5444,7 @@ bool CSSPropertyParser::parseReflect(CSSPropertyID propId, bool important)
// The offset comes next.
val = m_valueList->next();
- RefPtrWillBeRawPtr<CSSPrimitiveValue> offset;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> offset = nullptr;
if (!val)
offset = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX);
else {
@@ -5440,7 +5454,7 @@ bool CSSPropertyParser::parseReflect(CSSPropertyID propId, bool important)
}
// Now for the mask.
- RefPtrWillBeRawPtr<CSSValue> mask;
+ RefPtrWillBeRawPtr<CSSValue> mask = nullptr;
val = m_valueList->next();
if (val) {
mask = parseBorderImage(propId);
@@ -5461,7 +5475,7 @@ bool CSSPropertyParser::parseFlex(CSSParserValueList* args, bool important)
static const double unsetValue = -1;
double flexGrow = unsetValue;
double flexShrink = unsetValue;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> flexBasis;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> flexBasis = nullptr;
while (CSSParserValue* arg = args->current()) {
if (validUnit(arg, FNumber | FNonNeg)) {
@@ -5500,8 +5514,8 @@ bool CSSPropertyParser::parseFlex(CSSParserValueList* args, bool important)
bool CSSPropertyParser::parseObjectPosition(bool important)
{
- RefPtrWillBeRawPtr<CSSValue> xValue;
- RefPtrWillBeRawPtr<CSSValue> yValue;
+ RefPtrWillBeRawPtr<CSSValue> xValue = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> yValue = nullptr;
parseFillPosition(m_valueList.get(), xValue, yValue);
if (!xValue || !yValue)
return false;
@@ -5513,7 +5527,7 @@ bool CSSPropertyParser::parseObjectPosition(bool important)
}
class BorderImageParseContext {
- DISALLOW_ALLOCATION();
+ STACK_ALLOCATED();
public:
BorderImageParseContext()
: m_canAdvance(false)
@@ -5598,24 +5612,24 @@ public:
PassRefPtrWillBeRawPtr<CSSValue> commitCSSValue()
{
- return createBorderImageValue(m_image, m_imageSlice, m_borderSlice, m_outset, m_repeat);
+ return createBorderImageValue(m_image, m_imageSlice.get(), m_borderSlice.get(), m_outset.get(), m_repeat.get());
}
void commitMaskBoxImage(CSSPropertyParser* parser, bool important)
{
commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageSource, parser, m_image, important);
- commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageSlice, parser, m_imageSlice, important);
- commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageWidth, parser, m_borderSlice, important);
- commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageOutset, parser, m_outset, important);
- commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageRepeat, parser, m_repeat, important);
+ commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageSlice, parser, m_imageSlice.get(), important);
+ commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageWidth, parser, m_borderSlice.get(), important);
+ commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageOutset, parser, m_outset.get(), important);
+ commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageRepeat, parser, m_repeat.get(), important);
}
void commitBorderImage(CSSPropertyParser* parser, bool important)
{
commitBorderImageProperty(CSSPropertyBorderImageSource, parser, m_image, important);
- commitBorderImageProperty(CSSPropertyBorderImageSlice, parser, m_imageSlice, important);
- commitBorderImageProperty(CSSPropertyBorderImageWidth, parser, m_borderSlice, important);
- commitBorderImageProperty(CSSPropertyBorderImageOutset, parser, m_outset, important);
+ commitBorderImageProperty(CSSPropertyBorderImageSlice, parser, m_imageSlice.get(), important);
+ commitBorderImageProperty(CSSPropertyBorderImageWidth, parser, m_borderSlice.get(), important);
+ commitBorderImageProperty(CSSPropertyBorderImageOutset, parser, m_outset.get(), important);
commitBorderImageProperty(CSSPropertyBorderImageRepeat, parser, m_repeat, important);
}
@@ -5640,12 +5654,12 @@ public:
bool m_requireWidth;
bool m_requireOutset;
- RefPtrWillBeRawPtr<CSSValue> m_image;
- RefPtrWillBeRawPtr<CSSBorderImageSliceValue> m_imageSlice;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> m_borderSlice;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> m_outset;
+ RefPtrWillBeMember<CSSValue> m_image;
+ RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_borderSlice;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_outset;
- RefPtrWillBeRawPtr<CSSValue> m_repeat;
+ RefPtrWillBeMember<CSSValue> m_repeat;
};
bool BorderImageParseContext::buildFromParser(CSSPropertyParser& parser, CSSPropertyID propId, BorderImageParseContext& context)
@@ -5661,7 +5675,7 @@ bool BorderImageParseContext::buildFromParser(CSSPropertyParser& parser, CSSProp
if (val->unit == CSSPrimitiveValue::CSS_URI) {
context.commitImage(CSSImageValue::create(val->string, parser.m_context.completeURL(val->string)));
} else if (isGeneratedImageValue(val)) {
- RefPtrWillBeRawPtr<CSSValue> value;
+ RefPtrWillBeRawPtr<CSSValue> value = nullptr;
if (parser.parseGeneratedImage(parser.m_valueList.get(), value))
context.commitImage(value.release());
else
@@ -5677,25 +5691,25 @@ bool BorderImageParseContext::buildFromParser(CSSPropertyParser& parser, CSSProp
}
if (!context.canAdvance() && context.allowImageSlice()) {
- RefPtrWillBeRawPtr<CSSBorderImageSliceValue> imageSlice;
+ RefPtrWillBeRawPtr<CSSBorderImageSliceValue> imageSlice = nullptr;
if (parser.parseBorderImageSlice(propId, imageSlice))
context.commitImageSlice(imageSlice.release());
}
if (!context.canAdvance() && context.allowRepeat()) {
- RefPtrWillBeRawPtr<CSSValue> repeat;
+ RefPtrWillBeRawPtr<CSSValue> repeat = nullptr;
if (parser.parseBorderImageRepeat(repeat))
context.commitRepeat(repeat.release());
}
if (!context.canAdvance() && context.requireWidth()) {
- RefPtrWillBeRawPtr<CSSPrimitiveValue> borderSlice;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> borderSlice = nullptr;
if (parser.parseBorderImageWidth(borderSlice))
context.commitBorderWidth(borderSlice.release());
}
if (!context.canAdvance() && context.requireOutset()) {
- RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr;
if (parser.parseBorderImageOutset(borderOutset))
context.commitBorderOutset(borderOutset.release());
}
@@ -5744,8 +5758,8 @@ static bool isBorderImageRepeatKeyword(int id)
bool CSSPropertyParser::parseBorderImageRepeat(RefPtrWillBeRawPtr<CSSValue>& result)
{
- RefPtrWillBeRawPtr<CSSPrimitiveValue> firstValue;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> secondValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> firstValue = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> secondValue = nullptr;
CSSParserValue* val = m_valueList->current();
if (!val)
return false;
@@ -5844,10 +5858,10 @@ private:
bool m_allowFill;
bool m_allowFinalCommit;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_top;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_right;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_bottom;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_left;
bool m_fill;
};
@@ -5904,7 +5918,7 @@ public:
void commitNumber(CSSParserValue* v)
{
- RefPtrWillBeRawPtr<CSSPrimitiveValue> val;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> val = nullptr;
if (v->id == CSSValueAuto)
val = cssValuePool().createIdentifierValue(v->id);
else
@@ -5961,10 +5975,10 @@ private:
bool m_allowNumber;
bool m_allowFinalCommit;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> m_top;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> m_right;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> m_bottom;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> m_left;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_top;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_right;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_bottom;
+ RefPtrWillBeMember<CSSPrimitiveValue> m_left;
};
bool CSSPropertyParser::parseBorderImageQuad(Units validUnits, RefPtrWillBeRawPtr<CSSPrimitiveValue>& result)
@@ -6011,6 +6025,10 @@ bool CSSPropertyParser::parseBorderRadius(CSSPropertyID propId, bool important)
ShorthandScope scope(this, propId);
RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[2][4];
+#if ENABLE(OILPAN)
+ // Zero initialize the array of raw pointers.
+ memset(&radii, 0, sizeof(radii));
+#endif
unsigned indexAfterSlash = 0;
for (unsigned i = 0; i < num; ++i) {
@@ -6096,7 +6114,7 @@ bool CSSPropertyParser::parseCounter(CSSPropertyID propId, int defaultValue, boo
enum { ID, VAL } state = ID;
RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
- RefPtrWillBeRawPtr<CSSPrimitiveValue> counterName;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> counterName = nullptr;
while (true) {
CSSParserValue* val = m_valueList->current();
@@ -6136,7 +6154,7 @@ bool CSSPropertyParser::parseCounter(CSSPropertyID propId, int defaultValue, boo
// This should go away once we drop support for -webkit-gradient
static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseDeprecatedGradientPoint(CSSParserValue* a, bool horizontal)
{
- RefPtrWillBeRawPtr<CSSPrimitiveValue> result;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> result = nullptr;
if (a->unit == CSSPrimitiveValue::CSS_IDENT) {
if ((equalIgnoringCase(a, "left") && horizontal)
|| (equalIgnoringCase(a, "top") && !horizontal))
@@ -6234,7 +6252,7 @@ bool CSSPropertyParser::parseDeprecatedGradient(CSSParserValueList* valueList, R
else
return false;
- RefPtrWillBeRawPtr<CSSGradientValue> result;
+ RefPtrWillBeRawPtr<CSSGradientValue> result = nullptr;
switch (gradientType) {
case CSSDeprecatedLinearGradient:
result = CSSLinearGradientValue::create(NonRepeating, gradientType);
@@ -6399,9 +6417,10 @@ bool CSSPropertyParser::parseDeprecatedLinearGradient(CSSParserValueList* valueL
expectComma = true;
} else {
// Look one or two optional keywords that indicate a side or corner.
- RefPtrWillBeRawPtr<CSSPrimitiveValue> startX, startY;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> startX = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> startY = nullptr;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> location;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> location = nullptr;
bool isHorizontal = false;
if ((location = valueFromSideKeyword(a, isHorizontal))) {
if (isHorizontal)
@@ -6461,8 +6480,8 @@ bool CSSPropertyParser::parseDeprecatedRadialGradient(CSSParserValueList* valueL
bool expectComma = false;
// Optional background-position
- RefPtrWillBeRawPtr<CSSValue> centerX;
- RefPtrWillBeRawPtr<CSSValue> centerY;
+ RefPtrWillBeRawPtr<CSSValue> centerX = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> centerY = nullptr;
// parse2ValuesFillPosition advances the args next pointer.
parse2ValuesFillPosition(args, centerX, centerY);
a = args->current();
@@ -6485,8 +6504,8 @@ bool CSSPropertyParser::parseDeprecatedRadialGradient(CSSParserValueList* valueL
result->setFirstY(toCSSPrimitiveValue(centerY.get()));
result->setSecondY(toCSSPrimitiveValue(centerY.get()));
- RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue = nullptr;
// Optional shape and/or size in any order.
for (int i = 0; i < 2; ++i) {
@@ -6526,8 +6545,8 @@ bool CSSPropertyParser::parseDeprecatedRadialGradient(CSSParserValueList* valueL
result->setSizingBehavior(sizeValue);
// Or, two lengths or percentages
- RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize = nullptr;
if (!shapeValue && !sizeValue) {
if (validUnit(a, FLength | FPercent)) {
@@ -6588,8 +6607,9 @@ bool CSSPropertyParser::parseLinearGradient(CSSParserValueList* valueList, RefPt
if (!a)
return false;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> endX, endY;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> location;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> endX = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> endY = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> location = nullptr;
bool isHorizontal = false;
location = valueFromSideKeyword(a, isHorizontal);
@@ -6649,10 +6669,10 @@ bool CSSPropertyParser::parseRadialGradient(CSSParserValueList* valueList, RefPt
bool expectComma = false;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> shapeValue = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> sizeValue = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalSize = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalSize = nullptr;
// First part of grammar, the size/shape clause:
// [ circle || <length> ] |
@@ -6727,8 +6747,8 @@ bool CSSPropertyParser::parseRadialGradient(CSSParserValueList* valueList, RefPt
// Second part of grammar, the center-position clause:
// at <position>
- RefPtrWillBeRawPtr<CSSValue> centerX;
- RefPtrWillBeRawPtr<CSSValue> centerY;
+ RefPtrWillBeRawPtr<CSSValue> centerX = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> centerY = nullptr;
if (a->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(a, "at")) {
a = args->next();
if (!a)
@@ -6865,8 +6885,8 @@ bool CSSPropertyParser::parseCrossfade(CSSParserValueList* valueList, RefPtrWill
if (!args || args->size() != 5)
return false;
CSSParserValue* a = args->current();
- RefPtrWillBeRawPtr<CSSValue> fromImageValue;
- RefPtrWillBeRawPtr<CSSValue> toImageValue;
+ RefPtrWillBeRawPtr<CSSValue> fromImageValue = nullptr;
+ RefPtrWillBeRawPtr<CSSValue> toImageValue = nullptr;
// The first argument is the "from" image. It is a fill image.
if (!a || !parseFillImage(args, fromImageValue))
@@ -6889,7 +6909,7 @@ bool CSSPropertyParser::parseCrossfade(CSSParserValueList* valueList, RefPtrWill
a = args->next();
// The third argument is the crossfade value. It is a percentage or a fractional number.
- RefPtrWillBeRawPtr<CSSPrimitiveValue> percentage;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> percentage = nullptr;
if (!a)
return false;
@@ -7406,8 +7426,8 @@ bool CSSPropertyParser::parseTextEmphasisStyle(bool important)
{
unsigned valueListSize = m_valueList->size();
- RefPtrWillBeRawPtr<CSSPrimitiveValue> fill;
- RefPtrWillBeRawPtr<CSSPrimitiveValue> shape;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> fill = nullptr;
+ RefPtrWillBeRawPtr<CSSPrimitiveValue> shape = nullptr;
for (CSSParserValue* value = m_valueList->current(); value; value = m_valueList->next()) {
if (value->unit == CSSPrimitiveValue::CSS_STRING) {
@@ -7721,7 +7741,7 @@ bool CSSPropertyParser::parseViewportProperty(CSSPropertyID propId, bool importa
break;
}
- RefPtrWillBeRawPtr<CSSValue> parsedValue;
+ RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
if (validPrimitive) {
parsedValue = parseValidPrimitive(id, value);
m_valueList->next();
@@ -7852,7 +7872,7 @@ bool CSSPropertyParser::parseSVGValue(CSSPropertyID propId, bool important)
CSSValueID id = value->id;
bool validPrimitive = false;
- RefPtrWillBeRawPtr<CSSValue> parsedValue;
+ RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
switch (propId) {
/* The comment to the right defines all valid value of these
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | Source/core/dom/StyleEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698