Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp

Issue 2042413002: Notify the HTMLDocumentParser on document element available (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: insertedByParser after actual insertion point Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698