summaryrefslogtreecommitdiffstats
path: root/WebCore/editing/IndentOutdentCommand.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/editing/IndentOutdentCommand.cpp')
-rw-r--r--WebCore/editing/IndentOutdentCommand.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/WebCore/editing/IndentOutdentCommand.cpp b/WebCore/editing/IndentOutdentCommand.cpp
index 0f3975b..9830ca0 100644
--- a/WebCore/editing/IndentOutdentCommand.cpp
+++ b/WebCore/editing/IndentOutdentCommand.cpp
@@ -75,12 +75,8 @@ bool IndentOutdentCommand::tryIndentingAsListItem(const VisiblePosition& endOfCu
if (!listNode)
return false;
- // Find the list item enclosing the current paragraph
+ // Find the block that we want to indent. If it's not a list item (e.g., a div inside a list item), we bail out.
Element* selectedListItem = static_cast<Element*>(enclosingBlock(lastNodeInSelectedParagraph));
- // FIXME: enclosingBlock shouldn't return the passed in element. See the
- // comment on the function about how to fix rather than having to adjust here.
- if (selectedListItem == lastNodeInSelectedParagraph)
- selectedListItem = static_cast<Element*>(enclosingBlock(lastNodeInSelectedParagraph->parentNode()));
// FIXME: we need to deal with the case where there is no li (malformed HTML)
if (!selectedListItem->hasTagName(liTag))
@@ -117,7 +113,7 @@ void IndentOutdentCommand::indentIntoBlockquote(const VisiblePosition& endOfCurr
else
nodeToSplitTo = editableRootForPosition(start);
- RefPtr<Node> outerBlock = splitTreeToNode(start.node(), nodeToSplitTo);
+ RefPtr<Node> outerBlock = (start.node() == nodeToSplitTo) ? start.node() : splitTreeToNode(start.node(), nodeToSplitTo);
if (!targetBlockquote) {
// Create a new blockquote and insert it as a child of the root editable element. We accomplish