Index: Source/core/editing/commands/BreakBlockquoteCommand.cpp |
diff --git a/Source/core/editing/commands/BreakBlockquoteCommand.cpp b/Source/core/editing/commands/BreakBlockquoteCommand.cpp |
index 3edaaf05911ec9445d254fcf75b59d622126bcea..c372695d88eb422bb461dd3a84fe0f1a3b0091fe 100644 |
--- a/Source/core/editing/commands/BreakBlockquoteCommand.cpp |
+++ b/Source/core/editing/commands/BreakBlockquoteCommand.cpp |
@@ -126,12 +126,18 @@ void BreakBlockquoteCommand::doApply() |
// Don't move a line break just after the caret. Doing so would create an extra, empty paragraph |
// in the new blockquote. |
- if (lineBreakExistsAtVisiblePosition(visiblePos)) |
- pos = pos.next(); |
+ if (lineBreakExistsAtVisiblePosition(visiblePos)) { |
+ // TODO(yosin) We should use |PositionMoveType::Character| for |
+ // |nextPositionOf()| to avoid editing middle of character. |
+ pos = nextPositionOf(pos, PositionMoveType::CodePoint); |
+ } |
// Adjust the position so we don't split at the beginning of a quote. |
- while (isFirstVisiblePositionInNode(VisiblePosition(pos), toHTMLQuoteElement(enclosingNodeOfType(pos, isMailHTMLBlockquoteElement)))) |
- pos = pos.previous(); |
+ while (isFirstVisiblePositionInNode(VisiblePosition(pos), toHTMLQuoteElement(enclosingNodeOfType(pos, isMailHTMLBlockquoteElement)))) { |
+ // TODO(yosin) We should use |PositionMoveType::Character| for |
+ // |previousPositionOf()| to avoid editing middle character. |
+ pos = previousPositionOf(pos, PositionMoveType::CodePoint); |
+ } |
// startNode is the first node that we need to move to the new blockquote. |
Node* startNode = pos.anchorNode(); |