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

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

Issue 23822003: Have EditCommand classes deal with Document references, not pointers (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/InsertListCommand.h ('k') | Source/core/editing/InsertNodeBeforeCommand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/InsertListCommand.cpp
diff --git a/Source/core/editing/InsertListCommand.cpp b/Source/core/editing/InsertListCommand.cpp
index 5af5af3f865573ea71cdf038f9481f4aa166ca35..9504168ce340d6bce9ae4ad266044a98ca01372d 100644
--- a/Source/core/editing/InsertListCommand.cpp
+++ b/Source/core/editing/InsertListCommand.cpp
@@ -46,7 +46,7 @@ static Node* enclosingListChild(Node* node, Node* listNode)
return listChild;
}
-PassRefPtr<HTMLElement> InsertListCommand::insertList(Document* document, Type type)
+PassRefPtr<HTMLElement> InsertListCommand::insertList(Document& document, Type type)
{
RefPtr<InsertListCommand> insertCommand = create(document, type);
insertCommand->apply();
@@ -55,7 +55,7 @@ PassRefPtr<HTMLElement> InsertListCommand::insertList(Document* document, Type t
HTMLElement* InsertListCommand::fixOrphanedListChild(Node* node)
{
- RefPtr<HTMLElement> listElement = createUnorderedListElement(document());
+ RefPtr<HTMLElement> listElement = createUnorderedListElement(&document());
insertNodeBefore(listElement, node);
removeNode(node);
appendNode(node, listElement);
@@ -99,7 +99,7 @@ bool InsertListCommand::selectionHasListOfType(const VisibleSelection& selection
return true;
}
-InsertListCommand::InsertListCommand(Document* document, Type type)
+InsertListCommand::InsertListCommand(Document& document, Type type)
: CompositeEditCommand(document), m_type(type)
{
}
@@ -215,7 +215,7 @@ void InsertListCommand::doApplyForSingleParagraph(bool forceCreateList, const Qu
bool rangeStartIsInList = visiblePositionBeforeNode(listNode.get()) == currentSelection->startPosition();
bool rangeEndIsInList = visiblePositionAfterNode(listNode.get()) == currentSelection->endPosition();
- RefPtr<HTMLElement> newList = createHTMLElement(document(), listTag);
+ RefPtr<HTMLElement> newList = createHTMLElement(&document(), listTag);
insertNodeBefore(newList, listNode);
Node* firstChildInList = enclosingListChild(VisiblePosition(firstPositionInNode(listNode.get())).deepEquivalent().deprecatedNode(), listNode.get());
@@ -272,12 +272,12 @@ void InsertListCommand::unlistifyParagraph(const VisiblePosition& originalStart,
}
// When removing a list, we must always create a placeholder to act as a point of insertion
// for the list content being removed.
- RefPtr<Element> placeholder = createBreakElement(document());
+ RefPtr<Element> placeholder = createBreakElement(&document());
RefPtr<Element> nodeToInsert = placeholder;
// If the content of the list item will be moved into another list, put it in a list item
// so that we don't create an orphaned list child.
if (enclosingList(listNode)) {
- nodeToInsert = createListItemElement(document());
+ nodeToInsert = createListItemElement(&document());
appendNode(placeholder, nodeToInsert);
}
@@ -334,8 +334,8 @@ PassRefPtr<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePositio
return 0;
// Check for adjoining lists.
- RefPtr<HTMLElement> listItemElement = createListItemElement(document());
- RefPtr<HTMLElement> placeholder = createBreakElement(document());
+ RefPtr<HTMLElement> listItemElement = createListItemElement(&document());
+ RefPtr<HTMLElement> placeholder = createBreakElement(&document());
appendNode(placeholder, listItemElement);
// Place list item into adjoining lists.
@@ -348,7 +348,7 @@ PassRefPtr<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePositio
insertNodeAt(listItemElement, positionBeforeNode(nextList));
else {
// Create the list.
- listElement = createHTMLElement(document(), listTag);
+ listElement = createHTMLElement(&document(), listTag);
appendNode(listItemElement, listElement);
if (start == end && isBlock(start.deepEquivalent().deprecatedNode())) {
« no previous file with comments | « Source/core/editing/InsertListCommand.h ('k') | Source/core/editing/InsertNodeBeforeCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698