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

Unified Diff: third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp

Issue 1348363004: Add consumeInteger/consumeLength (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: round II Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
index 555573cb37509bf046b9055df9335a5c2b1c4cd6..dd7b43375dec382a5640c0eb3faa2785df1dd99b 100644
--- a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
@@ -170,15 +170,6 @@ bool CSSPropertyParser::validCalculationUnit(CSSParserValue* value, Units unitfl
return b;
}
-inline bool CSSPropertyParser::shouldAcceptUnitLessValues(CSSParserValue* value, Units unitflags, CSSParserMode cssParserMode)
-{
- // Quirks mode for certain properties and presentation attributes accept unit-less values for certain units.
- return (unitflags & (FLength | FAngle))
- && (!value->fValue // 0 can always be unitless.
- || isUnitLessLengthParsingEnabledForMode(cssParserMode) // HTML and SVG attribute values can always be unitless.
- || (cssParserMode == HTMLQuirksMode && (unitflags & FUnitlessQuirk)));
-}
-
inline bool isCalculation(CSSParserValue* value)
{
return value->m_unit == CSSParserValue::CalcFunction;
@@ -195,7 +186,7 @@ bool CSSPropertyParser::validUnit(CSSParserValue* value, Units unitflags, CSSPar
case CSSPrimitiveValue::UnitType::Number:
if (unitflags & FNumber)
return true;
- if (shouldAcceptUnitLessValues(value, unitflags, cssParserMode)) {
+ if (shouldAcceptUnitLessValues(value->fValue, unitflags, cssParserMode)) {
value->setUnit((unitflags & FLength) ? CSSPrimitiveValue::UnitType::Pixels : CSSPrimitiveValue::UnitType::Degrees);
return true;
}
@@ -691,14 +682,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
validPrimitive = validUnit(value, FLength | FNonNeg | unitless);
break;
- case CSSPropertyLetterSpacing: // normal | <length> | inherit
- case CSSPropertyWordSpacing: // normal | <length> | inherit
- if (id == CSSValueNormal)
- validPrimitive = true;
- else
- validPrimitive = validUnit(value, FLength | FUnitlessQuirk);
- break;
-
case CSSPropertyTextIndent:
parsedValue = parseTextIndent();
break;
@@ -912,10 +895,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
addProperty(propId, CSSValuePair::create(parsedValue1.release(), parsedValue2.release(), CSSValuePair::DropIdenticalValues), important);
return true;
}
- case CSSPropertyTabSize:
- // May be specified as a unit-less non-negative integer or length indicating number of space characters.
- validPrimitive = validUnit(value, FInteger | FLength | FNonNeg);
- break;
case CSSPropertyBorderRadius:
case CSSPropertyAliasWebkitBorderRadius:
return parseBorderRadius(unresolvedProperty, important);
@@ -1424,6 +1403,9 @@ bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import
case CSSPropertyFontVariant:
case CSSPropertyFontFamily:
case CSSPropertyFontWeight:
+ case CSSPropertyLetterSpacing:
+ case CSSPropertyWordSpacing:
+ case CSSPropertyTabSize:
validPrimitive = false;
break;

Powered by Google App Engine
This is Rietveld 408576698