| OLD | NEW |
| 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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 if (!node) | 500 if (!node) |
| 501 return; | 501 return; |
| 502 RefPtrWillBeRawPtr<Range> rangeToCheck = Range::create(*frame().document(),
firstPositionInNode(node), lastPositionInNode(node)); | 502 RefPtrWillBeRawPtr<Range> rangeToCheck = Range::create(*frame().document(),
firstPositionInNode(node), lastPositionInNode(node)); |
| 503 TextCheckingParagraph textToCheck(rangeToCheck, rangeToCheck); | 503 TextCheckingParagraph textToCheck(rangeToCheck, rangeToCheck); |
| 504 bool asynchronous = true; | 504 bool asynchronous = true; |
| 505 chunkAndMarkAllMisspellingsAndBadGrammar(resolveTextCheckingTypeMask(TextChe
ckingTypeSpelling | TextCheckingTypeGrammar), textToCheck, asynchronous); | 505 chunkAndMarkAllMisspellingsAndBadGrammar(resolveTextCheckingTypeMask(TextChe
ckingTypeSpelling | TextCheckingTypeGrammar), textToCheck, asynchronous); |
| 506 } | 506 } |
| 507 | 507 |
| 508 void SpellChecker::chunkAndMarkAllMisspellingsAndBadGrammar(TextCheckingTypeMask
textCheckingOptions, const TextCheckingParagraph& fullParagraphToCheck, bool as
ynchronous) | 508 void SpellChecker::chunkAndMarkAllMisspellingsAndBadGrammar(TextCheckingTypeMask
textCheckingOptions, const TextCheckingParagraph& fullParagraphToCheck, bool as
ynchronous) |
| 509 { | 509 { |
| 510 if (fullParagraphToCheck.isRangeEmpty() || fullParagraphToCheck.isEmpty()) | 510 if (fullParagraphToCheck.isEmpty()) |
| 511 return; | 511 return; |
| 512 | 512 |
| 513 // Since the text may be quite big chunk it up and adjust to the sentence bo
undary. | 513 // Since the text may be quite big chunk it up and adjust to the sentence bo
undary. |
| 514 const int kChunkSize = 16 * 1024; | 514 const int kChunkSize = 16 * 1024; |
| 515 int start = fullParagraphToCheck.checkingStart(); | 515 int start = fullParagraphToCheck.checkingStart(); |
| 516 int end = fullParagraphToCheck.checkingEnd(); | 516 int end = fullParagraphToCheck.checkingEnd(); |
| 517 start = std::min(start, end); | 517 start = std::min(start, end); |
| 518 end = std::max(start, end); | 518 end = std::max(start, end); |
| 519 const int kNumChunksToCheck = asynchronous ? (end - start + kChunkSize - 1)
/ (kChunkSize) : 1; | 519 const int kNumChunksToCheck = asynchronous ? (end - start + kChunkSize - 1)
/ (kChunkSize) : 1; |
| 520 int currentChunkStart = start; | 520 int currentChunkStart = start; |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec
kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe
ck, rangeToCheck)); | 938 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec
kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe
ck, rangeToCheck)); |
| 939 } | 939 } |
| 940 | 940 |
| 941 DEFINE_TRACE(SpellChecker) | 941 DEFINE_TRACE(SpellChecker) |
| 942 { | 942 { |
| 943 visitor->trace(m_frame); | 943 visitor->trace(m_frame); |
| 944 visitor->trace(m_spellCheckRequester); | 944 visitor->trace(m_spellCheckRequester); |
| 945 } | 945 } |
| 946 | 946 |
| 947 } // namespace blink | 947 } // namespace blink |
| OLD | NEW |