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

Unified Diff: Source/core/editing/spellcheck/SpellChecker.cpp

Issue 1310043003: Introduce previousPositionOf() for VisiblePosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-28T16:28:03 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
« no previous file with comments | « Source/core/editing/serializers/StyledMarkupSerializer.cpp ('k') | Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/spellcheck/SpellChecker.cpp
diff --git a/Source/core/editing/spellcheck/SpellChecker.cpp b/Source/core/editing/spellcheck/SpellChecker.cpp
index 91a56817ec2eaf07347d3d3186bf68edc7c2152d..9ee443e7985f8a7f346875ed5763e6ebe0c27102 100644
--- a/Source/core/editing/spellcheck/SpellChecker.cpp
+++ b/Source/core/editing/spellcheck/SpellChecker.cpp
@@ -179,7 +179,7 @@ void SpellChecker::advanceToNextMisspelling(bool startBeforeSelection)
if (startBeforeSelection) {
VisiblePosition start(selection.visibleStart());
// We match AppKit's rule: Start 1 character before the selection.
- VisiblePosition oneBeforeStart = start.previous();
+ VisiblePosition oneBeforeStart = previousPositionOf(start);
spellingSearchStart = (oneBeforeStart.isNotNull() ? oneBeforeStart : start).toParentAnchoredPosition();
} else {
spellingSearchStart = selection.visibleEnd().toParentAnchoredPosition();
@@ -208,10 +208,11 @@ void SpellChecker::advanceToNextMisspelling(bool startBeforeSelection)
// |editingIgnoresContent(highestEditableRoot())| returns true, e.g. <table>
spellingSearchEnd = Position::editingPositionOf(topNode, EditingStrategy::lastOffsetForEditing(topNode));
- // If spellingSearchRange starts in the middle of a word, advance to the next word so we start checking
- // at a word boundary. Going back by one char and then forward by a word does the trick.
+ // If spellingSearchRange starts in the middle of a word, advance to the
+ // next word so we start checking at a word boundary. Going back by one char
+ // and then forward by a word does the trick.
if (startedWithSelection) {
- VisiblePosition oneBeforeStart = VisiblePosition(spellingSearchStart).previous();
+ VisiblePosition oneBeforeStart = previousPositionOf(VisiblePosition(spellingSearchStart));
if (oneBeforeStart.isNotNull())
spellingSearchStart = endOfWord(oneBeforeStart).toParentAnchoredPosition();
// else we were already at the start of the editable node
« no previous file with comments | « Source/core/editing/serializers/StyledMarkupSerializer.cpp ('k') | Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698