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

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

Issue 166033005: Port Node's previousElementSibling() / nextElementSibling() to ElementTraversal (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 10 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/IndentOutdentCommand.cpp ('k') | no next file » | 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 d58ab4ff4e05fb6c4287e0a71b6bcd831ba9d2e8..e5bedb07b955e4d8231463e3e181ddc517a32178 100644
--- a/Source/core/editing/InsertListCommand.cpp
+++ b/Source/core/editing/InsertListCommand.cpp
@@ -29,6 +29,7 @@
#include "HTMLNames.h"
#include "bindings/v8/ExceptionStatePlaceholder.h"
#include "core/dom/Element.h"
+#include "core/dom/ElementTraversal.h"
#include "core/editing/TextIterator.h"
#include "core/editing/VisibleUnits.h"
#include "core/editing/htmlediting.h"
@@ -59,14 +60,18 @@ HTMLElement* InsertListCommand::fixOrphanedListChild(Node* node)
PassRefPtr<HTMLElement> InsertListCommand::mergeWithNeighboringLists(PassRefPtr<HTMLElement> passedList)
{
RefPtr<HTMLElement> list = passedList;
- Element* previousList = list->previousElementSibling();
+ Element* previousList = ElementTraversal::previousSibling(*list);
if (canMergeLists(previousList, list.get()))
mergeIdenticalElements(previousList, list);
- if (!list || !list->nextElementSibling() || !list->nextElementSibling()->isHTMLElement())
+ if (!list)
+ return 0;
+
+ Element* nextSibling = ElementTraversal::nextSibling(*list);
+ if (!nextSibling || !nextSibling->isHTMLElement())
return list.release();
- RefPtr<HTMLElement> nextList = toHTMLElement(list->nextElementSibling());
+ RefPtr<HTMLElement> nextList = toHTMLElement(nextSibling);
if (canMergeLists(list.get(), nextList.get())) {
mergeIdenticalElements(list, nextList);
return nextList.release();
« no previous file with comments | « Source/core/editing/IndentOutdentCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698