| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2  * Copyright (C) 2006, 2007 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 92             misspelling.replacement = client->getAutoCorrectSuggestionForMisspel
     ledWord(String(text + misspelling.location, misspelling.length)); | 92             misspelling.replacement = client->getAutoCorrectSuggestionForMisspel
     ledWord(String(text + misspelling.location, misspelling.length)); | 
| 93             results.append(misspelling); | 93             results.append(misspelling); | 
| 94         } | 94         } | 
| 95 | 95 | 
| 96         wordStart = wordEnd; | 96         wordStart = wordEnd; | 
| 97     } | 97     } | 
| 98 } | 98 } | 
| 99 | 99 | 
| 100 static PassRefPtr<Range> expandToParagraphBoundary(PassRefPtr<Range> range) | 100 static PassRefPtr<Range> expandToParagraphBoundary(PassRefPtr<Range> range) | 
| 101 { | 101 { | 
| 102     RefPtr<Range> paragraphRange = range->cloneRange(IGNORE_EXCEPTION_STATE); | 102     RefPtr<Range> paragraphRange = range->cloneRange(IGNORE_EXCEPTION); | 
| 103     setStart(paragraphRange.get(), startOfParagraph(range->startPosition())); | 103     setStart(paragraphRange.get(), startOfParagraph(range->startPosition())); | 
| 104     setEnd(paragraphRange.get(), endOfParagraph(range->endPosition())); | 104     setEnd(paragraphRange.get(), endOfParagraph(range->endPosition())); | 
| 105     return paragraphRange; | 105     return paragraphRange; | 
| 106 } | 106 } | 
| 107 | 107 | 
| 108 TextCheckingParagraph::TextCheckingParagraph(PassRefPtr<Range> checkingRange) | 108 TextCheckingParagraph::TextCheckingParagraph(PassRefPtr<Range> checkingRange) | 
| 109     : m_checkingRange(checkingRange) | 109     : m_checkingRange(checkingRange) | 
| 110     , m_checkingStart(-1) | 110     , m_checkingStart(-1) | 
| 111     , m_checkingEnd(-1) | 111     , m_checkingEnd(-1) | 
| 112     , m_checkingLength(-1) | 112     , m_checkingLength(-1) | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 156 | 156 | 
| 157 PassRefPtr<Range> TextCheckingParagraph::subrange(int characterOffset, int chara
     cterCount) const | 157 PassRefPtr<Range> TextCheckingParagraph::subrange(int characterOffset, int chara
     cterCount) const | 
| 158 { | 158 { | 
| 159     ASSERT(m_checkingRange); | 159     ASSERT(m_checkingRange); | 
| 160     return TextIterator::subrange(paragraphRange().get(), characterOffset, chara
     cterCount); | 160     return TextIterator::subrange(paragraphRange().get(), characterOffset, chara
     cterCount); | 
| 161 } | 161 } | 
| 162 | 162 | 
| 163 int TextCheckingParagraph::offsetTo(const Position& position, ExceptionState& es
     ) const | 163 int TextCheckingParagraph::offsetTo(const Position& position, ExceptionState& es
     ) const | 
| 164 { | 164 { | 
| 165     ASSERT(m_checkingRange); | 165     ASSERT(m_checkingRange); | 
| 166     RefPtr<Range> range = offsetAsRange()->cloneRange(ASSERT_NO_EXCEPTION_STATE)
     ; | 166     RefPtr<Range> range = offsetAsRange()->cloneRange(ASSERT_NO_EXCEPTION); | 
| 167     range->setEnd(position.containerNode(), position.computeOffsetInContainerNod
     e(), es); | 167     range->setEnd(position.containerNode(), position.computeOffsetInContainerNod
     e(), es); | 
| 168     if (es.hadException()) | 168     if (es.hadException()) | 
| 169         return 0; | 169         return 0; | 
| 170     return TextIterator::rangeLength(range.get()); | 170     return TextIterator::rangeLength(range.get()); | 
| 171 } | 171 } | 
| 172 | 172 | 
| 173 bool TextCheckingParagraph::isEmpty() const | 173 bool TextCheckingParagraph::isEmpty() const | 
| 174 { | 174 { | 
| 175     // Both predicates should have same result, but we check both just for sure. | 175     // Both predicates should have same result, but we check both just for sure. | 
| 176     // We need to investigate to remove this redundancy. | 176     // We need to investigate to remove this redundancy. | 
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 299     outIsSpelling = true; | 299     outIsSpelling = true; | 
| 300     outFirstFoundOffset = 0; | 300     outFirstFoundOffset = 0; | 
| 301     outGrammarDetail.location = -1; | 301     outGrammarDetail.location = -1; | 
| 302     outGrammarDetail.length = 0; | 302     outGrammarDetail.length = 0; | 
| 303     outGrammarDetail.guesses.clear(); | 303     outGrammarDetail.guesses.clear(); | 
| 304     outGrammarDetail.userDescription = ""; | 304     outGrammarDetail.userDescription = ""; | 
| 305 | 305 | 
| 306     // Expand the search range to encompass entire paragraphs, since text checki
     ng needs that much context. | 306     // Expand the search range to encompass entire paragraphs, since text checki
     ng needs that much context. | 
| 307     // Determine the character offset from the start of the paragraph to the sta
     rt of the original search range, | 307     // Determine the character offset from the start of the paragraph to the sta
     rt of the original search range, | 
| 308     // since we will want to ignore results in this area. | 308     // since we will want to ignore results in this area. | 
| 309     RefPtr<Range> paragraphRange = m_range->cloneRange(IGNORE_EXCEPTION_STATE); | 309     RefPtr<Range> paragraphRange = m_range->cloneRange(IGNORE_EXCEPTION); | 
| 310     setStart(paragraphRange.get(), startOfParagraph(m_range->startPosition())); | 310     setStart(paragraphRange.get(), startOfParagraph(m_range->startPosition())); | 
| 311     int totalRangeLength = TextIterator::rangeLength(paragraphRange.get()); | 311     int totalRangeLength = TextIterator::rangeLength(paragraphRange.get()); | 
| 312     setEnd(paragraphRange.get(), endOfParagraph(m_range->startPosition())); | 312     setEnd(paragraphRange.get(), endOfParagraph(m_range->startPosition())); | 
| 313 | 313 | 
| 314     RefPtr<Range> offsetAsRange = Range::create(paragraphRange->startContainer()
     ->document(), paragraphRange->startPosition(), m_range->startPosition()); | 314     RefPtr<Range> offsetAsRange = Range::create(paragraphRange->startContainer()
     ->document(), paragraphRange->startPosition(), m_range->startPosition()); | 
| 315     int rangeStartOffset = TextIterator::rangeLength(offsetAsRange.get()); | 315     int rangeStartOffset = TextIterator::rangeLength(offsetAsRange.get()); | 
| 316     int totalLengthProcessed = 0; | 316     int totalLengthProcessed = 0; | 
| 317 | 317 | 
| 318     bool firstIteration = true; | 318     bool firstIteration = true; | 
| 319     bool lastIteration = false; | 319     bool lastIteration = false; | 
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 572         return false; | 572         return false; | 
| 573 | 573 | 
| 574     const Settings* settings = frame->settings(); | 574     const Settings* settings = frame->settings(); | 
| 575     if (!settings) | 575     if (!settings) | 
| 576         return false; | 576         return false; | 
| 577 | 577 | 
| 578     return settings->unifiedTextCheckerEnabled(); | 578     return settings->unifiedTextCheckerEnabled(); | 
| 579 } | 579 } | 
| 580 | 580 | 
| 581 } | 581 } | 
| OLD | NEW | 
|---|