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

Unified Diff: Source/core/inspector/DOMPatchSupport.cpp

Issue 23453033: Have DOMPatchSupport and DocumentFragment deal with Document references (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/DOMPatchSupport.h ('k') | Source/core/inspector/InspectorDOMAgent.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/DOMPatchSupport.cpp
diff --git a/Source/core/inspector/DOMPatchSupport.cpp b/Source/core/inspector/DOMPatchSupport.cpp
index a61dd7346cf8355ebc9a448439317ca08a2db5f3..7f9867888db9ce8d5ad785ad5b346b8f97f5a7b7 100644
--- a/Source/core/inspector/DOMPatchSupport.cpp
+++ b/Source/core/inspector/DOMPatchSupport.cpp
@@ -68,7 +68,7 @@ struct DOMPatchSupport::Digest {
Vector<OwnPtr<Digest> > m_children;
};
-void DOMPatchSupport::patchDocument(Document* document, const String& markup)
+void DOMPatchSupport::patchDocument(Document& document, const String& markup)
{
InspectorHistory history;
DOMEditor domEditor(&history);
@@ -76,7 +76,7 @@ void DOMPatchSupport::patchDocument(Document* document, const String& markup)
patchSupport.patchDocument(markup);
}
-DOMPatchSupport::DOMPatchSupport(DOMEditor* domEditor, Document* document)
+DOMPatchSupport::DOMPatchSupport(DOMEditor* domEditor, Document& document)
: m_domEditor(domEditor)
, m_document(document)
{
@@ -87,17 +87,17 @@ DOMPatchSupport::~DOMPatchSupport() { }
void DOMPatchSupport::patchDocument(const String& markup)
{
RefPtr<Document> newDocument;
- if (m_document->isHTMLDocument())
+ if (m_document.isHTMLDocument())
newDocument = HTMLDocument::create();
- else if (m_document->isXHTMLDocument())
+ else if (m_document.isXHTMLDocument())
newDocument = HTMLDocument::createXHTML();
- else if (m_document->isSVGDocument())
+ else if (m_document.isSVGDocument())
newDocument = Document::create();
ASSERT(newDocument);
- newDocument->setContextFeatures(m_document->contextFeatures());
+ newDocument->setContextFeatures(m_document.contextFeatures());
RefPtr<DocumentParser> parser;
- if (m_document->isHTMLDocument())
+ if (m_document.isHTMLDocument())
parser = HTMLDocumentParser::create(toHTMLDocument(newDocument.get()), false);
else
parser = XMLDocumentParser::create(newDocument.get(), 0);
@@ -105,13 +105,13 @@ void DOMPatchSupport::patchDocument(const String& markup)
parser->finish();
parser->detach();
- OwnPtr<Digest> oldInfo = createDigest(m_document->documentElement(), 0);
+ OwnPtr<Digest> oldInfo = createDigest(m_document.documentElement(), 0);
OwnPtr<Digest> newInfo = createDigest(newDocument->documentElement(), &m_unusedNodesMap);
if (!innerPatchNode(oldInfo.get(), newInfo.get(), IGNORE_EXCEPTION)) {
// Fall back to rewrite.
- m_document->write(markup);
- m_document->close();
+ m_document.write(markup);
+ m_document.close();
}
}
@@ -126,10 +126,10 @@ Node* DOMPatchSupport::patchNode(Node* node, const String& markup, ExceptionStat
Node* previousSibling = node->previousSibling();
// FIXME: This code should use one of createFragment* in markup.h
RefPtr<DocumentFragment> fragment = DocumentFragment::create(m_document);
- if (m_document->isHTMLDocument())
- fragment->parseHTML(markup, node->parentElement() ? node->parentElement() : m_document->documentElement());
+ if (m_document.isHTMLDocument())
+ fragment->parseHTML(markup, node->parentElement() ? node->parentElement() : m_document.documentElement());
else
- fragment->parseXML(markup, node->parentElement() ? node->parentElement() : m_document->documentElement());
+ fragment->parseXML(markup, node->parentElement() ? node->parentElement() : m_document.documentElement());
// Compose the old list.
ContainerNode* parentNode = node->parentNode();
« no previous file with comments | « Source/core/inspector/DOMPatchSupport.h ('k') | Source/core/inspector/InspectorDOMAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698