Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
| 3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 #ifndef NDEBUG | 331 #ifndef NDEBUG |
| 332 // This call makes little sense in fragment mode, but for consistency | 332 // This call makes little sense in fragment mode, but for consistency |
| 333 // DocumentParser expects detach() to always be called before it's destroyed . | 333 // DocumentParser expects detach() to always be called before it's destroyed . |
| 334 m_isAttached = false; | 334 m_isAttached = false; |
| 335 #endif | 335 #endif |
| 336 // HTMLConstructionSite might be on the callstack when detach() is called | 336 // HTMLConstructionSite might be on the callstack when detach() is called |
| 337 // otherwise we'd just call m_tree.clear() here instead. | 337 // otherwise we'd just call m_tree.clear() here instead. |
| 338 m_tree.detach(); | 338 m_tree.detach(); |
| 339 } | 339 } |
| 340 | 340 |
| 341 void HTMLTreeBuilder::flush() | |
| 342 { | |
| 343 m_tree.flush(); | |
| 344 } | |
| 345 | |
| 341 HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext() | 346 HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext() |
| 342 : m_fragment(0) | 347 : m_fragment(0) |
| 343 , m_contextElement(0) | 348 , m_contextElement(0) |
| 344 { | 349 { |
| 345 } | 350 } |
| 346 | 351 |
| 347 HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext(DocumentFragment * fragment, Element* contextElement) | 352 HTMLTreeBuilder::FragmentParsingContext::FragmentParsingContext(DocumentFragment * fragment, Element* contextElement) |
| 348 : m_fragment(fragment) | 353 : m_fragment(fragment) |
| 349 , m_contextElement(contextElement) | 354 , m_contextElement(contextElement) |
| 350 { | 355 { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 388 // We might be detached now. | 393 // We might be detached now. |
| 389 } | 394 } |
| 390 | 395 |
| 391 void HTMLTreeBuilder::processToken(AtomicHTMLToken* token) | 396 void HTMLTreeBuilder::processToken(AtomicHTMLToken* token) |
| 392 { | 397 { |
| 393 if (token->type() == HTMLToken::Character) { | 398 if (token->type() == HTMLToken::Character) { |
| 394 processCharacter(token); | 399 processCharacter(token); |
| 395 return; | 400 return; |
| 396 } | 401 } |
| 397 | 402 |
| 403 // Any non-character token needs to cause us to flush any pending text immed iately. | |
| 404 // NOTE: flush() can cause any queued tasks to execute, possibly re-entering the parser. | |
| 405 m_tree.flush(); | |
|
abarth-chromium
2013/10/11 18:54:04
I wonder if we need a faster reject here in the ca
| |
| 398 m_shouldSkipLeadingNewline = false; | 406 m_shouldSkipLeadingNewline = false; |
| 399 | 407 |
| 400 switch (token->type()) { | 408 switch (token->type()) { |
| 401 case HTMLToken::Uninitialized: | 409 case HTMLToken::Uninitialized: |
| 402 case HTMLToken::Character: | 410 case HTMLToken::Character: |
| 403 ASSERT_NOT_REACHED(); | 411 ASSERT_NOT_REACHED(); |
| 404 break; | 412 break; |
| 405 case HTMLToken::DOCTYPE: | 413 case HTMLToken::DOCTYPE: |
| 406 processDoctypeToken(token); | 414 processDoctypeToken(token); |
| 407 break; | 415 break; |
| (...skipping 2414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2822 ASSERT(m_isAttached); | 2830 ASSERT(m_isAttached); |
| 2823 // Warning, this may detach the parser. Do not do anything else after this. | 2831 // Warning, this may detach the parser. Do not do anything else after this. |
| 2824 m_tree.finishedParsing(); | 2832 m_tree.finishedParsing(); |
| 2825 } | 2833 } |
| 2826 | 2834 |
| 2827 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) | 2835 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) |
| 2828 { | 2836 { |
| 2829 } | 2837 } |
| 2830 | 2838 |
| 2831 } // namespace WebCore | 2839 } // namespace WebCore |
| OLD | NEW |