Index: Source/core/html/parser/HTMLConstructionSite.cpp |
diff --git a/Source/core/html/parser/HTMLConstructionSite.cpp b/Source/core/html/parser/HTMLConstructionSite.cpp |
index 9f0c91ffb0c76eb3c225887f2606ad67733d3128..2f9bcf97fdddf823f344df9c8e0fd12673f43124 100644 |
--- a/Source/core/html/parser/HTMLConstructionSite.cpp |
+++ b/Source/core/html/parser/HTMLConstructionSite.cpp |
@@ -210,12 +210,12 @@ HTMLConstructionSite::HTMLConstructionSite(Document* document, ParserContentPoli |
} |
HTMLConstructionSite::HTMLConstructionSite(DocumentFragment* fragment, ParserContentPolicy parserContentPolicy) |
- : m_document(fragment->document()) |
+ : m_document(&fragment->document()) |
, m_attachmentRoot(fragment) |
, m_parserContentPolicy(parserContentPolicy) |
, m_isParsingFragment(true) |
, m_redirectAttachToFosterParent(false) |
- , m_inQuirksMode(fragment->document()->inQuirksMode()) |
+ , m_inQuirksMode(fragment->document().inQuirksMode()) |
{ |
ASSERT(m_document->isHTMLDocument() || m_document->isSVGDocument() || m_document->isXHTMLDocument()); |
} |
@@ -424,7 +424,7 @@ void HTMLConstructionSite::insertDoctype(AtomicHTMLToken* token) |
void HTMLConstructionSite::insertComment(AtomicHTMLToken* token) |
{ |
ASSERT(token->type() == HTMLToken::Comment); |
- attachLater(currentNode(), Comment::create(ownerDocumentForCurrentNode(), token->comment())); |
+ attachLater(currentNode(), Comment::create(&ownerDocumentForCurrentNode(), token->comment())); |
} |
void HTMLConstructionSite::insertCommentOnDocument(AtomicHTMLToken* token) |
@@ -437,7 +437,7 @@ void HTMLConstructionSite::insertCommentOnHTMLHtmlElement(AtomicHTMLToken* token |
{ |
ASSERT(token->type() == HTMLToken::Comment); |
ContainerNode* parent = m_openElements.rootNode(); |
- attachLater(parent, Comment::create(parent->document(), token->comment())); |
+ attachLater(parent, Comment::create(&parent->document(), token->comment())); |
} |
void HTMLConstructionSite::insertHTMLHeadElement(AtomicHTMLToken* token) |
@@ -504,7 +504,7 @@ void HTMLConstructionSite::insertScriptElement(AtomicHTMLToken* token) |
// those flags or effects thereof. |
const bool parserInserted = m_parserContentPolicy != AllowScriptingContentAndDoNotMarkAlreadyStarted; |
const bool alreadyStarted = m_isParsingFragment && parserInserted; |
- RefPtr<HTMLScriptElement> element = HTMLScriptElement::create(scriptTag, ownerDocumentForCurrentNode(), parserInserted, alreadyStarted); |
+ RefPtr<HTMLScriptElement> element = HTMLScriptElement::create(scriptTag, &ownerDocumentForCurrentNode(), parserInserted, alreadyStarted); |
setAttributes(element.get(), token, m_parserContentPolicy); |
if (scriptingContentIsAllowed(m_parserContentPolicy)) |
attachLater(currentNode(), element); |
@@ -554,11 +554,11 @@ void HTMLConstructionSite::insertTextNode(const String& characters, WhitespaceMo |
} |
while (currentPosition < characters.length()) { |
- RefPtr<Text> textNode = Text::createWithLengthLimit(task.parent->document(), shouldUseAtomicString ? AtomicString(characters).string() : characters, currentPosition, lengthLimit); |
+ RefPtr<Text> textNode = Text::createWithLengthLimit(&task.parent->document(), shouldUseAtomicString ? AtomicString(characters).string() : characters, currentPosition, lengthLimit); |
// If we have a whole string of unbreakable characters the above could lead to an infinite loop. Exceeding the length limit is the lesser evil. |
if (!textNode->length()) { |
String substring = characters.substring(currentPosition); |
- textNode = Text::create(task.parent->document(), shouldUseAtomicString ? AtomicString(substring).string() : substring); |
+ textNode = Text::create(&task.parent->document(), shouldUseAtomicString ? AtomicString(substring).string() : substring); |
} |
currentPosition += textNode->length(); |
@@ -609,12 +609,12 @@ void HTMLConstructionSite::takeAllChildren(HTMLStackItem* newParent, HTMLElement |
PassRefPtr<Element> HTMLConstructionSite::createElement(AtomicHTMLToken* token, const AtomicString& namespaceURI) |
{ |
QualifiedName tagName(nullAtom, token->name(), namespaceURI); |
- RefPtr<Element> element = ownerDocumentForCurrentNode()->createElement(tagName, true); |
+ RefPtr<Element> element = ownerDocumentForCurrentNode().createElement(tagName, true); |
setAttributes(element.get(), token, m_parserContentPolicy); |
return element.release(); |
} |
-inline Document* HTMLConstructionSite::ownerDocumentForCurrentNode() |
+inline Document& HTMLConstructionSite::ownerDocumentForCurrentNode() |
{ |
if (currentNode()->hasTagName(templateTag)) |
return toHTMLTemplateElement(currentElement())->content()->document(); |
@@ -624,14 +624,14 @@ inline Document* HTMLConstructionSite::ownerDocumentForCurrentNode() |
PassRefPtr<Element> HTMLConstructionSite::createHTMLElement(AtomicHTMLToken* token) |
{ |
QualifiedName tagName(nullAtom, token->name(), xhtmlNamespaceURI); |
- Document* document = ownerDocumentForCurrentNode(); |
+ Document& document = ownerDocumentForCurrentNode(); |
// Only associate the element with the current form if we're creating the new element |
// in a document with a browsing context (rather than in <template> contents). |
- HTMLFormElement* form = document->frame() ? m_form.get() : 0; |
+ HTMLFormElement* form = document.frame() ? m_form.get() : 0; |
// FIXME: This can't use HTMLConstructionSite::createElement because we |
// have to pass the current form element. We should rework form association |
// to occur after construction to allow better code sharing here. |
- RefPtr<Element> element = HTMLElementFactory::createHTMLElement(tagName, document, form, true); |
+ RefPtr<Element> element = HTMLElementFactory::createHTMLElement(tagName, &document, form, true); |
setAttributes(element.get(), token, m_parserContentPolicy); |
ASSERT(element->isHTMLElement()); |
return element.release(); |