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

Unified Diff: third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp

Issue 2757563004: Adjust insertion point when listifying unordered list items (Closed)
Patch Set: Patch rebased Created 3 years, 9 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 | « third_party/WebKit/LayoutTests/external/wpt/editing/run/insertorderedlist-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
index c5bea18bc499cead96eb908dc5373a93a5d90df4..23a25f842ba74b45c22a1b87a3b23338ca128fbd 100644
--- a/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
@@ -608,6 +608,17 @@ void InsertListCommand::listifyParagraph(const VisiblePosition& originalStart,
// inline ancestors of start, since it is easier for editing to produce
// clean markup when inline elements are pushed down as far as possible.
Position insertionPos(mostBackwardCaretPosition(startPos));
+ // Also avoid the temporary <span> element created by 'unlistifyParagraph'.
+ // This element can be selected by mostBackwardCaretPosition when startPor
+ // points to a element with previous siblings or ancestors with siblings.
+ // |-A
+ // | |-B
+ // | +-C (insertion point)
+ // | |-D (*)
+ if (isHTMLSpanElement(insertionPos.anchorNode())) {
+ insertionPos =
+ Position::inParentBeforeNode(*insertionPos.computeContainerNode());
+ }
// Also avoid the containing list item.
Node* const listChild = enclosingListChild(insertionPos.anchorNode());
if (isHTMLLIElement(listChild))
« no previous file with comments | « third_party/WebKit/LayoutTests/external/wpt/editing/run/insertorderedlist-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698