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

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

Issue 2248413003: Stop SpellCheckRequest from checking canCheckAsynchronously() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SpellCheckerDebugInfo
Patch Set: Removed rebaselining of the unrelated test Created 4 years, 3 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/spellcheck/SpellChecker.h ('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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 } 380 }
381 381
382 void SpellChecker::markMisspellingsAfterTypingToWord(const VisiblePosition &word Start) 382 void SpellChecker::markMisspellingsAfterTypingToWord(const VisiblePosition &word Start)
383 { 383 {
384 TRACE_EVENT0("blink", "SpellChecker::markMisspellingsAfterTypingToWord"); 384 TRACE_EVENT0("blink", "SpellChecker::markMisspellingsAfterTypingToWord");
385 385
386 VisibleSelection adjacentWords = VisibleSelection(startOfWord(wordStart, Lef tWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary)); 386 VisibleSelection adjacentWords = VisibleSelection(startOfWord(wordStart, Lef tWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary));
387 markMisspellingsAndBadGrammar(adjacentWords); 387 markMisspellingsAndBadGrammar(adjacentWords);
388 } 388 }
389 389
390 bool SpellChecker::isSpellCheckingEnabledFor(Node* node) const 390 bool SpellChecker::isSpellCheckingEnabledFor(const Node* node) const
391 { 391 {
392 if (!node) 392 if (!node)
393 return false; 393 return false;
394 const Element* focusedElement = node->isElementNode() ? toElement(node) : no de->parentElement(); 394 const Element* focusedElement = node->isElementNode() ? toElement(node) : no de->parentElement();
395 if (!focusedElement) 395 if (!focusedElement)
396 return false; 396 return false;
397 return focusedElement->isSpellCheckingEnabled(); 397 return focusedElement->isSpellCheckingEnabled();
398 } 398 }
399 399
400 bool SpellChecker::isSpellCheckingEnabledInFocusedNode() const 400 bool SpellChecker::isSpellCheckingEnabledInFocusedNode() const
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 frame().document()->markers().removeMarkers(range, markerTypes); 826 frame().document()->markers().removeMarkers(range, markerTypes);
827 } 827 }
828 828
829 void SpellChecker::cancelCheck() 829 void SpellChecker::cancelCheck()
830 { 830 {
831 m_spellCheckRequester->cancelCheck(); 831 m_spellCheckRequester->cancelCheck();
832 } 832 }
833 833
834 void SpellChecker::requestTextChecking(const Element& element) 834 void SpellChecker::requestTextChecking(const Element& element)
835 { 835 {
836 if (!isSpellCheckingEnabledFor(&element))
837 return;
836 const EphemeralRange rangeToCheck = EphemeralRange::rangeOfContents(element) ; 838 const EphemeralRange rangeToCheck = EphemeralRange::rangeOfContents(element) ;
837 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingProcessBatch, rangeToCheck)); 839 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingProcessBatch, rangeToCheck));
838 } 840 }
839 841
840 DEFINE_TRACE(SpellChecker) 842 DEFINE_TRACE(SpellChecker)
841 { 843 {
842 visitor->trace(m_frame); 844 visitor->trace(m_frame);
843 visitor->trace(m_spellCheckRequester); 845 visitor->trace(m_spellCheckRequester);
844 } 846 }
845 847
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 VisiblePosition newParagraphStart = startOfNextParagraph(createVisiblePo sition(paragraphEnd)); 950 VisiblePosition newParagraphStart = startOfNextParagraph(createVisiblePo sition(paragraphEnd));
949 paragraphStart = newParagraphStart.toParentAnchoredPosition(); 951 paragraphStart = newParagraphStart.toParentAnchoredPosition();
950 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPositio n(); 952 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPositio n();
951 firstIteration = false; 953 firstIteration = false;
952 totalLengthProcessed += currentLength; 954 totalLengthProcessed += currentLength;
953 } 955 }
954 return std::make_pair(firstFoundItem, firstFoundOffset); 956 return std::make_pair(firstFoundItem, firstFoundOffset);
955 } 957 }
956 958
957 } // namespace blink 959 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698