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

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

Issue 2221783004: TypingCommand should not cancel previous spellcheck request if no new request in initiated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp ('k') | 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 TRACE_EVENT0("blink", "SpellChecker::markMisspellingsAfterLineBreak"); 345 TRACE_EVENT0("blink", "SpellChecker::markMisspellingsAfterLineBreak");
346 346
347 if (!unifiedTextCheckerEnabled()) { 347 if (!unifiedTextCheckerEnabled()) {
348 markMisspellings(wordSelection); 348 markMisspellings(wordSelection);
349 return; 349 return;
350 } 350 }
351 351
352 if (!isContinuousSpellCheckingEnabled()) 352 if (!isContinuousSpellCheckingEnabled())
353 return; 353 return;
354 354
355 m_spellCheckRequester->cancelCheck();
356
355 VisibleSelection wholeParagraph( 357 VisibleSelection wholeParagraph(
356 startOfParagraph(wordSelection.visibleStart()), 358 startOfParagraph(wordSelection.visibleStart()),
357 endOfParagraph(wordSelection.visibleEnd())); 359 endOfParagraph(wordSelection.visibleEnd()));
358 360
359 markAllMisspellingsAndBadGrammarInRanges(wordSelection.toNormalizedEphemeral Range(), wholeParagraph.toNormalizedEphemeralRange()); 361 markAllMisspellingsAndBadGrammarInRanges(wordSelection.toNormalizedEphemeral Range(), wholeParagraph.toNormalizedEphemeralRange());
360 } 362 }
361 363
362 void SpellChecker::markMisspellingsAfterTypingToWord(const VisiblePosition &word Start, const VisibleSelection& selectionAfterTyping) 364 void SpellChecker::markMisspellingsAfterTypingToWord(const VisiblePosition &word Start, const VisibleSelection& selectionAfterTyping)
363 { 365 {
364 if (!isContinuousSpellCheckingEnabled()) 366 if (!isContinuousSpellCheckingEnabled())
365 return; 367 return;
366 368
367 TRACE_EVENT0("blink", "SpellChecker::markMisspellingsAfterTypingToWord"); 369 TRACE_EVENT0("blink", "SpellChecker::markMisspellingsAfterTypingToWord");
368 370
369 if (unifiedTextCheckerEnabled()) { 371 if (unifiedTextCheckerEnabled()) {
372 m_spellCheckRequester->cancelCheck();
373
370 VisibleSelection adjacentWords = VisibleSelection(startOfWord(wordStart, LeftWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary)); 374 VisibleSelection adjacentWords = VisibleSelection(startOfWord(wordStart, LeftWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary));
371 VisibleSelection selectedSentence = VisibleSelection(startOfSentence(wor dStart), endOfSentence(wordStart)); 375 VisibleSelection selectedSentence = VisibleSelection(startOfSentence(wor dStart), endOfSentence(wordStart));
372 markAllMisspellingsAndBadGrammarInRanges(adjacentWords.toNormalizedEphem eralRange(), selectedSentence.toNormalizedEphemeralRange()); 376 markAllMisspellingsAndBadGrammarInRanges(adjacentWords.toNormalizedEphem eralRange(), selectedSentence.toNormalizedEphemeralRange());
373 return; 377 return;
374 } 378 }
375 379
376 // Check spelling of one word 380 // Check spelling of one word
377 bool result = markMisspellings(VisibleSelection(startOfWord(wordStart, LeftW ordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary))); 381 bool result = markMisspellings(VisibleSelection(startOfWord(wordStart, LeftW ordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary)));
378 382
379 if (!result) 383 if (!result)
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 visitor->trace(m_frame); 945 visitor->trace(m_frame);
942 visitor->trace(m_spellCheckRequester); 946 visitor->trace(m_spellCheckRequester);
943 } 947 }
944 948
945 void SpellChecker::prepareForLeakDetection() 949 void SpellChecker::prepareForLeakDetection()
946 { 950 {
947 m_spellCheckRequester->prepareForLeakDetection(); 951 m_spellCheckRequester->prepareForLeakDetection();
948 } 952 }
949 953
950 } // namespace blink 954 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698