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

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

Issue 23548010: Have htmlediting create functions take a Document reference in argument (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/BreakBlockquoteCommand.cpp ('k') | Source/core/editing/DeleteSelectionCommand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/CompositeEditCommand.cpp
diff --git a/Source/core/editing/CompositeEditCommand.cpp b/Source/core/editing/CompositeEditCommand.cpp
index 0d1079292aac91956df0635200139c303d742ff9..b049591423e2fdb76766f90956b54f5b7d56defe 100644
--- a/Source/core/editing/CompositeEditCommand.cpp
+++ b/Source/core/editing/CompositeEditCommand.cpp
@@ -834,7 +834,7 @@ PassRefPtr<Node> CompositeEditCommand::appendBlockPlaceholder(PassRefPtr<Element
// Should assert isBlockFlow || isInlineFlow when deletion improves. See 4244964.
ASSERT(container->renderer());
- RefPtr<Node> placeholder = createBlockPlaceholderElement(&document());
+ RefPtr<Node> placeholder = createBlockPlaceholderElement(document());
appendNode(placeholder, container);
return placeholder.release();
}
@@ -847,7 +847,7 @@ PassRefPtr<Node> CompositeEditCommand::insertBlockPlaceholder(const Position& po
// Should assert isBlockFlow || isInlineFlow when deletion improves. See 4244964.
ASSERT(pos.deprecatedNode()->renderer());
- RefPtr<Node> placeholder = createBlockPlaceholderElement(&document());
+ RefPtr<Node> placeholder = createBlockPlaceholderElement(document());
insertNodeAt(placeholder, pos);
return placeholder.release();
}
@@ -888,8 +888,8 @@ void CompositeEditCommand::removePlaceholderAt(const Position& p)
PassRefPtr<Node> CompositeEditCommand::insertNewDefaultParagraphElementAt(const Position& position)
{
- RefPtr<Element> paragraphElement = createDefaultParagraphElement(&document());
- paragraphElement->appendChild(createBreakElement(&document()));
+ RefPtr<Element> paragraphElement = createDefaultParagraphElement(document());
+ paragraphElement->appendChild(createBreakElement(document()));
insertNodeAt(paragraphElement, position);
return paragraphElement.release();
}
@@ -1126,7 +1126,7 @@ void CompositeEditCommand::moveParagraphWithClones(const VisiblePosition& startO
if (beforeParagraph.isNotNull() && !isTableElement(beforeParagraph.deepEquivalent().deprecatedNode())
&& ((!isEndOfParagraph(beforeParagraph) && !isStartOfParagraph(beforeParagraph)) || beforeParagraph == afterParagraph)) {
// FIXME: Trim text between beforeParagraph and afterParagraph if they aren't equal.
- insertNodeAt(createBreakElement(&document()), beforeParagraph.deepEquivalent());
+ insertNodeAt(createBreakElement(document()), beforeParagraph.deepEquivalent());
}
}
@@ -1221,7 +1221,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
afterParagraph = VisiblePosition(afterParagraph.deepEquivalent());
if (beforeParagraph.isNotNull() && (!isEndOfParagraph(beforeParagraph) || beforeParagraph == afterParagraph)) {
// FIXME: Trim text between beforeParagraph and afterParagraph if they aren't equal.
- insertNodeAt(createBreakElement(&document()), beforeParagraph.deepEquivalent());
+ insertNodeAt(createBreakElement(document()), beforeParagraph.deepEquivalent());
// Need an updateLayout here in case inserting the br has split a text node.
document().updateLayoutIgnorePendingStylesheets();
}
@@ -1284,15 +1284,15 @@ bool CompositeEditCommand::breakOutOfEmptyListItem()
// e.g. <ul><li> <ul><li><br></li></ul> hello</li></ul> should become <ul><li> <div><br></div> hello</li></ul> at the end
splitElement(toElement(blockEnclosingList), listNode);
removeNodePreservingChildren(listNode->parentNode());
- newBlock = createListItemElement(&document());
+ newBlock = createListItemElement(document());
}
// If listNode does NOT appear at the end of the outer list item, then behave as if in a regular paragraph.
} else if (blockEnclosingList->hasTagName(olTag) || blockEnclosingList->hasTagName(ulTag)) {
- newBlock = createListItemElement(&document());
+ newBlock = createListItemElement(document());
}
}
if (!newBlock)
- newBlock = createDefaultParagraphElement(&document());
+ newBlock = createDefaultParagraphElement(document());
RefPtr<Node> previousListNode = emptyListItem->isElementNode() ? toElement(emptyListItem.get())->previousElementSibling(): emptyListItem->previousSibling();
RefPtr<Node> nextListNode = emptyListItem->isElementNode() ? toElement(emptyListItem.get())->nextElementSibling(): emptyListItem->nextSibling();
@@ -1343,7 +1343,7 @@ bool CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph()
if (enclosingNodeOfType(previous.deepEquivalent(), &isMailBlockquote))
return false;
- RefPtr<Node> br = createBreakElement(&document());
+ RefPtr<Node> br = createBreakElement(document());
// We want to replace this quoted paragraph with an unquoted one, so insert a br
// to hold the caret before the highest blockquote.
insertNodeBefore(br, highestBlockquote);
@@ -1351,7 +1351,7 @@ bool CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph()
// If the br we inserted collapsed, for example foo<br><blockquote>...</blockquote>, insert
// a second one.
if (!isStartOfParagraph(atBR))
- insertNodeBefore(createBreakElement(&document()), br);
+ insertNodeBefore(createBreakElement(document()), br);
setEndingSelection(VisibleSelection(atBR, endingSelection().isDirectional()));
// If this is an empty paragraph there must be a line break here.
@@ -1464,9 +1464,9 @@ PassRefPtr<Node> CompositeEditCommand::splitTreeToNode(Node* start, Node* end, b
return node.release();
}
-PassRefPtr<Element> createBlockPlaceholderElement(Document* document)
+PassRefPtr<Element> createBlockPlaceholderElement(Document& document)
{
- RefPtr<Element> breakNode = document->createElement(brTag, false);
+ RefPtr<Element> breakNode = document.createElement(brTag, false);
return breakNode.release();
}
« no previous file with comments | « Source/core/editing/BreakBlockquoteCommand.cpp ('k') | Source/core/editing/DeleteSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698