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

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

Issue 2123863003: Use early-return style in SpellChecker::spellCheckOldSelection() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-07-07T11:26:22 Created 4 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
diff --git a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
index 12cd1930c72d066d8636af8e67e6258ea0fe2636..f17814815d787019ef06bccb4505b0d08ef8b882 100644
--- a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
+++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
@@ -864,14 +864,14 @@ void SpellChecker::spellCheckOldSelection(const VisibleSelection& oldSelection,
VisiblePosition oldStart(oldSelection.visibleStart());
VisibleSelection oldAdjacentWords = VisibleSelection(startOfWord(oldStart, LeftWordIfOnBoundary), endOfWord(oldStart, RightWordIfOnBoundary));
- if (oldAdjacentWords != newAdjacentWords) {
- if (isContinuousSpellCheckingEnabled()) {
- VisibleSelection selectedSentence = VisibleSelection(startOfSentence(oldStart), endOfSentence(oldStart));
- markMisspellingsAndBadGrammar(oldAdjacentWords, true, selectedSentence);
- } else {
- markMisspellingsAndBadGrammar(oldAdjacentWords, false, oldAdjacentWords);
- }
+ if (oldAdjacentWords == newAdjacentWords)
+ return;
+ if (isContinuousSpellCheckingEnabled()) {
+ VisibleSelection selectedSentence = VisibleSelection(startOfSentence(oldStart), endOfSentence(oldStart));
+ markMisspellingsAndBadGrammar(oldAdjacentWords, true, selectedSentence);
+ return;
}
+ markMisspellingsAndBadGrammar(oldAdjacentWords, false, oldAdjacentWords);
}
static Node* findFirstMarkable(Node* node)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698