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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 bool selectionChanged = false; | 587 bool selectionChanged = false; |
588 bool restoreSelectionAfterChange = false; | 588 bool restoreSelectionAfterChange = false; |
589 bool adjustSelectionForParagraphBoundaries = false; | 589 bool adjustSelectionForParagraphBoundaries = false; |
590 | 590 |
591 if (shouldMarkSpelling) { | 591 if (shouldMarkSpelling) { |
592 if (frame().selection().isCaret()) { | 592 if (frame().selection().isCaret()) { |
593 // Attempt to save the caret position so we can restore it later if
needed | 593 // Attempt to save the caret position so we can restore it later if
needed |
594 Position caretPosition = frame().selection().end(); | 594 Position caretPosition = frame().selection().end(); |
595 selectionOffset = paragraph.offsetTo(caretPosition, ASSERT_NO_EXCEPT
ION); | 595 selectionOffset = paragraph.offsetTo(caretPosition, ASSERT_NO_EXCEPT
ION); |
596 restoreSelectionAfterChange = true; | 596 restoreSelectionAfterChange = true; |
597 if (selectionOffset > 0 && (static_cast<unsigned>(selectionOffset) >
paragraph.text().length() || paragraph.textCharAt(selectionOffset - 1) == newli
neCharacter)) | 597 if (selectionOffset > 0 && (static_cast<unsigned>(selectionOffset) >
paragraph.text().length() || paragraph.textCharAt(selectionOffset - 1) == chara
cterNewline)) |
598 adjustSelectionForParagraphBoundaries = true; | 598 adjustSelectionForParagraphBoundaries = true; |
599 if (selectionOffset > 0 && static_cast<unsigned>(selectionOffset) <=
paragraph.text().length() && isAmbiguousBoundaryCharacter(paragraph.textCharAt(
selectionOffset - 1))) | 599 if (selectionOffset > 0 && static_cast<unsigned>(selectionOffset) <=
paragraph.text().length() && isAmbiguousBoundaryCharacter(paragraph.textCharAt(
selectionOffset - 1))) |
600 ambiguousBoundaryOffset = selectionOffset - 1; | 600 ambiguousBoundaryOffset = selectionOffset - 1; |
601 } | 601 } |
602 } | 602 } |
603 | 603 |
604 for (unsigned i = 0; i < results.size(); i++) { | 604 for (unsigned i = 0; i < results.size(); i++) { |
605 int spellingRangeEndOffset = paragraph.checkingEnd(); | 605 int spellingRangeEndOffset = paragraph.checkingEnd(); |
606 const TextCheckingResult* result = &results[i]; | 606 const TextCheckingResult* result = &results[i]; |
607 int resultLocation = result->location + paragraph.checkingStart(); | 607 int resultLocation = result->location + paragraph.checkingStart(); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec
kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe
ck, rangeToCheck)); | 944 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec
kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe
ck, rangeToCheck)); |
945 } | 945 } |
946 | 946 |
947 DEFINE_TRACE(SpellChecker) | 947 DEFINE_TRACE(SpellChecker) |
948 { | 948 { |
949 visitor->trace(m_frame); | 949 visitor->trace(m_frame); |
950 visitor->trace(m_spellCheckRequester); | 950 visitor->trace(m_spellCheckRequester); |
951 } | 951 } |
952 | 952 |
953 } // namespace blink | 953 } // namespace blink |
OLD | NEW |