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

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

Issue 422693002: Use tighter typing in editing: htmlediting create methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 5 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/CompositeEditCommand.cpp ('k') | Source/core/editing/ReplaceSelectionCommand.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 0456929d78bce9164e08a209985fd95c7da1c09a..1b2b22dc16ec5fbab5e4fc0f933a573148c52534 100644
--- a/Source/core/editing/InsertListCommand.cpp
+++ b/Source/core/editing/InsertListCommand.cpp
@@ -36,6 +36,8 @@
#include "core/editing/htmlediting.h"
#include "core/html/HTMLBRElement.h"
#include "core/html/HTMLElement.h"
+#include "core/html/HTMLLIElement.h"
+#include "core/html/HTMLUListElement.h"
namespace blink {
@@ -51,7 +53,7 @@ static Node* enclosingListChild(Node* node, Node* listNode)
HTMLElement* InsertListCommand::fixOrphanedListChild(Node* node)
{
- RefPtrWillBeRawPtr<HTMLElement> listElement = createUnorderedListElement(document());
+ RefPtrWillBeRawPtr<HTMLUListElement> listElement = createUnorderedListElement(document());
insertNodeBefore(listElement, node);
removeNode(node);
appendNode(node, listElement);
@@ -285,12 +287,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.
RefPtrWillBeRawPtr<HTMLBRElement> placeholder = createBreakElement(document());
- RefPtrWillBeRawPtr<Element> nodeToInsert = placeholder;
+ RefPtrWillBeRawPtr<HTMLElement> elementToInsert = 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());
- appendNode(placeholder, nodeToInsert);
+ elementToInsert = createListItemElement(document());
+ appendNode(placeholder, elementToInsert);
}
if (nextListChild && previousListChild) {
@@ -302,7 +304,7 @@ void InsertListCommand::unlistifyParagraph(const VisiblePosition& originalStart,
// listChildNode below in moveParagraphs, previousListChild will be removed along with it if it is
// unrendered. But we ought to remove nextListChild too, if it is unrendered.
splitElement(listNode, splitTreeToNode(nextListChild, listNode));
- insertNodeBefore(nodeToInsert, listNode);
+ insertNodeBefore(elementToInsert, listNode);
} else if (nextListChild || listChildNode->parentNode() != listNode) {
// Just because listChildNode has no previousListChild doesn't mean there isn't any content
// in listNode that comes before listChildNode, as listChildNode could have ancestors
@@ -310,9 +312,10 @@ void InsertListCommand::unlistifyParagraph(const VisiblePosition& originalStart,
// where we're about to move listChildNode to.
if (listChildNode->parentNode() != listNode)
splitElement(listNode, splitTreeToNode(listChildNode, listNode).get());
- insertNodeBefore(nodeToInsert, listNode);
- } else
- insertNodeAfter(nodeToInsert, listNode);
+ insertNodeBefore(elementToInsert, listNode);
+ } else {
+ insertNodeAfter(elementToInsert, listNode);
+ }
VisiblePosition insertionPoint = VisiblePosition(positionBeforeNode(placeholder.get()));
moveParagraphs(start, end, insertionPoint, /* preserveSelection */ true, /* preserveStyle */ true, listChildNode);
« no previous file with comments | « Source/core/editing/CompositeEditCommand.cpp ('k') | Source/core/editing/ReplaceSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698