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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 VisibleSelection empty; 857 VisibleSelection empty;
858 spellCheckOldSelection(frame().selection().selection(), empty); 858 spellCheckOldSelection(frame().selection().selection(), empty);
859 } 859 }
860 860
861 void SpellChecker::spellCheckOldSelection(const VisibleSelection& oldSelection, const VisibleSelection& newAdjacentWords) 861 void SpellChecker::spellCheckOldSelection(const VisibleSelection& oldSelection, const VisibleSelection& newAdjacentWords)
862 { 862 {
863 TRACE_EVENT0("blink", "SpellChecker::spellCheckOldSelection"); 863 TRACE_EVENT0("blink", "SpellChecker::spellCheckOldSelection");
864 864
865 VisiblePosition oldStart(oldSelection.visibleStart()); 865 VisiblePosition oldStart(oldSelection.visibleStart());
866 VisibleSelection oldAdjacentWords = VisibleSelection(startOfWord(oldStart, L eftWordIfOnBoundary), endOfWord(oldStart, RightWordIfOnBoundary)); 866 VisibleSelection oldAdjacentWords = VisibleSelection(startOfWord(oldStart, L eftWordIfOnBoundary), endOfWord(oldStart, RightWordIfOnBoundary));
867 if (oldAdjacentWords != newAdjacentWords) { 867 if (oldAdjacentWords == newAdjacentWords)
868 if (isContinuousSpellCheckingEnabled()) { 868 return;
869 VisibleSelection selectedSentence = VisibleSelection(startOfSentence (oldStart), endOfSentence(oldStart)); 869 if (isContinuousSpellCheckingEnabled()) {
870 markMisspellingsAndBadGrammar(oldAdjacentWords, true, selectedSenten ce); 870 VisibleSelection selectedSentence = VisibleSelection(startOfSentence(old Start), endOfSentence(oldStart));
871 } else { 871 markMisspellingsAndBadGrammar(oldAdjacentWords, true, selectedSentence);
872 markMisspellingsAndBadGrammar(oldAdjacentWords, false, oldAdjacentWo rds); 872 return;
873 }
874 } 873 }
874 markMisspellingsAndBadGrammar(oldAdjacentWords, false, oldAdjacentWords);
875 } 875 }
876 876
877 static Node* findFirstMarkable(Node* node) 877 static Node* findFirstMarkable(Node* node)
878 { 878 {
879 while (node) { 879 while (node) {
880 if (!node->layoutObject()) 880 if (!node->layoutObject())
881 return 0; 881 return 0;
882 if (node->layoutObject()->isText()) 882 if (node->layoutObject()->isText())
883 return node; 883 return node;
884 if (node->layoutObject()->isTextControl()) 884 if (node->layoutObject()->isTextControl())
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 visitor->trace(m_frame); 958 visitor->trace(m_frame);
959 visitor->trace(m_spellCheckRequester); 959 visitor->trace(m_spellCheckRequester);
960 } 960 }
961 961
962 void SpellChecker::prepareForLeakDetection() 962 void SpellChecker::prepareForLeakDetection()
963 { 963 {
964 m_spellCheckRequester->prepareForLeakDetection(); 964 m_spellCheckRequester->prepareForLeakDetection();
965 } 965 }
966 966
967 } // namespace blink 967 } // namespace blink
OLDNEW
« 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