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

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

Issue 1620653002: Pass Only the Pasted Text to Spellchecker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 490
491 static EphemeralRange expandRangeToSentenceBoundary(const EphemeralRange& range) 491 static EphemeralRange expandRangeToSentenceBoundary(const EphemeralRange& range)
492 { 492 {
493 ASSERT(range.isNotNull()); 493 ASSERT(range.isNotNull());
494 const VisiblePosition& visibleStart = createVisiblePosition(range.startPosit ion()); 494 const VisiblePosition& visibleStart = createVisiblePosition(range.startPosit ion());
495 ASSERT(visibleStart.isNotNull()); 495 ASSERT(visibleStart.isNotNull());
496 const Position& sentenceStart = startOfSentence(visibleStart).deepEquivalent (); 496 const Position& sentenceStart = startOfSentence(visibleStart).deepEquivalent ();
497 return expandEndToSentenceBoundary(EphemeralRange(sentenceStart.isNull() ? r ange.startPosition() : sentenceStart, range.endPosition())); 497 return expandEndToSentenceBoundary(EphemeralRange(sentenceStart.isNull() ? r ange.startPosition() : sentenceStart, range.endPosition()));
498 } 498 }
499 499
500 void SpellChecker::chunkAndMarkAllMisspellingsAndBadGrammar(Node* node) 500 void SpellChecker::chunkAndMarkAllMisspellingsAndBadGrammar(Node* node, const Ep hemeralRange& insertedRange)
501 { 501 {
502 TRACE_EVENT0("blink", "SpellChecker::chunkAndMarkAllMisspellingsAndBadGramma r"); 502 TRACE_EVENT0("blink", "SpellChecker::chunkAndMarkAllMisspellingsAndBadGramma r");
503 if (!node) 503 if (!node)
504 return; 504 return;
505 RefPtrWillBeRawPtr<Range> rangeToCheck = Range::create(*frame().document(), firstPositionInNode(node), lastPositionInNode(node)); 505 EphemeralRange paragraphRange(firstPositionInNode(node), lastPositionInNode( node));
506 TextCheckingParagraph textToCheck(rangeToCheck, rangeToCheck); 506 TextCheckingParagraph textToCheck(insertedRange, paragraphRange);
507 chunkAndMarkAllMisspellingsAndBadGrammar(resolveTextCheckingTypeMask(TextChe ckingTypeSpelling | TextCheckingTypeGrammar), textToCheck); 507 chunkAndMarkAllMisspellingsAndBadGrammar(resolveTextCheckingTypeMask(TextChe ckingTypeSpelling | TextCheckingTypeGrammar), textToCheck);
508 } 508 }
509 509
510 void SpellChecker::chunkAndMarkAllMisspellingsAndBadGrammar(TextCheckingTypeMask textCheckingOptions, const TextCheckingParagraph& fullParagraphToCheck) 510 void SpellChecker::chunkAndMarkAllMisspellingsAndBadGrammar(TextCheckingTypeMask textCheckingOptions, const TextCheckingParagraph& fullParagraphToCheck)
511 { 511 {
512 if (fullParagraphToCheck.isEmpty()) 512 if (fullParagraphToCheck.isEmpty())
513 return; 513 return;
514 const EphemeralRange& paragraphRange = fullParagraphToCheck.paragraphRange() ; 514 const EphemeralRange& paragraphRange = fullParagraphToCheck.paragraphRange() ;
515 515
516 // Since the text may be quite big chunk it up and adjust to the sentence bo undary. 516 // Since the text may be quite big chunk it up and adjust to the sentence bo undary.
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe ck, rangeToCheck)); 918 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe ck, rangeToCheck));
919 } 919 }
920 920
921 DEFINE_TRACE(SpellChecker) 921 DEFINE_TRACE(SpellChecker)
922 { 922 {
923 visitor->trace(m_frame); 923 visitor->trace(m_frame);
924 visitor->trace(m_spellCheckRequester); 924 visitor->trace(m_spellCheckRequester);
925 } 925 }
926 926
927 } // namespace blink 927 } // 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