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

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

Issue 1348363004: Add consumeInteger/consumeLength (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix build 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: Source/core/css/parser/CSSPropertyParser.h
diff --git a/Source/core/css/parser/CSSPropertyParser.h b/Source/core/css/parser/CSSPropertyParser.h
index a02331978e9847a281331ffbe9c993ca961a049f..adcf968ae8c88669ef4cb4e239ed19a03ab9a276 100644
--- a/Source/core/css/parser/CSSPropertyParser.h
+++ b/Source/core/css/parser/CSSPropertyParser.h
@@ -189,6 +189,8 @@ private:
bool parseSystemFont(bool important);
PassRefPtrWillBeRawPtr<CSSValueList> parseFontFamily();
+ PassRefPtrWillBeRawPtr<CSSValue> consumeSpacing(CSSParserTokenRange&);
+
PassRefPtrWillBeRawPtr<CSSValue> parseCounter(int defaultValue);
PassRefPtrWillBeRawPtr<CSSValue> parseCounterContent(CSSParserValueList* args, bool counters);
@@ -341,8 +343,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);
@@ -378,6 +378,15 @@ private:
RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation;
};
+inline bool shouldAcceptUnitLessValues(double fValue, CSSPropertyParser::Units unitflags, CSSParserMode cssParserMode)
+{
+ // 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&);

Powered by Google App Engine
This is Rietveld 408576698