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

Unified Diff: Source/core/editing/commands/BreakBlockquoteCommand.cpp

Issue 1305963003: Introduce {next,previous}PositionOf() as replacement of {next,previous}() member functions in Positi (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-22T00:12:04 Rebase Created 5 years, 4 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: 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();
« no previous file with comments | « Source/core/editing/commands/ApplyBlockElementCommand.cpp ('k') | Source/core/editing/commands/InsertTextCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698