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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 // This method should only be needed for HTMLTreeBuilder in the fragment cas
e. | 372 // This method should only be needed for HTMLTreeBuilder in the fragment cas
e. |
373 ASSERT(!m_form); | 373 ASSERT(!m_form); |
374 m_form = form; | 374 m_form = form; |
375 } | 375 } |
376 | 376 |
377 HTMLFormElement* HTMLConstructionSite::takeForm() | 377 HTMLFormElement* HTMLConstructionSite::takeForm() |
378 { | 378 { |
379 return m_form.release(); | 379 return m_form.release(); |
380 } | 380 } |
381 | 381 |
382 void HTMLConstructionSite::dispatchDocumentElementAvailableIfNeeded() | |
383 { | |
384 ASSERT(m_document); | |
385 if (m_document->frame() && !m_isParsingFragment) { | |
386 m_document->frame()->loader().dispatchDocumentElementAvailable(); | |
387 m_document->frame()->loader().runScriptsAtDocumentElementAvailable(); | |
388 // runScriptsAtDocumentElementAvailable might have invalidated m_documen
t. | |
389 } | |
390 } | |
391 | |
392 void HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML(AtomicHTMLToken* tok
en) | 382 void HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML(AtomicHTMLToken* tok
en) |
393 { | 383 { |
394 ASSERT(m_document); | 384 ASSERT(m_document); |
395 HTMLHtmlElement* element = HTMLHtmlElement::create(*m_document); | 385 HTMLHtmlElement* element = HTMLHtmlElement::create(*m_document); |
396 setAttributes(element, token, m_parserContentPolicy); | 386 setAttributes(element, token, m_parserContentPolicy); |
397 attachLater(m_attachmentRoot, element); | 387 attachLater(m_attachmentRoot, element); |
398 m_openElements.pushHTMLHtmlElement(HTMLStackItem::create(element, token)); | 388 m_openElements.pushHTMLHtmlElement(HTMLStackItem::create(element, token)); |
399 | 389 |
400 executeQueuedTasks(); | 390 executeQueuedTasks(); |
401 element->insertedByParser(); | 391 element->insertedByParser(); |
402 dispatchDocumentElementAvailableIfNeeded(); | |
403 } | 392 } |
404 | 393 |
405 void HTMLConstructionSite::mergeAttributesFromTokenIntoElement(AtomicHTMLToken*
token, Element* element) | 394 void HTMLConstructionSite::mergeAttributesFromTokenIntoElement(AtomicHTMLToken*
token, Element* element) |
406 { | 395 { |
407 if (token->attributes().isEmpty()) | 396 if (token->attributes().isEmpty()) |
408 return; | 397 return; |
409 | 398 |
410 for (unsigned i = 0; i < token->attributes().size(); ++i) { | 399 for (unsigned i = 0; i < token->attributes().size(); ++i) { |
411 const Attribute& tokenAttribute = token->attributes().at(i); | 400 const Attribute& tokenAttribute = token->attributes().at(i); |
412 if (element->attributesWithoutUpdate().findIndex(tokenAttribute.name())
== kNotFound) | 401 if (element->attributesWithoutUpdate().findIndex(tokenAttribute.name())
== kNotFound) |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 queueTask(task); | 875 queueTask(task); |
887 } | 876 } |
888 | 877 |
889 DEFINE_TRACE(HTMLConstructionSite::PendingText) | 878 DEFINE_TRACE(HTMLConstructionSite::PendingText) |
890 { | 879 { |
891 visitor->trace(parent); | 880 visitor->trace(parent); |
892 visitor->trace(nextChild); | 881 visitor->trace(nextChild); |
893 } | 882 } |
894 | 883 |
895 } // namespace blink | 884 } // namespace blink |
OLD | NEW |