OLD | NEW |
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 class StyleSheetContents; | 70 class StyleSheetContents; |
71 class UseCounter; | 71 class UseCounter; |
72 | 72 |
73 // FIXME: This class is shared with CSSTokenizer so should we rename it to CSSSo
urceLocation? | 73 // FIXME: This class is shared with CSSTokenizer so should we rename it to CSSSo
urceLocation? |
74 struct CSSParserLocation { | 74 struct CSSParserLocation { |
75 unsigned offset; | 75 unsigned offset; |
76 unsigned lineNumber; | 76 unsigned lineNumber; |
77 CSSParserString token; | 77 CSSParserString token; |
78 }; | 78 }; |
79 | 79 |
80 class CSSParser { | 80 class BisonCSSParser { |
81 friend inline int cssyylex(void*, CSSParser*); | 81 friend inline int cssyylex(void*, BisonCSSParser*); |
82 | 82 |
83 public: | 83 public: |
84 CSSParser(const CSSParserContext&, UseCounter* = 0); | 84 BisonCSSParser(const CSSParserContext&, UseCounter* = 0); |
85 | 85 |
86 ~CSSParser(); | 86 ~BisonCSSParser(); |
87 | 87 |
88 void parseSheet(StyleSheetContents*, const String&, const TextPosition& star
tPosition = TextPosition::minimumPosition(), CSSParserObserver* = 0, bool = fals
e); | 88 void parseSheet(StyleSheetContents*, const String&, const TextPosition& star
tPosition = TextPosition::minimumPosition(), CSSParserObserver* = 0, bool = fals
e); |
89 PassRefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&); | 89 PassRefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&); |
90 PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const Strin
g&); | 90 PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const Strin
g&); |
91 bool parseSupportsCondition(const String&); | 91 bool parseSupportsCondition(const String&); |
92 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String
&, bool important, CSSParserMode, StyleSheetContents*); | 92 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String
&, bool important, CSSParserMode, StyleSheetContents*); |
93 static bool parseColor(RGBA32& color, const String&, bool strict = false); | 93 static bool parseColor(RGBA32& color, const String&, bool strict = false); |
94 static bool parseSystemColor(RGBA32& color, const String&, Document*); | 94 static bool parseSystemColor(RGBA32& color, const String&, Document*); |
95 static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&); | 95 static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&); |
96 PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(CSSValueID ident, CSSParse
rValue*); | 96 PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(CSSValueID ident, CSSParse
rValue*); |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 429 |
430 private: | 430 private: |
431 enum PropertyType { | 431 enum PropertyType { |
432 PropertyExplicit, | 432 PropertyExplicit, |
433 PropertyImplicit | 433 PropertyImplicit |
434 }; | 434 }; |
435 | 435 |
436 class ImplicitScope { | 436 class ImplicitScope { |
437 WTF_MAKE_NONCOPYABLE(ImplicitScope); | 437 WTF_MAKE_NONCOPYABLE(ImplicitScope); |
438 public: | 438 public: |
439 ImplicitScope(WebCore::CSSParser* parser, PropertyType propertyType) | 439 ImplicitScope(WebCore::BisonCSSParser* parser, PropertyType propertyType
) |
440 : m_parser(parser) | 440 : m_parser(parser) |
441 { | 441 { |
442 m_parser->m_implicitShorthand = propertyType == CSSParser::PropertyI
mplicit; | 442 m_parser->m_implicitShorthand = propertyType == BisonCSSParser::Prop
ertyImplicit; |
443 } | 443 } |
444 | 444 |
445 ~ImplicitScope() | 445 ~ImplicitScope() |
446 { | 446 { |
447 m_parser->m_implicitShorthand = false; | 447 m_parser->m_implicitShorthand = false; |
448 } | 448 } |
449 | 449 |
450 private: | 450 private: |
451 WebCore::CSSParser* m_parser; | 451 WebCore::BisonCSSParser* m_parser; |
452 }; | 452 }; |
453 | 453 |
454 class StyleDeclarationScope { | 454 class StyleDeclarationScope { |
455 WTF_MAKE_NONCOPYABLE(StyleDeclarationScope); | 455 WTF_MAKE_NONCOPYABLE(StyleDeclarationScope); |
456 public: | 456 public: |
457 StyleDeclarationScope(CSSParser* parser, const StylePropertySet* declara
tion) | 457 StyleDeclarationScope(BisonCSSParser* parser, const StylePropertySet* de
claration) |
458 : m_parser(parser) | 458 : m_parser(parser) |
459 , m_mode(declaration->cssParserMode()) | 459 , m_mode(declaration->cssParserMode()) |
460 { | 460 { |
461 if (isCSSViewportParsingEnabledForMode(m_mode)) { | 461 if (isCSSViewportParsingEnabledForMode(m_mode)) { |
462 ASSERT(!m_parser->inViewport()); | 462 ASSERT(!m_parser->inViewport()); |
463 m_parser->markViewportRuleBodyStart(); | 463 m_parser->markViewportRuleBodyStart(); |
464 } | 464 } |
465 } | 465 } |
466 | 466 |
467 ~StyleDeclarationScope() | 467 ~StyleDeclarationScope() |
468 { | 468 { |
469 if (isCSSViewportParsingEnabledForMode(m_mode)) | 469 if (isCSSViewportParsingEnabledForMode(m_mode)) |
470 m_parser->markViewportRuleBodyEnd(); | 470 m_parser->markViewportRuleBodyEnd(); |
471 } | 471 } |
472 | 472 |
473 private: | 473 private: |
474 CSSParser* m_parser; | 474 BisonCSSParser* m_parser; |
475 CSSParserMode m_mode; | 475 CSSParserMode m_mode; |
476 }; | 476 }; |
477 | 477 |
478 inline void ensureLineEndings(); | 478 inline void ensureLineEndings(); |
479 | 479 |
480 void setStyleSheet(StyleSheetContents* styleSheet) { m_styleSheet = styleShe
et; } | 480 void setStyleSheet(StyleSheetContents* styleSheet) { m_styleSheet = styleShe
et; } |
481 | 481 |
482 bool inQuirksMode() const { return isQuirksModeBehavior(m_context.mode()); } | 482 bool inQuirksMode() const { return isQuirksModeBehavior(m_context.mode()); } |
483 bool inViewport() const { return m_inViewport; } | 483 bool inViewport() const { return m_inViewport; } |
484 | 484 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 friend class FilterOperationInfo; | 610 friend class FilterOperationInfo; |
611 }; | 611 }; |
612 | 612 |
613 CSSPropertyID cssPropertyID(const CSSParserString&); | 613 CSSPropertyID cssPropertyID(const CSSParserString&); |
614 CSSPropertyID cssPropertyID(const String&); | 614 CSSPropertyID cssPropertyID(const String&); |
615 CSSValueID cssValueKeywordID(const CSSParserString&); | 615 CSSValueID cssValueKeywordID(const CSSParserString&); |
616 | 616 |
617 class ShorthandScope { | 617 class ShorthandScope { |
618 WTF_MAKE_FAST_ALLOCATED; | 618 WTF_MAKE_FAST_ALLOCATED; |
619 public: | 619 public: |
620 ShorthandScope(CSSParser* parser, CSSPropertyID propId) : m_parser(parser) | 620 ShorthandScope(BisonCSSParser* parser, CSSPropertyID propId) : m_parser(pars
er) |
621 { | 621 { |
622 if (!(m_parser->m_inParseShorthand++)) | 622 if (!(m_parser->m_inParseShorthand++)) |
623 m_parser->m_currentShorthand = propId; | 623 m_parser->m_currentShorthand = propId; |
624 } | 624 } |
625 ~ShorthandScope() | 625 ~ShorthandScope() |
626 { | 626 { |
627 if (!(--m_parser->m_inParseShorthand)) | 627 if (!(--m_parser->m_inParseShorthand)) |
628 m_parser->m_currentShorthand = CSSPropertyInvalid; | 628 m_parser->m_currentShorthand = CSSPropertyInvalid; |
629 } | 629 } |
630 | 630 |
631 private: | 631 private: |
632 CSSParser* m_parser; | 632 BisonCSSParser* m_parser; |
633 }; | 633 }; |
634 | 634 |
635 bool isValidNthToken(const CSSParserString&); | 635 bool isValidNthToken(const CSSParserString&); |
636 | 636 |
637 inline int cssyylex(void* yylval, CSSParser* parser) | 637 inline int cssyylex(void* yylval, BisonCSSParser* parser) |
638 { | 638 { |
639 return parser->m_tokenizer.lex(yylval); | 639 return parser->m_tokenizer.lex(yylval); |
640 } | 640 } |
641 | 641 |
642 } // namespace WebCore | 642 } // namespace WebCore |
643 | 643 |
644 #endif // CSSParser_h | 644 #endif // CSSParser_h |
OLD | NEW |