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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 - 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserve d. 5 * Copyright (C) 2009 - 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserve d.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 182
183 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapeCircle(CSSParserValueLi st* args); 183 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapeCircle(CSSParserValueLi st* args);
184 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapeEllipse(CSSParserValueL ist* args); 184 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapeEllipse(CSSParserValueL ist* args);
185 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapePolygon(CSSParserValueL ist* args); 185 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapePolygon(CSSParserValueL ist* args);
186 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapeInset(CSSParserValueLis t* args); 186 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapeInset(CSSParserValueLis t* args);
187 187
188 bool parseFont(bool important); 188 bool parseFont(bool important);
189 bool parseSystemFont(bool important); 189 bool parseSystemFont(bool important);
190 PassRefPtrWillBeRawPtr<CSSValueList> parseFontFamily(); 190 PassRefPtrWillBeRawPtr<CSSValueList> parseFontFamily();
191 191
192 PassRefPtrWillBeRawPtr<CSSValue> consumeSpacing(CSSParserTokenRange&);
193
192 PassRefPtrWillBeRawPtr<CSSValue> parseCounter(int defaultValue); 194 PassRefPtrWillBeRawPtr<CSSValue> parseCounter(int defaultValue);
193 PassRefPtrWillBeRawPtr<CSSValue> parseCounterContent(CSSParserValueList* arg s, bool counters); 195 PassRefPtrWillBeRawPtr<CSSValue> parseCounterContent(CSSParserValueList* arg s, bool counters);
194 196
195 bool parseColorParameters(const CSSParserValue*, int* colorValues, bool pars eAlpha); 197 bool parseColorParameters(const CSSParserValue*, int* colorValues, bool pars eAlpha);
196 bool parseHSLParameters(const CSSParserValue*, double* colorValues, bool par seAlpha); 198 bool parseHSLParameters(const CSSParserValue*, double* colorValues, bool par seAlpha);
197 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseColor(const CSSParserValue*, bool acceptQuirkyColors = false); 199 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseColor(const CSSParserValue*, bool acceptQuirkyColors = false);
198 bool parseColorFromValue(const CSSParserValue*, RGBA32&, bool acceptQuirkyCo lors = false); 200 bool parseColorFromValue(const CSSParserValue*, RGBA32&, bool acceptQuirkyCo lors = false);
199 201
200 bool acceptQuirkyColors(CSSPropertyID) const; 202 bool acceptQuirkyColors(CSSPropertyID) const;
201 203
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 336
335 friend inline Units operator|(Units a, Units b) 337 friend inline Units operator|(Units a, Units b)
336 { 338 {
337 return static_cast<Units>(static_cast<unsigned>(a) | static_cast<unsigne d>(b)); 339 return static_cast<Units>(static_cast<unsigned>(a) | static_cast<unsigne d>(b));
338 } 340 }
339 341
340 bool validWidthOrHeight(CSSParserValue*, Units); 342 bool validWidthOrHeight(CSSParserValue*, Units);
341 343
342 bool validCalculationUnit(CSSParserValue*, Units, ReleaseParsedCalcValueCond ition releaseCalc = DoNotReleaseParsedCalcValue); 344 bool validCalculationUnit(CSSParserValue*, Units, ReleaseParsedCalcValueCond ition releaseCalc = DoNotReleaseParsedCalcValue);
343 345
344 bool shouldAcceptUnitLessValues(CSSParserValue*, Units, CSSParserMode);
345
346 inline bool validUnit(CSSParserValue* value, Units unitflags, ReleaseParsedC alcValueCondition releaseCalc = DoNotReleaseParsedCalcValue) { return validUnit( value, unitflags, m_context.mode(), releaseCalc); } 346 inline bool validUnit(CSSParserValue* value, Units unitflags, ReleaseParsedC alcValueCondition releaseCalc = DoNotReleaseParsedCalcValue) { return validUnit( value, unitflags, m_context.mode(), releaseCalc); }
347 bool validUnit(CSSParserValue*, Units, CSSParserMode, ReleaseParsedCalcValue Condition releaseCalc = DoNotReleaseParsedCalcValue); 347 bool validUnit(CSSParserValue*, Units, CSSParserMode, ReleaseParsedCalcValue Condition releaseCalc = DoNotReleaseParsedCalcValue);
348 348
349 bool parseBorderImageQuad(Units, RefPtrWillBeRawPtr<CSSQuadValue>&); 349 bool parseBorderImageQuad(Units, RefPtrWillBeRawPtr<CSSQuadValue>&);
350 int colorIntFromValue(CSSParserValue*); 350 int colorIntFromValue(CSSParserValue*);
351 351
352 bool buildBorderImageParseContext(CSSPropertyID, BorderImageParseContext&); 352 bool buildBorderImageParseContext(CSSPropertyID, BorderImageParseContext&);
353 353
354 bool parseDeprecatedGradientColorStop(CSSParserValue*, CSSGradientColorStop& ); 354 bool parseDeprecatedGradientColorStop(CSSParserValue*, CSSGradientColorStop& );
355 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseDeprecatedGradientStopColor(c onst CSSParserValue*); 355 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseDeprecatedGradientStopColor(c onst CSSParserValue*);
(...skipping 15 matching lines...) Expand all
371 WillBeHeapVector<CSSProperty, 256>& m_parsedProperties; 371 WillBeHeapVector<CSSProperty, 256>& m_parsedProperties;
372 StyleRule::Type m_ruleType; 372 StyleRule::Type m_ruleType;
373 373
374 // Locals during parsing: 374 // Locals during parsing:
375 int m_inParseShorthand; 375 int m_inParseShorthand;
376 CSSPropertyID m_currentShorthand; 376 CSSPropertyID m_currentShorthand;
377 bool m_implicitShorthand; 377 bool m_implicitShorthand;
378 RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation; 378 RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation;
379 }; 379 };
380 380
381 inline bool shouldAcceptUnitLessValues(double fValue, CSSPropertyParser::Units u nitflags, CSSParserMode cssParserMode)
382 {
383 // Quirks mode for certain properties and presentation attributes accept uni t-less values for certain units.
384 return (unitflags & (CSSPropertyParser::FLength | CSSPropertyParser::FAngle) )
385 && (!fValue // 0 can always be unitless.
386 || isUnitLessLengthParsingEnabledForMode(cssParserMode) // HTML and SVG attribute values can always be unitless.
387 || (cssParserMode == HTMLQuirksMode && (unitflags & CSSPropertyParse r::FUnitlessQuirk)));
388 }
389
381 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&); 390 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&);
382 CSSValueID cssValueKeywordID(const CSSParserString&); 391 CSSValueID cssValueKeywordID(const CSSParserString&);
383 392
384 } // namespace blink 393 } // namespace blink
385 394
386 #endif // CSSPropertyParser_h 395 #endif // CSSPropertyParser_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698