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

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

Issue 764703002: Support unit-less lengths for white-list of properties only. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: min-width/height still accepts unitless lengths Created 5 years, 11 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/CSSParserMode.h ('k') | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/CSSPropertyParser.h
diff --git a/Source/core/css/parser/CSSPropertyParser.h b/Source/core/css/parser/CSSPropertyParser.h
index 70acb2cb0b56c5fa59c14a69945c6ac1f34a6d08..21e6db9f82d1fcd5eb2066482f3698170ec98d8c 100644
--- a/Source/core/css/parser/CSSPropertyParser.h
+++ b/Source/core/css/parser/CSSPropertyParser.h
@@ -56,6 +56,23 @@ class StylePropertyShorthand;
class CSSPropertyParser {
STACK_ALLOCATED();
public:
+
+ enum Units {
+ FUnknown = 0x0000,
+ FInteger = 0x0001,
+ FNumber = 0x0002, // Real Numbers
+ FPercent = 0x0004,
+ FLength = 0x0008,
+ FAngle = 0x0010,
+ FTime = 0x0020,
+ FFrequency = 0x0040,
+ FPositiveInteger = 0x0080,
+ FRelative = 0x0100,
+ FResolution = 0x0200,
+ FNonNeg = 0x0400,
+ FUnitlessQuirk = 0x0800
+ };
+
static bool parseValue(CSSPropertyID, bool important,
CSSParserValueList*, const CSSParserContext&, bool inViewport,
WillBeHeapVector<CSSProperty, 256>&, CSSRuleSourceData::Type);
@@ -101,12 +118,12 @@ private:
enum FillPositionFlag { InvalidFillPosition = 0, AmbiguousFillPosition = 1, XFillPosition = 2, YFillPosition = 4 };
enum FillPositionParsingMode { ResolveValuesAsPercent = 0, ResolveValuesAsKeyword = 1 };
- PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseFillPositionComponent(CSSParserValueList*, unsigned& cumulativeFlags, FillPositionFlag& individualFlag, FillPositionParsingMode = ResolveValuesAsPercent);
+ PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseFillPositionComponent(CSSParserValueList*, unsigned& cumulativeFlags, FillPositionFlag& individualFlag, FillPositionParsingMode = ResolveValuesAsPercent, Units = FUnknown);
PassRefPtrWillBeRawPtr<CSSValue> parseFillPositionX(CSSParserValueList*);
PassRefPtrWillBeRawPtr<CSSValue> parseFillPositionY(CSSParserValueList*);
- void parse2ValuesFillPosition(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&, RefPtrWillBeRawPtr<CSSValue>&);
+ void parse2ValuesFillPosition(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&, RefPtrWillBeRawPtr<CSSValue>&, Units = FUnknown);
bool isPotentialPositionValue(CSSParserValue*);
- void parseFillPosition(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&, RefPtrWillBeRawPtr<CSSValue>&);
+ void parseFillPosition(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&, RefPtrWillBeRawPtr<CSSValue>&, Units = FUnknown);
void parse3ValuesFillPosition(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&, RefPtrWillBeRawPtr<CSSValue>&, PassRefPtrWillBeRawPtr<CSSPrimitiveValue>, PassRefPtrWillBeRawPtr<CSSPrimitiveValue>);
void parse4ValuesFillPosition(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&, RefPtrWillBeRawPtr<CSSValue>&, PassRefPtrWillBeRawPtr<CSSPrimitiveValue>, PassRefPtrWillBeRawPtr<CSSPrimitiveValue>);
@@ -263,8 +280,6 @@ private:
PassRefPtrWillBeRawPtr<CSSValue> createCSSImageValueWithReferrer(const String& rawValue, const KURL&);
- bool validWidthOrHeight(CSSParserValue*);
-
PassRefPtrWillBeRawPtr<CSSBasicShape> parseInsetRoundedCorners(PassRefPtrWillBeRawPtr<CSSBasicShapeInset>, CSSParserValueList*);
enum SizeParameterType {
@@ -324,26 +339,13 @@ private:
DoNotReleaseParsedCalcValue
};
- enum Units {
- FUnknown = 0x0000,
- FInteger = 0x0001,
- FNumber = 0x0002, // Real Numbers
- FPercent = 0x0004,
- FLength = 0x0008,
- FAngle = 0x0010,
- FTime = 0x0020,
- FFrequency = 0x0040,
- FPositiveInteger = 0x0080,
- FRelative = 0x0100,
- FResolution = 0x0200,
- FNonNeg = 0x0400
- };
-
friend inline Units operator|(Units a, Units b)
{
return static_cast<Units>(static_cast<unsigned>(a) | static_cast<unsigned>(b));
}
+ bool validWidthOrHeight(CSSParserValue*, Units);
+
bool validCalculationUnit(CSSParserValue*, Units, ReleaseParsedCalcValueCondition releaseCalc = DoNotReleaseParsedCalcValue);
bool shouldAcceptUnitLessValues(CSSParserValue*, Units, CSSParserMode);
« no previous file with comments | « Source/core/css/parser/CSSParserMode.h ('k') | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698