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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 void HTMLConstructionSite::dispatchDocumentElementAvailableIfNeeded() | 245 void HTMLConstructionSite::dispatchDocumentElementAvailableIfNeeded() |
246 { | 246 { |
247 ASSERT(m_document); | 247 ASSERT(m_document); |
248 if (m_document->frame() && !m_isParsingFragment) | 248 if (m_document->frame() && !m_isParsingFragment) |
249 m_document->frame()->loader()->dispatchDocumentElementAvailable(); | 249 m_document->frame()->loader()->dispatchDocumentElementAvailable(); |
250 } | 250 } |
251 | 251 |
252 void HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML(AtomicHTMLToken* tok
en) | 252 void HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML(AtomicHTMLToken* tok
en) |
253 { | 253 { |
254 RefPtr<HTMLHtmlElement> element = HTMLHtmlElement::create(m_document); | 254 ASSERT(m_document); |
| 255 RefPtr<HTMLHtmlElement> element = HTMLHtmlElement::create(*m_document); |
255 setAttributes(element.get(), token, m_parserContentPolicy); | 256 setAttributes(element.get(), token, m_parserContentPolicy); |
256 attachLater(m_attachmentRoot, element); | 257 attachLater(m_attachmentRoot, element); |
257 m_openElements.pushHTMLHtmlElement(HTMLStackItem::create(element, token)); | 258 m_openElements.pushHTMLHtmlElement(HTMLStackItem::create(element, token)); |
258 | 259 |
259 executeQueuedTasks(); | 260 executeQueuedTasks(); |
260 element->insertedByParser(); | 261 element->insertedByParser(); |
261 dispatchDocumentElementAvailableIfNeeded(); | 262 dispatchDocumentElementAvailableIfNeeded(); |
262 } | 263 } |
263 | 264 |
264 void HTMLConstructionSite::mergeAttributesFromTokenIntoElement(AtomicHTMLToken*
token, Element* element) | 265 void HTMLConstructionSite::mergeAttributesFromTokenIntoElement(AtomicHTMLToken*
token, Element* element) |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 | 498 |
498 void HTMLConstructionSite::insertScriptElement(AtomicHTMLToken* token) | 499 void HTMLConstructionSite::insertScriptElement(AtomicHTMLToken* token) |
499 { | 500 { |
500 // http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.h
tml#already-started | 501 // http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.h
tml#already-started |
501 // http://html5.org/specs/dom-parsing.html#dom-range-createcontextualfragmen
t | 502 // http://html5.org/specs/dom-parsing.html#dom-range-createcontextualfragmen
t |
502 // For createContextualFragment, the specifications say to mark it parser-in
serted and already-started and later unmark them. | 503 // For createContextualFragment, the specifications say to mark it parser-in
serted and already-started and later unmark them. |
503 // However, we short circuit that logic to avoid the subtree traversal to fi
nd script elements since scripts can never see | 504 // However, we short circuit that logic to avoid the subtree traversal to fi
nd script elements since scripts can never see |
504 // those flags or effects thereof. | 505 // those flags or effects thereof. |
505 const bool parserInserted = m_parserContentPolicy != AllowScriptingContentAn
dDoNotMarkAlreadyStarted; | 506 const bool parserInserted = m_parserContentPolicy != AllowScriptingContentAn
dDoNotMarkAlreadyStarted; |
506 const bool alreadyStarted = m_isParsingFragment && parserInserted; | 507 const bool alreadyStarted = m_isParsingFragment && parserInserted; |
507 RefPtr<HTMLScriptElement> element = HTMLScriptElement::create(scriptTag, &ow
nerDocumentForCurrentNode(), parserInserted, alreadyStarted); | 508 RefPtr<HTMLScriptElement> element = HTMLScriptElement::create(scriptTag, own
erDocumentForCurrentNode(), parserInserted, alreadyStarted); |
508 setAttributes(element.get(), token, m_parserContentPolicy); | 509 setAttributes(element.get(), token, m_parserContentPolicy); |
509 if (scriptingContentIsAllowed(m_parserContentPolicy)) | 510 if (scriptingContentIsAllowed(m_parserContentPolicy)) |
510 attachLater(currentNode(), element); | 511 attachLater(currentNode(), element); |
511 m_openElements.push(HTMLStackItem::create(element.release(), token)); | 512 m_openElements.push(HTMLStackItem::create(element.release(), token)); |
512 } | 513 } |
513 | 514 |
514 void HTMLConstructionSite::insertForeignElement(AtomicHTMLToken* token, const At
omicString& namespaceURI) | 515 void HTMLConstructionSite::insertForeignElement(AtomicHTMLToken* token, const At
omicString& namespaceURI) |
515 { | 516 { |
516 ASSERT(token->type() == HTMLToken::StartTag); | 517 ASSERT(token->type() == HTMLToken::StartTag); |
517 notImplemented(); // parseError when xmlns or xmlns:xlink are wrong. | 518 notImplemented(); // parseError when xmlns or xmlns:xlink are wrong. |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 { | 744 { |
744 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); | 745 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); |
745 findFosterSite(task); | 746 findFosterSite(task); |
746 task.child = node; | 747 task.child = node; |
747 ASSERT(task.parent); | 748 ASSERT(task.parent); |
748 | 749 |
749 m_taskQueue.append(task); | 750 m_taskQueue.append(task); |
750 } | 751 } |
751 | 752 |
752 } | 753 } |
OLD | NEW |