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

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

Issue 2757563004: Adjust insertion point when listifying unordered list items (Closed)
Patch Set: Added regression test. 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
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..f8fade3e7095aaab56ef12245e6d51f1cb8ad37c 100644
--- a/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
@@ -608,6 +608,15 @@ 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()))
yosin_UTC9 2017/03/21 05:37:20 Could you use Position::computeContainerNode() ins
jfernandez 2017/03/24 01:57:55 Done.
+ insertionPos = Position::inParentBeforeNode(*insertionPos.anchorNode());
// Also avoid the containing list item.
Node* const listChild = enclosingListChild(insertionPos.anchorNode());
if (isHTMLLIElement(listChild))

Powered by Google App Engine
This is Rietveld 408576698