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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return isHTMLTextAreaElement(textControl); 65 return isHTMLTextAreaElement(textControl);
66 } 66 }
67 67
68 bool isSelectionInTextFormControl(const VisibleSelection& selection) 68 bool isSelectionInTextFormControl(const VisibleSelection& selection)
69 { 69 {
70 return !!enclosingTextFormControl(selection.start()); 70 return !!enclosingTextFormControl(selection.start());
71 } 71 }
72 72
73 } // namespace 73 } // namespace
74 74
75 PassOwnPtrWillBeRawPtr<SpellChecker> SpellChecker::create(LocalFrame& frame) 75 RawPtr<SpellChecker> SpellChecker::create(LocalFrame& frame)
76 { 76 {
77 return adoptPtrWillBeNoop(new SpellChecker(frame)); 77 return (new SpellChecker(frame));
78 } 78 }
79 79
80 static SpellCheckerClient& emptySpellCheckerClient() 80 static SpellCheckerClient& emptySpellCheckerClient()
81 { 81 {
82 DEFINE_STATIC_LOCAL(EmptySpellCheckerClient, client, ()); 82 DEFINE_STATIC_LOCAL(EmptySpellCheckerClient, client, ());
83 return client; 83 return client;
84 } 84 }
85 85
86 SpellCheckerClient& SpellChecker::spellCheckerClient() const 86 SpellCheckerClient& SpellChecker::spellCheckerClient() const
87 { 87 {
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
517 const int kChunkSize = 16 * 1024; 517 const int kChunkSize = 16 * 1024;
518 518
519 // Check the full paragraph instead if the paragraph is short, which saves 519 // Check the full paragraph instead if the paragraph is short, which saves
520 // the cost on sentence boundary finding. 520 // the cost on sentence boundary finding.
521 if (fullParagraphToCheck.rangeLength() <= kChunkSize) { 521 if (fullParagraphToCheck.rangeLength() <= kChunkSize) {
522 RefPtrWillBeRawPtr<SpellCheckRequest> request = SpellCheckRequest::creat e(resolveTextCheckingTypeMask(textCheckingOptions), TextCheckingProcessBatch, pa ragraphRange, paragraphRange, 0); 522 RawPtr<SpellCheckRequest> request = SpellCheckRequest::create(resolveTex tCheckingTypeMask(textCheckingOptions), TextCheckingProcessBatch, paragraphRange , paragraphRange, 0);
523 if (request) 523 if (request)
524 m_spellCheckRequester->requestCheckingFor(request); 524 m_spellCheckRequester->requestCheckingFor(request);
525 return; 525 return;
526 } 526 }
527 527
528 CharacterIterator checkRangeIterator(fullParagraphToCheck.checkingRange(), T extIteratorEmitsObjectReplacementCharacter); 528 CharacterIterator checkRangeIterator(fullParagraphToCheck.checkingRange(), T extIteratorEmitsObjectReplacementCharacter);
529 for (int requestNum = 0; !checkRangeIterator.atEnd(); requestNum++) { 529 for (int requestNum = 0; !checkRangeIterator.atEnd(); requestNum++) {
530 EphemeralRange chunkRange = checkRangeIterator.calculateCharacterSubrang e(0, kChunkSize); 530 EphemeralRange chunkRange = checkRangeIterator.calculateCharacterSubrang e(0, kChunkSize);
531 EphemeralRange checkRange = requestNum ? expandEndToSentenceBoundary(chu nkRange) : expandRangeToSentenceBoundary(chunkRange); 531 EphemeralRange checkRange = requestNum ? expandEndToSentenceBoundary(chu nkRange) : expandRangeToSentenceBoundary(chunkRange);
532 532
533 RefPtrWillBeRawPtr<SpellCheckRequest> request = SpellCheckRequest::creat e(resolveTextCheckingTypeMask(textCheckingOptions), TextCheckingProcessBatch, ch eckRange, paragraphRange, requestNum); 533 RawPtr<SpellCheckRequest> request = SpellCheckRequest::create(resolveTex tCheckingTypeMask(textCheckingOptions), TextCheckingProcessBatch, checkRange, pa ragraphRange, requestNum);
534 if (request) 534 if (request)
535 m_spellCheckRequester->requestCheckingFor(request); 535 m_spellCheckRequester->requestCheckingFor(request);
536 536
537 if (!checkRangeIterator.atEnd()) { 537 if (!checkRangeIterator.atEnd()) {
538 checkRangeIterator.advance(1); 538 checkRangeIterator.advance(1);
539 // The layout should be already update due to the initialization of checkRangeIterator, 539 // The layout should be already update due to the initialization of checkRangeIterator,
540 // so comparePositions can be directly called. 540 // so comparePositions can be directly called.
541 if (comparePositions(chunkRange.endPosition(), checkRange.endPositio n()) < 0) 541 if (comparePositions(chunkRange.endPosition(), checkRange.endPositio n()) < 0)
542 checkRangeIterator.advance(TextIterator::rangeLength(chunkRange. endPosition(), checkRange.endPosition())); 542 checkRangeIterator.advance(TextIterator::rangeLength(chunkRange. endPosition(), checkRange.endPosition()));
543 } 543 }
544 } 544 }
545 } 545 }
546 546
547 void SpellChecker::markAndReplaceFor(PassRefPtrWillBeRawPtr<SpellCheckRequest> r equest, const Vector<TextCheckingResult>& results) 547 void SpellChecker::markAndReplaceFor(RawPtr<SpellCheckRequest> request, const Ve ctor<TextCheckingResult>& results)
548 { 548 {
549 TRACE_EVENT0("blink", "SpellChecker::markAndReplaceFor"); 549 TRACE_EVENT0("blink", "SpellChecker::markAndReplaceFor");
550 ASSERT(request); 550 ASSERT(request);
551 if (!request->isValid()) 551 if (!request->isValid())
552 return; 552 return;
553 553
554 TextCheckingTypeMask textCheckingOptions = request->data().mask(); 554 TextCheckingTypeMask textCheckingOptions = request->data().mask();
555 TextCheckingParagraph paragraph(request->checkingRange(), request->paragraph Range()); 555 TextCheckingParagraph paragraph(request->checkingRange(), request->paragraph Range());
556 556
557 bool shouldMarkSpelling = textCheckingOptions & TextCheckingTypeSpelling; 557 bool shouldMarkSpelling = textCheckingOptions & TextCheckingTypeSpelling;
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe ck, rangeToCheck)); 916 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe ck, rangeToCheck));
917 } 917 }
918 918
919 DEFINE_TRACE(SpellChecker) 919 DEFINE_TRACE(SpellChecker)
920 { 920 {
921 visitor->trace(m_frame); 921 visitor->trace(m_frame);
922 visitor->trace(m_spellCheckRequester); 922 visitor->trace(m_spellCheckRequester);
923 } 923 }
924 924
925 } // namespace blink 925 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698