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

Unified Diff: Source/core/editing/markup.cpp

Issue 289273002: Oilpan: make DocumentFragment a heap allocated object. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased + add WillBeGarbageCollected FIXME. Created 6 years, 7 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/events/TextEvent.h » ('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 2ea076869acc2465946b2c0dd052084f46f536dc..d6f21373d46312daa8e3bb0b3c17e7f4833c6fda 100644
--- a/Source/core/editing/markup.cpp
+++ b/Source/core/editing/markup.cpp
@@ -635,11 +635,11 @@ 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)
+PassRefPtrWillBeRawPtr<DocumentFragment> createFragmentFromMarkup(Document& document, const String& markup, const String& baseURL, ParserContentPolicy parserContentPolicy)
{
// 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<DocumentFragment> fragment = DocumentFragment::create(document);
+ RefPtrWillBeRawPtr<DocumentFragment> fragment = DocumentFragment::create(document);
fragment->parseHTML(markup, fakeBody.get(), parserContentPolicy);
@@ -688,7 +688,7 @@ static void trimFragment(DocumentFragment* fragment, Node* nodeBeforeContext, No
}
}
-PassRefPtr<DocumentFragment> createFragmentFromMarkupWithContext(Document& document, const String& markup, unsigned fragmentStart, unsigned fragmentEnd,
+PassRefPtrWillBeRawPtr<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.
@@ -700,8 +700,8 @@ PassRefPtr<DocumentFragment> createFragmentFromMarkupWithContext(Document& docum
MarkupAccumulator::appendComment(taggedMarkup, fragmentMarkerTag);
taggedMarkup.append(markup.substring(fragmentEnd));
- RefPtr<DocumentFragment> taggedFragment = createFragmentFromMarkup(document, taggedMarkup.toString(), baseURL, parserContentPolicy);
- RefPtr<Document> taggedDocument = Document::create();
+ RefPtrWillBeRawPtr<DocumentFragment> taggedFragment = createFragmentFromMarkup(document, taggedMarkup.toString(), baseURL, parserContentPolicy);
+ RefPtrWillBeRawPtr<Document> taggedDocument = Document::create();
taggedDocument->setContextFeatures(document.contextFeatures());
// FIXME: It's not clear what this code is trying to do. It puts nodes as direct children of a
@@ -723,7 +723,7 @@ PassRefPtr<DocumentFragment> createFragmentFromMarkupWithContext(Document& docum
// When there's a special common ancestor outside of the fragment, we must include it as well to
// preserve the structure and appearance of the fragment. For example, if the fragment contains
// TD, we need to include the enclosing TABLE tag as well.
- RefPtr<DocumentFragment> fragment = DocumentFragment::create(document);
+ RefPtrWillBeRawPtr<DocumentFragment> fragment = DocumentFragment::create(document);
if (specialCommonAncestor)
fragment->appendChild(specialCommonAncestor);
else
@@ -768,7 +768,7 @@ static void fillContainerFromString(ContainerNode* paragraph, const String& stri
paragraph->appendChild(createTabSpanElement(document, tabText.toString()));
tabText.clear();
}
- RefPtr<Node> textNode = document.createTextNode(stringWithRebalancedWhitespace(s, first, i + 1 == numEntries));
+ RefPtrWillBeRawPtr<Node> textNode = document.createTextNode(stringWithRebalancedWhitespace(s, first, i + 1 == numEntries));
paragraph->appendChild(textNode.release());
}
@@ -814,13 +814,13 @@ static bool shouldPreserveNewline(const Range& range)
return false;
}
-PassRefPtr<DocumentFragment> createFragmentFromText(Range* context, const String& text)
+PassRefPtrWillBeRawPtr<DocumentFragment> createFragmentFromText(Range* context, const String& text)
{
if (!context)
return nullptr;
Document& document = context->ownerDocument();
- RefPtr<DocumentFragment> fragment = document.createDocumentFragment();
+ RefPtrWillBeRawPtr<DocumentFragment> fragment = document.createDocumentFragment();
if (text.isEmpty())
return fragment.release();
@@ -910,11 +910,11 @@ String urlToMarkup(const KURL& url, const String& title)
return markup.toString();
}
-PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String& markup, Element* contextElement, ParserContentPolicy parserContentPolicy, const char* method, ExceptionState& exceptionState)
+PassRefPtrWillBeRawPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String& markup, Element* contextElement, ParserContentPolicy parserContentPolicy, const char* method, ExceptionState& exceptionState)
{
ASSERT(contextElement);
Document& document = isHTMLTemplateElement(*contextElement) ? contextElement->document().ensureTemplateDocument() : contextElement->document();
- RefPtr<DocumentFragment> fragment = DocumentFragment::create(document);
+ RefPtrWillBeRawPtr<DocumentFragment> fragment = DocumentFragment::create(document);
if (document.isHTMLDocument()) {
fragment->parseHTML(markup, contextElement, parserContentPolicy);
@@ -929,9 +929,9 @@ PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String& marku
return fragment.release();
}
-PassRefPtr<DocumentFragment> createFragmentForTransformToFragment(const String& sourceString, const String& sourceMIMEType, Document& outputDoc)
+PassRefPtrWillBeRawPtr<DocumentFragment> createFragmentForTransformToFragment(const String& sourceString, const String& sourceMIMEType, Document& outputDoc)
{
- RefPtr<DocumentFragment> fragment = outputDoc.createDocumentFragment();
+ RefPtrWillBeRawPtr<DocumentFragment> fragment = outputDoc.createDocumentFragment();
if (sourceMIMEType == "text/html") {
// As far as I can tell, there isn't a spec for how transformToFragment is supposed to work.
@@ -953,7 +953,7 @@ PassRefPtr<DocumentFragment> createFragmentForTransformToFragment(const String&
return fragment.release();
}
-static inline void removeElementPreservingChildren(PassRefPtr<DocumentFragment> fragment, HTMLElement* element)
+static inline void removeElementPreservingChildren(PassRefPtrWillBeRawPtr<DocumentFragment> fragment, HTMLElement* element)
{
RefPtr<Node> nextChild;
for (RefPtr<Node> child = element->firstChild(); child; child = nextChild) {
@@ -964,7 +964,7 @@ static inline void removeElementPreservingChildren(PassRefPtr<DocumentFragment>
fragment->removeChild(element);
}
-PassRefPtr<DocumentFragment> createContextualFragment(const String& markup, HTMLElement* element, ParserContentPolicy parserContentPolicy, ExceptionState& exceptionState)
+PassRefPtrWillBeRawPtr<DocumentFragment> createContextualFragment(const String& markup, HTMLElement* element, ParserContentPolicy parserContentPolicy, ExceptionState& exceptionState)
{
ASSERT(element);
if (element->ieForbidsInsertHTML() || element->hasLocalName(colTag) || element->hasLocalName(colgroupTag) || element->hasLocalName(framesetTag)
@@ -973,7 +973,7 @@ PassRefPtr<DocumentFragment> createContextualFragment(const String& markup, HTML
return nullptr;
}
- RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, element, parserContentPolicy, "createContextualFragment", exceptionState);
+ RefPtrWillBeRawPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, element, parserContentPolicy, "createContextualFragment", exceptionState);
if (!fragment)
return nullptr;
@@ -994,10 +994,10 @@ PassRefPtr<DocumentFragment> createContextualFragment(const String& markup, HTML
return fragment.release();
}
-void replaceChildrenWithFragment(ContainerNode* container, PassRefPtr<DocumentFragment> fragment, ExceptionState& exceptionState)
+void replaceChildrenWithFragment(ContainerNode* container, PassRefPtrWillBeRawPtr<DocumentFragment> fragment, ExceptionState& exceptionState)
{
ASSERT(container);
- RefPtr<ContainerNode> containerNode(container);
+ RefPtrWillBeRawPtr<ContainerNode> containerNode(container);
ChildListMutationScope mutation(*containerNode);
@@ -1025,7 +1025,7 @@ void replaceChildrenWithFragment(ContainerNode* container, PassRefPtr<DocumentFr
void replaceChildrenWithText(ContainerNode* container, const String& text, ExceptionState& exceptionState)
{
ASSERT(container);
- RefPtr<ContainerNode> containerNode(container);
+ RefPtrWillBeRawPtr<ContainerNode> containerNode(container);
ChildListMutationScope mutation(*containerNode);
« no previous file with comments | « Source/core/editing/markup.h ('k') | Source/core/events/TextEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698