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

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

Issue 67063005: Fixing indent/outdent for <li> elements containing children spanning across (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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: Source/core/editing/IndentOutdentCommand.cpp
diff --git a/Source/core/editing/IndentOutdentCommand.cpp b/Source/core/editing/IndentOutdentCommand.cpp
index 934840573ecebe15d190519e1fbaabc16746f267..efaa32359133e0aec7331e279327912578b5e739 100644
--- a/Source/core/editing/IndentOutdentCommand.cpp
+++ b/Source/core/editing/IndentOutdentCommand.cpp
@@ -72,13 +72,18 @@ bool IndentOutdentCommand::tryIndentingAsListItem(const Position& start, const P
// We should calculate visible range in list item because inserting new
// list element will change visibility of list item, e.g. :first-child
// CSS selector.
- VisiblePosition startOfMove(start);
yosin_UTC9 2013/11/20 05:01:49 Since r162080, we don't need to take care about in
- VisiblePosition endOfMove(end);
-
RefPtr<Element> newList = document().createElement(listNode->tagQName(), false);
insertNodeBefore(newList, selectedListItem.get());
- moveParagraphWithClones(startOfMove, endOfMove, newList.get(), selectedListItem.get());
+ // We should clone all the children of the list item for indenting purposes. However, in case the current
+ // selection does not encompass all its children, we need to explicitally handle the same. The original
+ // list item too would require proper deletion in that case.
+ if (end.deprecatedNode() == selectedListItem.get() || end.deprecatedNode()->isDescendantOf(selectedListItem->lastChild())) {
yosin_UTC9 2013/11/20 05:01:49 nit: s/deprecatedNode/anchorNode/g
arpitab_ 2013/11/20 13:07:52 Done.
+ moveParagraphWithClones(start, end, newList.get(), selectedListItem.get());
+ } else {
+ moveParagraphWithClones(start, positionAfterNode(selectedListItem->lastChild()), newList.get(), selectedListItem.get());
+ removeNode(selectedListItem.get());
+ }
if (canMergeLists(previousList.get(), newList.get()))
mergeIdenticalElements(previousList.get(), newList.get());

Powered by Google App Engine
This is Rietveld 408576698