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

Unified Diff: Source/core/editing/markup.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/editing/markup.h ('k') | Source/core/html/HTMLElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/markup.cpp
diff --git a/Source/core/editing/markup.cpp b/Source/core/editing/markup.cpp
index 523951468c8d39071d4ea27590895e9a750e3804..386f8fb9690d1ad3be051d038d6f2a15e05d70bb 100644
--- a/Source/core/editing/markup.cpp
+++ b/Source/core/editing/markup.cpp
@@ -638,16 +638,15 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc
return createMarkupInternal(document, range, updatedRange, nodes, shouldAnnotate, convertBlocksToInlines, shouldResolveURLs, constrainingAncestor);
}
-PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document* document, const String& markup, const String& baseURL, ParserContentPolicy parserContentPolicy)
+PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document& document, const String& markup, const String& baseURL, ParserContentPolicy parserContentPolicy)
{
- ASSERT(document);
// We use a fake body element here to trick the HTML parser to using the InBody insertion mode.
- RefPtr<HTMLBodyElement> fakeBody = HTMLBodyElement::create(*document);
+ RefPtr<HTMLBodyElement> fakeBody = HTMLBodyElement::create(document);
RefPtr<DocumentFragment> fragment = DocumentFragment::create(document);
fragment->parseHTML(markup, fakeBody.get(), parserContentPolicy);
- if (!baseURL.isEmpty() && baseURL != blankURL() && baseURL != document->baseURL())
+ if (!baseURL.isEmpty() && baseURL != blankURL() && baseURL != document.baseURL())
completeURLs(fragment.get(), baseURL);
return fragment.release();
@@ -692,7 +691,7 @@ static void trimFragment(DocumentFragment* fragment, Node* nodeBeforeContext, No
}
}
-PassRefPtr<DocumentFragment> createFragmentFromMarkupWithContext(Document* document, const String& markup, unsigned fragmentStart, unsigned fragmentEnd,
+PassRefPtr<DocumentFragment> createFragmentFromMarkupWithContext(Document& document, const String& markup, unsigned fragmentStart, unsigned fragmentEnd,
const String& baseURL, ParserContentPolicy parserContentPolicy)
{
// FIXME: Need to handle the case where the markup already contains these markers.
@@ -706,7 +705,7 @@ PassRefPtr<DocumentFragment> createFragmentFromMarkupWithContext(Document* docum
RefPtr<DocumentFragment> taggedFragment = createFragmentFromMarkup(document, taggedMarkup.toString(), baseURL, parserContentPolicy);
RefPtr<Document> taggedDocument = Document::create();
- taggedDocument->setContextFeatures(document->contextFeatures());
+ taggedDocument->setContextFeatures(document.contextFeatures());
taggedDocument->takeAllChildrenFrom(taggedFragment.get());
RefPtr<Node> nodeBeforeContext;
@@ -942,10 +941,10 @@ String urlToMarkup(const KURL& url, const String& title)
PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String& markup, Element* contextElement, ParserContentPolicy parserContentPolicy, ExceptionState& es)
{
- Document* document = contextElement->hasTagName(templateTag) ? contextElement->document().ensureTemplateDocument() : &contextElement->document();
+ Document& document = contextElement->hasTagName(templateTag) ? contextElement->document().ensureTemplateDocument() : contextElement->document();
RefPtr<DocumentFragment> fragment = DocumentFragment::create(document);
- if (document->isHTMLDocument()) {
+ if (document.isHTMLDocument()) {
fragment->parseHTML(markup, contextElement, parserContentPolicy);
return fragment;
}
« no previous file with comments | « Source/core/editing/markup.h ('k') | Source/core/html/HTMLElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698