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()); |