| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 3 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 State getState() const { return m_state; } | 174 State getState() const { return m_state; } |
| 175 void setState(State state) { m_state = state; } | 175 void setState(State state) { m_state = state; } |
| 176 | 176 |
| 177 inline bool shouldSkipNullCharacters() const { | 177 inline bool shouldSkipNullCharacters() const { |
| 178 return !m_forceNullCharacterReplacement && | 178 return !m_forceNullCharacterReplacement && |
| 179 (m_state == HTMLTokenizer::DataState || | 179 (m_state == HTMLTokenizer::DataState || |
| 180 m_state == HTMLTokenizer::RCDATAState || | 180 m_state == HTMLTokenizer::RCDATAState || |
| 181 m_state == HTMLTokenizer::RAWTEXTState); | 181 m_state == HTMLTokenizer::RAWTEXTState); |
| 182 } | 182 } |
| 183 void reserveAttributeForCheck(); |
| 184 bool checkIfMergeScripts(SegmentedString&); |
| 185 const HTMLToken::Attribute* getAttributeFromList(const QualifiedName& name) { |
| 186 for (unsigned i = 0; i < m_temporaryAttributeList.size(); ++i) { |
| 187 if (m_temporaryAttributeList.at(i).name() == name.localName()) |
| 188 return &m_temporaryAttributeList.at(i); |
| 189 } |
| 190 return 0; |
| 191 } |
| 192 bool compareAttribute(SegmentedString&, unsigned&); |
| 193 bool compareAttributeValue(SegmentedString&, unsigned&, const QualifiedName&); |
| 194 |
| 195 Vector<UChar, 32> m_temporaryAttributeValueBuffer; |
| 183 | 196 |
| 184 private: | 197 private: |
| 185 explicit HTMLTokenizer(const HTMLParserOptions&); | 198 explicit HTMLTokenizer(const HTMLParserOptions&); |
| 186 | 199 |
| 187 inline bool processEntity(SegmentedString&); | 200 inline bool processEntity(SegmentedString&); |
| 188 | 201 |
| 189 inline void parseError(); | 202 inline void parseError(); |
| 190 | 203 |
| 191 inline void bufferCharacter(UChar character) { | 204 inline void bufferCharacter(UChar character) { |
| 192 ASSERT(character != kEndOfFileMarker); | 205 ASSERT(character != kEndOfFileMarker); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 254 } |
| 242 | 255 |
| 243 State m_state; | 256 State m_state; |
| 244 bool m_forceNullCharacterReplacement; | 257 bool m_forceNullCharacterReplacement; |
| 245 bool m_shouldAllowCDATA; | 258 bool m_shouldAllowCDATA; |
| 246 | 259 |
| 247 // m_token is owned by the caller. If nextToken is not on the stack, | 260 // m_token is owned by the caller. If nextToken is not on the stack, |
| 248 // this member might be pointing to unallocated memory. | 261 // this member might be pointing to unallocated memory. |
| 249 HTMLToken* m_token; | 262 HTMLToken* m_token; |
| 250 | 263 |
| 264 HTMLToken::AttributeList m_temporaryAttributeList; |
| 265 |
| 251 // http://www.whatwg.org/specs/web-apps/current-work/#additional-allowed-chara
cter | 266 // http://www.whatwg.org/specs/web-apps/current-work/#additional-allowed-chara
cter |
| 252 UChar m_additionalAllowedCharacter; | 267 UChar m_additionalAllowedCharacter; |
| 253 | 268 |
| 254 // http://www.whatwg.org/specs/web-apps/current-work/#preprocessing-the-input-
stream | 269 // http://www.whatwg.org/specs/web-apps/current-work/#preprocessing-the-input-
stream |
| 255 InputStreamPreprocessor<HTMLTokenizer> m_inputStreamPreprocessor; | 270 InputStreamPreprocessor<HTMLTokenizer> m_inputStreamPreprocessor; |
| 256 | 271 |
| 257 Vector<UChar, 32> m_appropriateEndTagName; | 272 Vector<UChar, 32> m_appropriateEndTagName; |
| 258 | 273 |
| 259 // http://www.whatwg.org/specs/web-apps/current-work/#temporary-buffer | 274 // http://www.whatwg.org/specs/web-apps/current-work/#temporary-buffer |
| 260 Vector<LChar, 32> m_temporaryBuffer; | 275 Vector<LChar, 32> m_temporaryBuffer; |
| 261 | 276 |
| 262 // We occationally want to emit both a character token and an end tag | 277 // We occationally want to emit both a character token and an end tag |
| 263 // token (e.g., when lexing script). We buffer the name of the end tag | 278 // token (e.g., when lexing script). We buffer the name of the end tag |
| 264 // token here so we remember it next time we re-enter the tokenizer. | 279 // token here so we remember it next time we re-enter the tokenizer. |
| 265 Vector<LChar, 32> m_bufferedEndTagName; | 280 Vector<LChar, 32> m_bufferedEndTagName; |
| 266 | 281 |
| 267 HTMLParserOptions m_options; | 282 HTMLParserOptions m_options; |
| 268 }; | 283 }; |
| 269 | 284 |
| 270 } // namespace blink | 285 } // namespace blink |
| 271 | 286 |
| 272 #endif | 287 #endif |
| OLD | NEW |