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

Side by Side Diff: Source/core/css/parser/CSSPropertyParser.h

Issue 1331233003: Move parseFontFaceDescriptor to CSSPropertyParser.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cleanup consumeFontWeight and consumeUrl 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.
11 * 11 *
12 * This library is distributed in the hope that it will be useful, 12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details. 15 * Library General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Library General Public License 17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to 18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA. 20 * Boston, MA 02110-1301, USA.
21 */ 21 */
22 22
23 #ifndef CSSPropertyParser_h 23 #ifndef CSSPropertyParser_h
24 #define CSSPropertyParser_h 24 #define CSSPropertyParser_h
25 25
26 #include "core/css/CSSGradientValue.h" 26 #include "core/css/CSSGradientValue.h"
27 #include "core/css/CSSGridTemplateAreasValue.h" 27 #include "core/css/CSSGridTemplateAreasValue.h"
28 #include "core/css/CSSPropertySourceData.h" 28 #include "core/css/CSSPropertySourceData.h"
29 #include "core/css/CSSValuePool.h"
29 #include "core/css/parser/CSSParserTokenRange.h" 30 #include "core/css/parser/CSSParserTokenRange.h"
30 #include "platform/Length.h" 31 #include "platform/Length.h"
32 #include "wtf/text/StringBuilder.h"
31 33
32 namespace blink { 34 namespace blink {
33 35
34 class BorderImageParseContext; 36 class BorderImageParseContext;
35 class CSSBorderImageSliceValue; 37 class CSSBorderImageSliceValue;
36 class CSSBasicShape; 38 class CSSBasicShape;
37 class CSSBasicShapeInset; 39 class CSSBasicShapeInset;
38 class CSSFunctionValue; 40 class CSSFunctionValue;
39 class CSSGradientValue; 41 class CSSGradientValue;
40 class CSSGridLineNamesValue; 42 class CSSGridLineNamesValue;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseShapeRadius(CSSParserValue*); 182 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseShapeRadius(CSSParserValue*);
181 183
182 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapeCircle(CSSParserValueLi st* args); 184 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapeCircle(CSSParserValueLi st* args);
183 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapeEllipse(CSSParserValueL ist* args); 185 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapeEllipse(CSSParserValueL ist* args);
184 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapePolygon(CSSParserValueL ist* args); 186 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapePolygon(CSSParserValueL ist* args);
185 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapeInset(CSSParserValueLis t* args); 187 PassRefPtrWillBeRawPtr<CSSBasicShape> parseBasicShapeInset(CSSParserValueLis t* args);
186 188
187 bool parseFont(bool important); 189 bool parseFont(bool important);
188 bool parseSystemFont(bool important); 190 bool parseSystemFont(bool important);
189 PassRefPtrWillBeRawPtr<CSSValueList> parseFontFamily(); 191 PassRefPtrWillBeRawPtr<CSSValueList> parseFontFamily();
192 PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFamily();
190 193
191 PassRefPtrWillBeRawPtr<CSSValue> parseCounter(int defaultValue); 194 PassRefPtrWillBeRawPtr<CSSValue> parseCounter(int defaultValue);
192 PassRefPtrWillBeRawPtr<CSSValue> parseCounterContent(CSSParserValueList* arg s, bool counters); 195 PassRefPtrWillBeRawPtr<CSSValue> parseCounterContent(CSSParserValueList* arg s, bool counters);
193 196
194 bool parseColorParameters(const CSSParserValue*, int* colorValues, bool pars eAlpha); 197 bool parseColorParameters(const CSSParserValue*, int* colorValues, bool pars eAlpha);
195 bool parseHSLParameters(const CSSParserValue*, double* colorValues, bool par seAlpha); 198 bool parseHSLParameters(const CSSParserValue*, double* colorValues, bool par seAlpha);
196 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseColor(const CSSParserValue*, bool acceptQuirkyColors = false); 199 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseColor(const CSSParserValue*, bool acceptQuirkyColors = false);
197 bool parseColorFromValue(const CSSParserValue*, RGBA32&, bool acceptQuirkyCo lors = false); 200 bool parseColorFromValue(const CSSParserValue*, RGBA32&, bool acceptQuirkyCo lors = false);
198 201
199 bool acceptQuirkyColors(CSSPropertyID) const; 202 bool acceptQuirkyColors(CSSPropertyID) const;
200 203
201 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseLineHeight(); 204 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> parseLineHeight();
202 bool parseFontSize(bool important); 205 bool parseFontSize(bool important);
203 bool parseFontVariant(bool important); 206 PassRefPtrWillBeRawPtr<CSSValue> consumeFontVariant();
204 bool parseFontWeight(bool important); 207 bool parseFontWeight(bool important);
205 PassRefPtrWillBeRawPtr<CSSValueList> parseFontFaceSrc(); 208 PassRefPtrWillBeRawPtr<CSSValueList> consumeFontFaceSrc();
206 PassRefPtrWillBeRawPtr<CSSValueList> parseFontFaceUnicodeRange();
207 209
208 bool parseSVGValue(CSSPropertyID propId, bool important); 210 bool parseSVGValue(CSSPropertyID propId, bool important);
209 PassRefPtrWillBeRawPtr<CSSValue> parseSVGStrokeDasharray(); 211 PassRefPtrWillBeRawPtr<CSSValue> parseSVGStrokeDasharray();
210 212
211 PassRefPtrWillBeRawPtr<CSSValue> parsePaintOrder() const; 213 PassRefPtrWillBeRawPtr<CSSValue> parsePaintOrder() const;
212 214
213 // CSS3 Parsing Routines (for properties specific to CSS3) 215 // CSS3 Parsing Routines (for properties specific to CSS3)
214 PassRefPtrWillBeRawPtr<CSSValueList> parseShadow(CSSParserValueList*, CSSPro pertyID); 216 PassRefPtrWillBeRawPtr<CSSValueList> parseShadow(CSSParserValueList*, CSSPro pertyID);
215 PassRefPtrWillBeRawPtr<CSSShadowValue> parseSingleShadow(CSSParserValueList* , bool allowInset, bool allowSpread); 217 PassRefPtrWillBeRawPtr<CSSShadowValue> parseSingleShadow(CSSParserValueList* , bool allowInset, bool allowSpread);
216 bool parseBorderImageShorthand(CSSPropertyID, bool important); 218 bool parseBorderImageShorthand(CSSPropertyID, bool important);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 PassRefPtrWillBeRawPtr<CSSValue> parseTextEmphasisStyle(); 257 PassRefPtrWillBeRawPtr<CSSValue> parseTextEmphasisStyle();
256 258
257 PassRefPtrWillBeRawPtr<CSSValue> parseTouchAction(); 259 PassRefPtrWillBeRawPtr<CSSValue> parseTouchAction();
258 260
259 PassRefPtrWillBeRawPtr<CSSValue> parseTextDecoration(); 261 PassRefPtrWillBeRawPtr<CSSValue> parseTextDecoration();
260 262
261 PassRefPtrWillBeRawPtr<CSSValue> parseTextIndent(); 263 PassRefPtrWillBeRawPtr<CSSValue> parseTextIndent();
262 264
263 bool parseCalculation(CSSParserValue*, ValueRange); 265 bool parseCalculation(CSSParserValue*, ValueRange);
264 266
265 bool parseFontFeatureTag(CSSValueList*);
266 PassRefPtrWillBeRawPtr<CSSValue> parseFontFeatureSettings();
267
268 bool parseFontVariantLigatures(bool important);
269
270 bool parseGeneratedImage(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&) ; 267 bool parseGeneratedImage(CSSParserValueList*, RefPtrWillBeRawPtr<CSSValue>&) ;
271 268
272 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveNumericValue(CSSPar serValue*); 269 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveNumericValue(CSSPar serValue*);
273 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveStringValue(CSSPars erValue*); 270 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveStringValue(CSSPars erValue*);
274 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveCustomIdentValue(CS SParserValue*); 271 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> createPrimitiveCustomIdentValue(CS SParserValue*);
275 272
276 PassRefPtrWillBeRawPtr<CSSValue> createCSSImageValueWithReferrer(const Strin g& rawValue, const KURL&); 273 PassRefPtrWillBeRawPtr<CSSValue> createCSSImageValueWithReferrer(const Strin g& rawValue, const KURL&);
277 274
278 PassRefPtrWillBeRawPtr<CSSBasicShape> parseInsetRoundedCorners(PassRefPtrWil lBeRawPtr<CSSBasicShapeInset>, CSSParserValueList*); 275 PassRefPtrWillBeRawPtr<CSSBasicShape> parseInsetRoundedCorners(PassRefPtrWil lBeRawPtr<CSSBasicShapeInset>, CSSParserValueList*);
279 276
280 enum SizeParameterType { 277 enum SizeParameterType {
281 None, 278 None,
282 Auto, 279 Auto,
283 Length, 280 Length,
284 PageSize, 281 PageSize,
285 Orientation, 282 Orientation,
286 }; 283 };
287 284
288 PassRefPtrWillBeRawPtr<CSSValueList> parseSize(); 285 PassRefPtrWillBeRawPtr<CSSValueList> parseSize();
289 SizeParameterType parseSizeParameter(CSSValueList* parsedValues, CSSParserVa lue*, SizeParameterType prevParamType); 286 SizeParameterType parseSizeParameter(CSSValueList* parsedValues, CSSParserVa lue*, SizeParameterType prevParamType);
290 287
291 bool parseFontFaceSrcURI(CSSValueList*); 288 bool consumeFontFaceSrcURI(CSSValueList*);
292 bool parseFontFaceSrcLocal(CSSValueList*); 289 bool consumeFontFaceSrcLocal(CSSValueList*);
293 290
294 class ImplicitScope { 291 class ImplicitScope {
295 STACK_ALLOCATED(); 292 STACK_ALLOCATED();
296 WTF_MAKE_NONCOPYABLE(ImplicitScope); 293 WTF_MAKE_NONCOPYABLE(ImplicitScope);
297 public: 294 public:
298 ImplicitScope(CSSPropertyParser* parser) 295 ImplicitScope(CSSPropertyParser* parser)
299 : m_parser(parser) 296 : m_parser(parser)
300 { 297 {
301 m_parser->m_implicitShorthand = true; 298 m_parser->m_implicitShorthand = true;
302 } 299 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 WillBeHeapVector<CSSProperty, 256>& m_parsedProperties; 369 WillBeHeapVector<CSSProperty, 256>& m_parsedProperties;
373 StyleRule::Type m_ruleType; 370 StyleRule::Type m_ruleType;
374 371
375 // Locals during parsing: 372 // Locals during parsing:
376 int m_inParseShorthand; 373 int m_inParseShorthand;
377 CSSPropertyID m_currentShorthand; 374 CSSPropertyID m_currentShorthand;
378 bool m_implicitShorthand; 375 bool m_implicitShorthand;
379 RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation; 376 RefPtrWillBeMember<CSSCalcValue> m_parsedCalculation;
380 }; 377 };
381 378
379 // FIXME(rwlbuis): move to CSSPropertyParser.cpp once
380 // all font properties are converted.
381 class FontFamilyValueBuilder {
382 STACK_ALLOCATED();
383 public:
384 FontFamilyValueBuilder(CSSValueList* list)
385 : m_list(list)
386 {
387 }
388
389 void add(const CSSParserString& string)
390 {
391 if (!m_builder.isEmpty())
392 m_builder.append(' ');
393
394 if (string.is8Bit()) {
395 m_builder.append(string.characters8(), string.length());
396 return;
397 }
398
399 m_builder.append(string.characters16(), string.length());
400 }
401
402 void commit()
403 {
404 if (m_builder.isEmpty())
405 return;
406 m_list->append(cssValuePool().createFontFamilyValue(m_builder.toString() ));
407 m_builder.clear();
408 }
409
410 private:
411 StringBuilder m_builder;
412 RawPtrWillBeMember<CSSValueList> m_list;
413 };
414
382 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&); 415 CSSPropertyID unresolvedCSSPropertyID(const CSSParserString&);
383 CSSValueID cssValueKeywordID(const CSSParserString&); 416 CSSValueID cssValueKeywordID(const CSSParserString&);
384 417
385 } // namespace blink 418 } // namespace blink
386 419
387 #endif // CSSPropertyParser_h 420 #endif // CSSPropertyParser_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/parser/CSSPropertyParser.cpp » ('j') | Source/core/css/parser/CSSPropertyParser.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698