Index: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h |
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h |
index 51de867250fb3d9bf5e3dc78707d6b772546932c..bc3ea7762d4428200a120d968601fd158e016895 100644 |
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h |
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.h |
@@ -52,6 +52,11 @@ class CSSValue; |
class CSSValueList; |
class StylePropertyShorthand; |
+enum class UnitlessQuirk { |
+ Allow, |
+ Forbid |
+}; |
+ |
// Inputs: PropertyID, isImportant bool, CSSParserValueList. |
// Outputs: Vector of CSSProperties |
@@ -340,8 +345,6 @@ private: |
bool validCalculationUnit(CSSParserValue*, Units, ReleaseParsedCalcValueCondition releaseCalc = DoNotReleaseParsedCalcValue); |
- bool shouldAcceptUnitLessValues(CSSParserValue*, Units, CSSParserMode); |
- |
inline bool validUnit(CSSParserValue* value, Units unitflags, ReleaseParsedCalcValueCondition releaseCalc = DoNotReleaseParsedCalcValue) { return validUnit(value, unitflags, m_context.mode(), releaseCalc); } |
bool validUnit(CSSParserValue*, Units, CSSParserMode, ReleaseParsedCalcValueCondition releaseCalc = DoNotReleaseParsedCalcValue); |
@@ -377,6 +380,15 @@ private: |
RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation; |
}; |
+inline bool shouldAcceptUnitLessValues(double fValue, CSSPropertyParser::Units unitflags, CSSParserMode cssParserMode) |
alancutter (OOO until 2018)
2015/09/27 23:13:38
This should move back into LegacyCSSPropertyParser
|
+{ |
+ // Quirks mode for certain properties and presentation attributes accept unit-less values for certain units. |
+ return (unitflags & (CSSPropertyParser::FLength | CSSPropertyParser::FAngle)) |
+ && (!fValue // 0 can always be unitless. |
+ || isUnitLessLengthParsingEnabledForMode(cssParserMode) // HTML and SVG attribute values can always be unitless. |
+ || (cssParserMode == HTMLQuirksMode && (unitflags & CSSPropertyParser::FUnitlessQuirk))); |
+} |
+ |
CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&); |
CSSValueID cssValueKeywordID(const CSSParserString&); |