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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 | 67 |
68 bool is8BitSource() const { return m_is8BitSource; } | 68 bool is8BitSource() const { return m_is8BitSource; } |
69 | 69 |
70 // FIXME: These 2 functions should be private so that we don't need the defi nitions below. | 70 // FIXME: These 2 functions should be private so that we don't need the defi nitions below. |
71 template <typename CharacterType> | 71 template <typename CharacterType> |
72 inline CharacterType* tokenStart(); | 72 inline CharacterType* tokenStart(); |
73 | 73 |
74 inline unsigned tokenStartOffset(); | 74 inline unsigned tokenStartOffset(); |
75 | 75 |
76 private: | 76 private: |
77 UChar*& currentCharacter16(); | 77 UChar* getStringBuffer16(size_t len); |
78 | 78 |
79 template <typename CharacterType> | 79 template <typename CharacterType> |
80 inline CharacterType*& currentCharacter(); | 80 inline CharacterType*& currentCharacter(); |
81 | 81 |
82 template <typename CharacterType> | 82 template <typename CharacterType> |
83 inline CharacterType* dataStart(); | 83 inline CharacterType* dataStart(); |
84 | 84 |
85 template <typename CharacterType> | 85 template <typename CharacterType> |
86 inline void setTokenStart(CharacterType*); | 86 inline void setTokenStart(CharacterType*); |
87 | 87 |
88 template <typename CharacterType> | 88 template <typename CharacterType> |
89 inline bool isIdentifierStart(); | 89 inline bool isIdentifierStart(); |
90 | 90 |
91 template <typename CharacterType> | 91 template <typename CharacterType> |
92 inline CSSParserLocation tokenLocation(); | 92 inline CSSParserLocation tokenLocation(); |
93 | 93 |
94 template <typename CharacterType> | 94 template <typename CharacterType> |
95 unsigned parseEscape(CharacterType*&); | 95 static unsigned parseEscape(CharacterType*&); |
96 template <typename DestCharacterType> | 96 template <typename DestCharacterType> |
97 inline void UnicodeToChars(DestCharacterType*&, unsigned); | 97 static inline void UnicodeToChars(DestCharacterType*&, unsigned); |
98 | |
98 template <typename SrcCharacterType, typename DestCharacterType> | 99 template <typename SrcCharacterType, typename DestCharacterType> |
99 inline bool parseIdentifierInternal(SrcCharacterType*&, DestCharacterType*&, bool&); | 100 static inline bool parseIdentifierInternal(SrcCharacterType*&, DestCharacter Type*&, bool&); |
100 | 101 template <typename SrcCharacterType> |
102 static size_t peekMaxIdentifierLen(SrcCharacterType*); | |
101 template <typename CharacterType> | 103 template <typename CharacterType> |
102 inline void parseIdentifier(CharacterType*&, CSSParserString&, bool&); | 104 inline void parseIdentifier(CharacterType*&, CSSParserString&, bool&); |
103 | 105 |
106 template <typename SrcCharacterType> | |
107 static size_t peekMaxStringLen(SrcCharacterType*, UChar quote); | |
104 template <typename SrcCharacterType, typename DestCharacterType> | 108 template <typename SrcCharacterType, typename DestCharacterType> |
105 inline bool parseStringInternal(SrcCharacterType*&, DestCharacterType*&, UCh ar); | 109 static inline bool parseStringInternal(SrcCharacterType*&, DestCharacterType *&, UChar); |
106 | |
107 template <typename CharacterType> | 110 template <typename CharacterType> |
108 inline void parseString(CharacterType*&, CSSParserString& resultString, UCha r); | 111 inline void parseString(CharacterType*&, CSSParserString& resultString, UCha r); |
109 | 112 |
110 template <typename CharacterType> | 113 template <typename CharacterType> |
111 inline bool findURI(CharacterType*& start, CharacterType*& end, UChar& quote ); | 114 inline bool findURI(CharacterType*& start, CharacterType*& end, UChar& quote ); |
112 | 115 template <typename SrcCharacterType> |
116 static size_t peekMaxURILen(SrcCharacterType*, UChar quote); | |
113 template <typename SrcCharacterType, typename DestCharacterType> | 117 template <typename SrcCharacterType, typename DestCharacterType> |
114 inline bool parseURIInternal(SrcCharacterType*&, DestCharacterType*&, UChar quote); | 118 static inline bool parseURIInternal(SrcCharacterType*&, DestCharacterType*&, UChar quote); |
115 | |
116 template <typename CharacterType> | 119 template <typename CharacterType> |
117 inline void parseURI(CSSParserString&); | 120 inline void parseURI(CSSParserString&); |
121 | |
118 template <typename CharacterType> | 122 template <typename CharacterType> |
119 inline bool parseUnicodeRange(); | 123 inline bool parseUnicodeRange(); |
120 template <typename CharacterType> | 124 template <typename CharacterType> |
121 bool parseNthChild(); | 125 bool parseNthChild(); |
122 template <typename CharacterType> | 126 template <typename CharacterType> |
123 bool parseNthChildExtra(); | 127 bool parseNthChildExtra(); |
124 template <typename CharacterType> | 128 template <typename CharacterType> |
125 inline bool detectFunctionTypeToken(int); | 129 inline bool detectFunctionTypeToken(int); |
126 template <typename CharacterType> | 130 template <typename CharacterType> |
127 inline void detectMediaQueryToken(int); | 131 inline void detectMediaQueryToken(int); |
(...skipping 20 matching lines...) Expand all Loading... | |
148 SupportsMode, | 152 SupportsMode, |
149 NthChildMode | 153 NthChildMode |
150 }; | 154 }; |
151 | 155 |
152 ParsingMode m_parsingMode; | 156 ParsingMode m_parsingMode; |
153 bool m_is8BitSource; | 157 bool m_is8BitSource; |
154 OwnPtr<LChar[]> m_dataStart8; | 158 OwnPtr<LChar[]> m_dataStart8; |
155 OwnPtr<UChar[]> m_dataStart16; | 159 OwnPtr<UChar[]> m_dataStart16; |
156 LChar* m_currentCharacter8; | 160 LChar* m_currentCharacter8; |
157 UChar* m_currentCharacter16; | 161 UChar* m_currentCharacter16; |
162 Vector<OwnPtr<UChar[]> > m_cssStrings16; | |
Julien - ping for review
2014/03/20 20:57:39
Really not a huge fan of the Vector approach but w
Daniel Bratell
2014/03/21 15:14:39
Done. - Though I wouldn't call it giant. It will b
Julien - ping for review
2014/03/21 17:56:26
I meant giant *hack* Vector but forgot one word. I
| |
158 union { | 163 union { |
159 LChar* ptr8; | 164 LChar* ptr8; |
160 UChar* ptr16; | 165 UChar* ptr16; |
161 } m_tokenStart; | 166 } m_tokenStart; |
162 unsigned m_length; | 167 unsigned m_length; |
163 int m_token; | 168 int m_token; |
164 int m_lineNumber; | 169 int m_lineNumber; |
165 int m_tokenStartLineNumber; | 170 int m_tokenStartLineNumber; |
166 | 171 |
167 // FIXME: This boolean is misnamed. Also it would be nice if we could consol idate it | 172 // FIXME: This boolean is misnamed. Also it would be nice if we could consol idate it |
(...skipping 18 matching lines...) Expand all Loading... | |
186 | 191 |
187 template <> | 192 template <> |
188 inline UChar* CSSTokenizer::tokenStart<UChar>() | 193 inline UChar* CSSTokenizer::tokenStart<UChar>() |
189 { | 194 { |
190 return m_tokenStart.ptr16; | 195 return m_tokenStart.ptr16; |
191 } | 196 } |
192 | 197 |
193 } // namespace WebCore | 198 } // namespace WebCore |
194 | 199 |
195 #endif // CSSTokenizer_h | 200 #endif // CSSTokenizer_h |
OLD | NEW |