| 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. |
| 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 CSSParser_h | 23 #ifndef CSSParser_h |
| 24 #define CSSParser_h | 24 #define CSSParser_h |
| 25 | 25 |
| 26 #include "CSSPropertyNames.h" | 26 #include "CSSPropertyNames.h" |
| 27 #include "CSSValueKeywords.h" |
| 27 #include "core/css/CSSCalculationValue.h" | 28 #include "core/css/CSSCalculationValue.h" |
| 28 #include "core/css/CSSFilterValue.h" | 29 #include "core/css/CSSFilterValue.h" |
| 29 #include "core/css/CSSGradientValue.h" | 30 #include "core/css/CSSGradientValue.h" |
| 30 #include "core/css/CSSParserMode.h" | 31 #include "core/css/CSSParserMode.h" |
| 31 #include "core/css/CSSParserValues.h" | 32 #include "core/css/CSSParserValues.h" |
| 32 #include "core/css/CSSProperty.h" | 33 #include "core/css/CSSProperty.h" |
| 33 #include "core/css/CSSPropertySourceData.h" | 34 #include "core/css/CSSPropertySourceData.h" |
| 34 #include "core/css/CSSSelector.h" | 35 #include "core/css/CSSSelector.h" |
| 35 #include "core/css/MediaQuery.h" | 36 #include "core/css/MediaQuery.h" |
| 36 #include "core/page/UseCounter.h" | 37 #include "core/page/UseCounter.h" |
| 37 #include "core/platform/graphics/Color.h" | 38 #include "core/platform/graphics/Color.h" |
| 38 #include <wtf/HashMap.h> | 39 #include "wtf/HashMap.h" |
| 39 #include <wtf/HashSet.h> | 40 #include "wtf/HashSet.h" |
| 40 #include <wtf/OwnArrayPtr.h> | 41 #include "wtf/OwnArrayPtr.h" |
| 41 #include <wtf/text/AtomicString.h> | 42 #include "wtf/Vector.h" |
| 42 #include <wtf/Vector.h> | 43 #include "wtf/text/AtomicString.h" |
| 43 | 44 |
| 44 namespace WebCore { | 45 namespace WebCore { |
| 45 | 46 |
| 46 class AnimationParseContext; | 47 class AnimationParseContext; |
| 47 class CSSArrayFunctionValue; | 48 class CSSArrayFunctionValue; |
| 48 class CSSBorderImageSliceValue; | 49 class CSSBorderImageSliceValue; |
| 49 class CSSMixFunctionValue; | 50 class CSSMixFunctionValue; |
| 50 class CSSPrimitiveValue; | 51 class CSSPrimitiveValue; |
| 51 class CSSSelectorList; | 52 class CSSSelectorList; |
| 52 class CSSShaderValue; | 53 class CSSShaderValue; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 ~CSSParser(); | 91 ~CSSParser(); |
| 91 | 92 |
| 92 void parseSheet(StyleSheetContents*, const String&, int startLineNumber = 0,
SourceDataHandler* = 0, bool = false); | 93 void parseSheet(StyleSheetContents*, const String&, int startLineNumber = 0,
SourceDataHandler* = 0, bool = false); |
| 93 PassRefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&); | 94 PassRefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&); |
| 94 PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const Strin
g&); | 95 PassRefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const Strin
g&); |
| 95 bool parseSupportsCondition(const String&); | 96 bool parseSupportsCondition(const String&); |
| 96 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String
&, bool important, CSSParserMode, StyleSheetContents*); | 97 static bool parseValue(MutableStylePropertySet*, CSSPropertyID, const String
&, bool important, CSSParserMode, StyleSheetContents*); |
| 97 static bool parseColor(RGBA32& color, const String&, bool strict = false); | 98 static bool parseColor(RGBA32& color, const String&, bool strict = false); |
| 98 static bool parseSystemColor(RGBA32& color, const String&, Document*); | 99 static bool parseSystemColor(RGBA32& color, const String&, Document*); |
| 99 static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&); | 100 static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&); |
| 100 PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(int ident, CSSParserValue*
); | 101 PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(CSSValueID ident, CSSParse
rValue*); |
| 101 bool parseDeclaration(MutableStylePropertySet*, const String&, SourceDataHan
dler*, StyleSheetContents* contextStyleSheet); | 102 bool parseDeclaration(MutableStylePropertySet*, const String&, SourceDataHan
dler*, StyleSheetContents* contextStyleSheet); |
| 102 static PassRefPtr<ImmutableStylePropertySet> parseInlineStyleDeclaration(con
st String&, Element*); | 103 static PassRefPtr<ImmutableStylePropertySet> parseInlineStyleDeclaration(con
st String&, Element*); |
| 103 PassOwnPtr<MediaQuery> parseMediaQuery(const String&); | 104 PassOwnPtr<MediaQuery> parseMediaQuery(const String&); |
| 104 | 105 |
| 105 void addPropertyWithPrefixingVariant(CSSPropertyID, PassRefPtr<CSSValue>, bo
ol important, bool implicit = false); | 106 void addPropertyWithPrefixingVariant(CSSPropertyID, PassRefPtr<CSSValue>, bo
ol important, bool implicit = false); |
| 106 void addProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool important, bool i
mplicit = false); | 107 void addProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool important, bool i
mplicit = false); |
| 107 void rollbackLastProperties(int num); | 108 void rollbackLastProperties(int num); |
| 108 bool hasProperties() const { return !m_parsedProperties.isEmpty(); } | 109 bool hasProperties() const { return !m_parsedProperties.isEmpty(); } |
| 109 void addExpandedPropertyForValue(CSSPropertyID propId, PassRefPtr<CSSValue>,
bool); | 110 void addExpandedPropertyForValue(CSSPropertyID propId, PassRefPtr<CSSValue>,
bool); |
| 110 void setCurrentProperty(CSSPropertyID); | 111 void setCurrentProperty(CSSPropertyID); |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 inline unsigned safeUserStringTokenOffset(); | 658 inline unsigned safeUserStringTokenOffset(); |
| 658 | 659 |
| 659 UseCounter* m_useCounter; | 660 UseCounter* m_useCounter; |
| 660 | 661 |
| 661 friend class TransformOperationInfo; | 662 friend class TransformOperationInfo; |
| 662 friend class FilterOperationInfo; | 663 friend class FilterOperationInfo; |
| 663 }; | 664 }; |
| 664 | 665 |
| 665 CSSPropertyID cssPropertyID(const CSSParserString&); | 666 CSSPropertyID cssPropertyID(const CSSParserString&); |
| 666 CSSPropertyID cssPropertyID(const String&); | 667 CSSPropertyID cssPropertyID(const String&); |
| 667 int cssValueKeywordID(const CSSParserString&); | 668 CSSValueID cssValueKeywordID(const CSSParserString&); |
| 668 | 669 |
| 669 class ShorthandScope { | 670 class ShorthandScope { |
| 670 WTF_MAKE_FAST_ALLOCATED; | 671 WTF_MAKE_FAST_ALLOCATED; |
| 671 public: | 672 public: |
| 672 ShorthandScope(CSSParser* parser, CSSPropertyID propId) : m_parser(parser) | 673 ShorthandScope(CSSParser* parser, CSSPropertyID propId) : m_parser(parser) |
| 673 { | 674 { |
| 674 if (!(m_parser->m_inParseShorthand++)) | 675 if (!(m_parser->m_inParseShorthand++)) |
| 675 m_parser->m_currentShorthand = propId; | 676 m_parser->m_currentShorthand = propId; |
| 676 } | 677 } |
| 677 ~ShorthandScope() | 678 ~ShorthandScope() |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 } | 738 } |
| 738 | 739 |
| 739 inline int cssyylex(void* yylval, CSSParser* parser) | 740 inline int cssyylex(void* yylval, CSSParser* parser) |
| 740 { | 741 { |
| 741 return parser->lex(yylval); | 742 return parser->lex(yylval); |
| 742 } | 743 } |
| 743 | 744 |
| 744 } // namespace WebCore | 745 } // namespace WebCore |
| 745 | 746 |
| 746 #endif // CSSParser_h | 747 #endif // CSSParser_h |
| OLD | NEW |