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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 markMisspellingsAndBadGrammar(selection); | 137 markMisspellingsAndBadGrammar(selection); |
138 if (!isTextField) | 138 if (!isTextField) |
139 parent->setAlreadySpellChecked(true); | 139 parent->setAlreadySpellChecked(true); |
140 } | 140 } |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 void SpellChecker::ignoreSpelling() | 144 void SpellChecker::ignoreSpelling() |
145 { | 145 { |
146 if (RefPtr<Range> selectedRange = m_frame.selection().toNormalizedRange()) | 146 if (RefPtr<Range> selectedRange = m_frame.selection().toNormalizedRange()) |
147 m_frame.document()->markers()->removeMarkers(selectedRange.get(), Docume
ntMarker::Spelling); | 147 m_frame.document()->markers().removeMarkers(selectedRange.get(), Documen
tMarker::Spelling); |
148 } | 148 } |
149 | 149 |
150 void SpellChecker::advanceToNextMisspelling(bool startBeforeSelection) | 150 void SpellChecker::advanceToNextMisspelling(bool startBeforeSelection) |
151 { | 151 { |
152 // The basic approach is to search in two phases - from the selection end to
the end of the doc, and | 152 // The basic approach is to search in two phases - from the selection end to
the end of the doc, and |
153 // then we wrap and search from the doc start to (approximately) where we st
arted. | 153 // then we wrap and search from the doc start to (approximately) where we st
arted. |
154 | 154 |
155 // Start at the end of the selection, search to edge of document. Starting a
t the selection end makes | 155 // Start at the end of the selection, search to edge of document. Starting a
t the selection end makes |
156 // repeated "check spelling" commands work. | 156 // repeated "check spelling" commands work. |
157 VisibleSelection selection(m_frame.selection().selection()); | 157 VisibleSelection selection(m_frame.selection().selection()); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 // panel, and store a marker so we draw the green squiggle later. | 283 // panel, and store a marker so we draw the green squiggle later. |
284 | 284 |
285 ASSERT(badGrammarPhrase.length() > 0); | 285 ASSERT(badGrammarPhrase.length() > 0); |
286 ASSERT(grammarDetail.location != -1 && grammarDetail.length > 0); | 286 ASSERT(grammarDetail.location != -1 && grammarDetail.length > 0); |
287 | 287 |
288 // FIXME 4859190: This gets confused with doubled punctuation at the end
of a paragraph | 288 // FIXME 4859190: This gets confused with doubled punctuation at the end
of a paragraph |
289 RefPtr<Range> badGrammarRange = TextIterator::subrange(grammarSearchRang
e.get(), grammarPhraseOffset + grammarDetail.location, grammarDetail.length); | 289 RefPtr<Range> badGrammarRange = TextIterator::subrange(grammarSearchRang
e.get(), grammarPhraseOffset + grammarDetail.location, grammarDetail.length); |
290 m_frame.selection().setSelection(VisibleSelection(badGrammarRange.get(),
SEL_DEFAULT_AFFINITY)); | 290 m_frame.selection().setSelection(VisibleSelection(badGrammarRange.get(),
SEL_DEFAULT_AFFINITY)); |
291 m_frame.selection().revealSelection(); | 291 m_frame.selection().revealSelection(); |
292 | 292 |
293 m_frame.document()->markers()->addMarker(badGrammarRange.get(), Document
Marker::Grammar, grammarDetail.userDescription); | 293 m_frame.document()->markers().addMarker(badGrammarRange.get(), DocumentM
arker::Grammar, grammarDetail.userDescription); |
294 } else if (!misspelledWord.isEmpty()) { | 294 } else if (!misspelledWord.isEmpty()) { |
295 // We found a misspelling, but not any earlier bad grammar. Select the m
isspelling, update the spelling panel, and store | 295 // We found a misspelling, but not any earlier bad grammar. Select the m
isspelling, update the spelling panel, and store |
296 // a marker so we draw the red squiggle later. | 296 // a marker so we draw the red squiggle later. |
297 | 297 |
298 RefPtr<Range> misspellingRange = TextIterator::subrange(spellingSearchRa
nge.get(), misspellingOffset, misspelledWord.length()); | 298 RefPtr<Range> misspellingRange = TextIterator::subrange(spellingSearchRa
nge.get(), misspellingOffset, misspelledWord.length()); |
299 m_frame.selection().setSelection(VisibleSelection(misspellingRange.get()
, DOWNSTREAM)); | 299 m_frame.selection().setSelection(VisibleSelection(misspellingRange.get()
, DOWNSTREAM)); |
300 m_frame.selection().revealSelection(); | 300 m_frame.selection().revealSelection(); |
301 | 301 |
302 spellCheckerClient().updateSpellingUIWithMisspelledWord(misspelledWord); | 302 spellCheckerClient().updateSpellingUIWithMisspelledWord(misspelledWord); |
303 m_frame.document()->markers()->addMarker(misspellingRange.get(), Documen
tMarker::Spelling); | 303 m_frame.document()->markers().addMarker(misspellingRange.get(), Document
Marker::Spelling); |
304 } | 304 } |
305 } | 305 } |
306 | 306 |
307 void SpellChecker::showSpellingGuessPanel() | 307 void SpellChecker::showSpellingGuessPanel() |
308 { | 308 { |
309 if (spellCheckerClient().spellingUIIsShowing()) { | 309 if (spellCheckerClient().spellingUIIsShowing()) { |
310 spellCheckerClient().showSpellingUI(false); | 310 spellCheckerClient().showSpellingUI(false); |
311 return; | 311 return; |
312 } | 312 } |
313 | 313 |
314 advanceToNextMisspelling(true); | 314 advanceToNextMisspelling(true); |
315 spellCheckerClient().showSpellingUI(true); | 315 spellCheckerClient().showSpellingUI(true); |
316 } | 316 } |
317 | 317 |
318 void SpellChecker::clearMisspellingsAndBadGrammar(const VisibleSelection &moving
Selection) | 318 void SpellChecker::clearMisspellingsAndBadGrammar(const VisibleSelection &moving
Selection) |
319 { | 319 { |
320 RefPtr<Range> selectedRange = movingSelection.toNormalizedRange(); | 320 RefPtr<Range> selectedRange = movingSelection.toNormalizedRange(); |
321 if (selectedRange) | 321 if (selectedRange) |
322 m_frame.document()->markers()->removeMarkers(selectedRange.get(), Docume
ntMarker::MisspellingMarkers()); | 322 m_frame.document()->markers().removeMarkers(selectedRange.get(), Documen
tMarker::MisspellingMarkers()); |
323 } | 323 } |
324 | 324 |
325 void SpellChecker::markMisspellingsAndBadGrammar(const VisibleSelection &movingS
election) | 325 void SpellChecker::markMisspellingsAndBadGrammar(const VisibleSelection &movingS
election) |
326 { | 326 { |
327 markMisspellingsAndBadGrammar(movingSelection, isContinuousSpellCheckingEnab
led() && isGrammarCheckingEnabled(), movingSelection); | 327 markMisspellingsAndBadGrammar(movingSelection, isContinuousSpellCheckingEnab
led() && isGrammarCheckingEnabled(), movingSelection); |
328 } | 328 } |
329 | 329 |
330 void SpellChecker::markMisspellingsAfterTypingToWord(const VisiblePosition &word
Start, const VisibleSelection& selectionAfterTyping) | 330 void SpellChecker::markMisspellingsAfterTypingToWord(const VisiblePosition &word
Start, const VisibleSelection& selectionAfterTyping) |
331 { | 331 { |
332 if (unifiedTextCheckerEnabled()) { | 332 if (unifiedTextCheckerEnabled()) { |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 bool resultEndsAtAmbiguousBoundary = ambiguousBoundaryOffset >= 0 && res
ultLocation + resultLength == ambiguousBoundaryOffset; | 562 bool resultEndsAtAmbiguousBoundary = ambiguousBoundaryOffset >= 0 && res
ultLocation + resultLength == ambiguousBoundaryOffset; |
563 | 563 |
564 // Only mark misspelling if: | 564 // Only mark misspelling if: |
565 // 1. Current text checking isn't done for autocorrection, in which case
shouldMarkSpelling is false. | 565 // 1. Current text checking isn't done for autocorrection, in which case
shouldMarkSpelling is false. |
566 // 2. Result falls within spellingRange. | 566 // 2. Result falls within spellingRange. |
567 // 3. The word in question doesn't end at an ambiguous boundary. For ins
tance, we would not mark | 567 // 3. The word in question doesn't end at an ambiguous boundary. For ins
tance, we would not mark |
568 // "wouldn'" as misspelled right after apostrophe is typed. | 568 // "wouldn'" as misspelled right after apostrophe is typed. |
569 if (shouldMarkSpelling && result->decoration == TextDecorationTypeSpelli
ng && resultLocation >= paragraph.checkingStart() && resultLocation + resultLeng
th <= spellingRangeEndOffset && !resultEndsAtAmbiguousBoundary) { | 569 if (shouldMarkSpelling && result->decoration == TextDecorationTypeSpelli
ng && resultLocation >= paragraph.checkingStart() && resultLocation + resultLeng
th <= spellingRangeEndOffset && !resultEndsAtAmbiguousBoundary) { |
570 ASSERT(resultLength > 0 && resultLocation >= 0); | 570 ASSERT(resultLength > 0 && resultLocation >= 0); |
571 RefPtr<Range> misspellingRange = paragraph.subrange(resultLocation,
resultLength); | 571 RefPtr<Range> misspellingRange = paragraph.subrange(resultLocation,
resultLength); |
572 misspellingRange->startContainer()->document().markers()->addMarker(
misspellingRange.get(), DocumentMarker::Spelling, result->replacement, result->h
ash); | 572 misspellingRange->startContainer()->document().markers().addMarker(m
isspellingRange.get(), DocumentMarker::Spelling, result->replacement, result->ha
sh); |
573 } else if (shouldMarkGrammar && result->decoration == TextDecorationType
Grammar && paragraph.checkingRangeCovers(resultLocation, resultLength)) { | 573 } else if (shouldMarkGrammar && result->decoration == TextDecorationType
Grammar && paragraph.checkingRangeCovers(resultLocation, resultLength)) { |
574 ASSERT(resultLength > 0 && resultLocation >= 0); | 574 ASSERT(resultLength > 0 && resultLocation >= 0); |
575 for (unsigned j = 0; j < result->details.size(); j++) { | 575 for (unsigned j = 0; j < result->details.size(); j++) { |
576 const GrammarDetail* detail = &result->details[j]; | 576 const GrammarDetail* detail = &result->details[j]; |
577 ASSERT(detail->length > 0 && detail->location >= 0); | 577 ASSERT(detail->length > 0 && detail->location >= 0); |
578 if (paragraph.checkingRangeCovers(resultLocation + detail->locat
ion, detail->length)) { | 578 if (paragraph.checkingRangeCovers(resultLocation + detail->locat
ion, detail->length)) { |
579 RefPtr<Range> badGrammarRange = paragraph.subrange(resultLoc
ation + detail->location, detail->length); | 579 RefPtr<Range> badGrammarRange = paragraph.subrange(resultLoc
ation + detail->location, detail->length); |
580 badGrammarRange->startContainer()->document().markers()->add
Marker(badGrammarRange.get(), DocumentMarker::Grammar, detail->userDescription,
result->hash); | 580 badGrammarRange->startContainer()->document().markers().addM
arker(badGrammarRange.get(), DocumentMarker::Grammar, detail->userDescription, r
esult->hash); |
581 } | 581 } |
582 } | 582 } |
583 } else if (result->decoration == TextDecorationTypeInvisibleSpellcheck &
& resultLocation >= paragraph.checkingStart() && resultLocation + resultLength <
= spellingRangeEndOffset) { | 583 } else if (result->decoration == TextDecorationTypeInvisibleSpellcheck &
& resultLocation >= paragraph.checkingStart() && resultLocation + resultLength <
= spellingRangeEndOffset) { |
584 ASSERT(resultLength > 0 && resultLocation >= 0); | 584 ASSERT(resultLength > 0 && resultLocation >= 0); |
585 RefPtr<Range> invisibleSpellcheckRange = paragraph.subrange(resultLo
cation, resultLength); | 585 RefPtr<Range> invisibleSpellcheckRange = paragraph.subrange(resultLo
cation, resultLength); |
586 invisibleSpellcheckRange->startContainer()->document().markers()->ad
dMarker(invisibleSpellcheckRange.get(), DocumentMarker::InvisibleSpellcheck, res
ult->replacement, result->hash); | 586 invisibleSpellcheckRange->startContainer()->document().markers().add
Marker(invisibleSpellcheckRange.get(), DocumentMarker::InvisibleSpellcheck, resu
lt->replacement, result->hash); |
587 } | 587 } |
588 } | 588 } |
589 | 589 |
590 if (selectionChanged) { | 590 if (selectionChanged) { |
591 TextCheckingParagraph extendedParagraph(paragraph); | 591 TextCheckingParagraph extendedParagraph(paragraph); |
592 // Restore the caret position if we have made any replacements | 592 // Restore the caret position if we have made any replacements |
593 extendedParagraph.expandRangeToNextEnd(); | 593 extendedParagraph.expandRangeToNextEnd(); |
594 if (restoreSelectionAfterChange && selectionOffset >= 0 && selectionOffs
et <= extendedParagraph.rangeLength()) { | 594 if (restoreSelectionAfterChange && selectionOffset >= 0 && selectionOffs
et <= extendedParagraph.rangeLength()) { |
595 RefPtr<Range> selectionRange = extendedParagraph.subrange(0, selecti
onOffset); | 595 RefPtr<Range> selectionRange = extendedParagraph.subrange(0, selecti
onOffset); |
596 m_frame.selection().moveTo(selectionRange->endPosition(), DOWNSTREAM
); | 596 m_frame.selection().moveTo(selectionRange->endPosition(), DOWNSTREAM
); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 // Now we remove markers on everything between startOfFirstWord and endOfLas
tWord. | 684 // Now we remove markers on everything between startOfFirstWord and endOfLas
tWord. |
685 // However, if an autocorrection change a single word to multiple words, we
want to remove correction mark from all the | 685 // However, if an autocorrection change a single word to multiple words, we
want to remove correction mark from all the |
686 // resulted words even we only edit one of them. For example, assuming autoc
orrection changes "avantgarde" to "avant | 686 // resulted words even we only edit one of them. For example, assuming autoc
orrection changes "avantgarde" to "avant |
687 // garde", we will have CorrectionIndicator marker on both words and on the
whitespace between them. If we then edit garde, | 687 // garde", we will have CorrectionIndicator marker on both words and on the
whitespace between them. If we then edit garde, |
688 // we would like to remove the marker from word "avant" and whitespace as we
ll. So we need to get the continous range of | 688 // we would like to remove the marker from word "avant" and whitespace as we
ll. So we need to get the continous range of |
689 // of marker that contains the word in question, and remove marker on that w
hole range. | 689 // of marker that contains the word in question, and remove marker on that w
hole range. |
690 Document* document = m_frame.document(); | 690 Document* document = m_frame.document(); |
691 ASSERT(document); | 691 ASSERT(document); |
692 RefPtr<Range> wordRange = Range::create(*document, startOfFirstWord.deepEqui
valent(), endOfLastWord.deepEquivalent()); | 692 RefPtr<Range> wordRange = Range::create(*document, startOfFirstWord.deepEqui
valent(), endOfLastWord.deepEquivalent()); |
693 | 693 |
694 document->markers()->removeMarkers(wordRange.get(), DocumentMarker::Misspell
ingMarkers(), DocumentMarkerController::RemovePartiallyOverlappingMarker); | 694 document->markers().removeMarkers(wordRange.get(), DocumentMarker::Misspelli
ngMarkers(), DocumentMarkerController::RemovePartiallyOverlappingMarker); |
695 } | 695 } |
696 | 696 |
697 void SpellChecker::didEndEditingOnTextField(Element* e) | 697 void SpellChecker::didEndEditingOnTextField(Element* e) |
698 { | 698 { |
699 // Remove markers when deactivating a selection in an <input type="text"/>. | 699 // Remove markers when deactivating a selection in an <input type="text"/>. |
700 // Prevent new ones from appearing too. | 700 // Prevent new ones from appearing too. |
701 m_spellCheckRequester->cancelCheck(); | 701 m_spellCheckRequester->cancelCheck(); |
702 HTMLTextFormControlElement* textFormControlElement = toHTMLTextFormControlEl
ement(e); | 702 HTMLTextFormControlElement* textFormControlElement = toHTMLTextFormControlEl
ement(e); |
703 HTMLElement* innerText = textFormControlElement->innerTextElement(); | 703 HTMLElement* innerText = textFormControlElement->innerTextElement(); |
704 DocumentMarker::MarkerTypes markerTypes(DocumentMarker::Spelling); | 704 DocumentMarker::MarkerTypes markerTypes(DocumentMarker::Spelling); |
705 if (isGrammarCheckingEnabled() || unifiedTextCheckerEnabled()) | 705 if (isGrammarCheckingEnabled() || unifiedTextCheckerEnabled()) |
706 markerTypes.add(DocumentMarker::Grammar); | 706 markerTypes.add(DocumentMarker::Grammar); |
707 for (Node* node = innerText; node; node = NodeTraversal::next(*node, innerTe
xt)) { | 707 for (Node* node = innerText; node; node = NodeTraversal::next(*node, innerTe
xt)) { |
708 m_frame.document()->markers()->removeMarkers(node, markerTypes); | 708 m_frame.document()->markers().removeMarkers(node, markerTypes); |
709 } | 709 } |
710 } | 710 } |
711 | 711 |
712 void SpellChecker::respondToChangedSelection(const VisibleSelection& oldSelectio
n, FrameSelection::SetSelectionOptions options) | 712 void SpellChecker::respondToChangedSelection(const VisibleSelection& oldSelectio
n, FrameSelection::SetSelectionOptions options) |
713 { | 713 { |
714 bool closeTyping = options & FrameSelection::CloseTyping; | 714 bool closeTyping = options & FrameSelection::CloseTyping; |
715 bool isContinuousSpellCheckingEnabled = this->isContinuousSpellCheckingEnabl
ed(); | 715 bool isContinuousSpellCheckingEnabled = this->isContinuousSpellCheckingEnabl
ed(); |
716 bool isContinuousGrammarCheckingEnabled = isContinuousSpellCheckingEnabled &
& isGrammarCheckingEnabled(); | 716 bool isContinuousGrammarCheckingEnabled = isContinuousSpellCheckingEnabled &
& isGrammarCheckingEnabled(); |
717 if (isContinuousSpellCheckingEnabled) { | 717 if (isContinuousSpellCheckingEnabled) { |
718 VisibleSelection newAdjacentWords; | 718 VisibleSelection newAdjacentWords; |
(...skipping 15 matching lines...) Expand all Loading... |
734 if (shouldCheckSpellingAndGrammar | 734 if (shouldCheckSpellingAndGrammar |
735 && closeTyping | 735 && closeTyping |
736 && oldSelection.isContentEditable() | 736 && oldSelection.isContentEditable() |
737 && oldSelection.start().inDocument() | 737 && oldSelection.start().inDocument() |
738 && !isSelectionInTextField(oldSelection)) { | 738 && !isSelectionInTextField(oldSelection)) { |
739 spellCheckOldSelection(oldSelection, newAdjacentWords, newSelectedSe
ntence); | 739 spellCheckOldSelection(oldSelection, newAdjacentWords, newSelectedSe
ntence); |
740 } | 740 } |
741 | 741 |
742 if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTyp
eSpelling)) { | 742 if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTyp
eSpelling)) { |
743 if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange()) | 743 if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange()) |
744 m_frame.document()->markers()->removeMarkers(wordRange.get(), Do
cumentMarker::Spelling); | 744 m_frame.document()->markers().removeMarkers(wordRange.get(), Doc
umentMarker::Spelling); |
745 } | 745 } |
746 if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTyp
eGrammar)) { | 746 if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTyp
eGrammar)) { |
747 if (RefPtr<Range> sentenceRange = newSelectedSentence.toNormalizedRa
nge()) | 747 if (RefPtr<Range> sentenceRange = newSelectedSentence.toNormalizedRa
nge()) |
748 m_frame.document()->markers()->removeMarkers(sentenceRange.get()
, DocumentMarker::Grammar); | 748 m_frame.document()->markers().removeMarkers(sentenceRange.get(),
DocumentMarker::Grammar); |
749 } | 749 } |
750 } | 750 } |
751 | 751 |
752 // When continuous spell checking is off, existing markers disappear after t
he selection changes. | 752 // When continuous spell checking is off, existing markers disappear after t
he selection changes. |
753 if (!isContinuousSpellCheckingEnabled) | 753 if (!isContinuousSpellCheckingEnabled) |
754 m_frame.document()->markers()->removeMarkers(DocumentMarker::Spelling); | 754 m_frame.document()->markers().removeMarkers(DocumentMarker::Spelling); |
755 if (!isContinuousGrammarCheckingEnabled) | 755 if (!isContinuousGrammarCheckingEnabled) |
756 m_frame.document()->markers()->removeMarkers(DocumentMarker::Grammar); | 756 m_frame.document()->markers().removeMarkers(DocumentMarker::Grammar); |
757 } | 757 } |
758 | 758 |
759 void SpellChecker::spellCheckAfterBlur() | 759 void SpellChecker::spellCheckAfterBlur() |
760 { | 760 { |
761 if (!m_frame.selection().selection().isContentEditable()) | 761 if (!m_frame.selection().selection().isContentEditable()) |
762 return; | 762 return; |
763 | 763 |
764 if (isSelectionInTextField(m_frame.selection().selection())) { | 764 if (isSelectionInTextField(m_frame.selection().selection())) { |
765 // textFieldDidEndEditing() and textFieldDidBeginEditing() handle this. | 765 // textFieldDidEndEditing() and textFieldDidBeginEditing() handle this. |
766 return; | 766 return; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 } | 803 } |
804 | 804 |
805 bool SpellChecker::selectionStartHasMarkerFor(DocumentMarker::MarkerType markerT
ype, int from, int length) const | 805 bool SpellChecker::selectionStartHasMarkerFor(DocumentMarker::MarkerType markerT
ype, int from, int length) const |
806 { | 806 { |
807 Node* node = findFirstMarkable(m_frame.selection().start().deprecatedNode())
; | 807 Node* node = findFirstMarkable(m_frame.selection().start().deprecatedNode())
; |
808 if (!node) | 808 if (!node) |
809 return false; | 809 return false; |
810 | 810 |
811 unsigned startOffset = static_cast<unsigned>(from); | 811 unsigned startOffset = static_cast<unsigned>(from); |
812 unsigned endOffset = static_cast<unsigned>(from + length); | 812 unsigned endOffset = static_cast<unsigned>(from + length); |
813 Vector<DocumentMarker*> markers = m_frame.document()->markers()->markersFor(
node); | 813 Vector<DocumentMarker*> markers = m_frame.document()->markers().markersFor(n
ode); |
814 for (size_t i = 0; i < markers.size(); ++i) { | 814 for (size_t i = 0; i < markers.size(); ++i) { |
815 DocumentMarker* marker = markers[i]; | 815 DocumentMarker* marker = markers[i]; |
816 if (marker->startOffset() <= startOffset && endOffset <= marker->endOffs
et() && marker->type() == markerType) | 816 if (marker->startOffset() <= startOffset && endOffset <= marker->endOffs
et() && marker->type() == markerType) |
817 return true; | 817 return true; |
818 } | 818 } |
819 | 819 |
820 return false; | 820 return false; |
821 } | 821 } |
822 | 822 |
823 TextCheckingTypeMask SpellChecker::resolveTextCheckingTypeMask(TextCheckingTypeM
ask textCheckingOptions) | 823 TextCheckingTypeMask SpellChecker::resolveTextCheckingTypeMask(TextCheckingTypeM
ask textCheckingOptions) |
(...skipping 21 matching lines...) Expand all Loading... |
845 } | 845 } |
846 | 846 |
847 void SpellChecker::requestTextChecking(const Element& element) | 847 void SpellChecker::requestTextChecking(const Element& element) |
848 { | 848 { |
849 RefPtr<Range> rangeToCheck = rangeOfContents(const_cast<Element*>(&element))
; | 849 RefPtr<Range> rangeToCheck = rangeOfContents(const_cast<Element*>(&element))
; |
850 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec
kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe
ck, rangeToCheck)); | 850 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec
kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe
ck, rangeToCheck)); |
851 } | 851 } |
852 | 852 |
853 | 853 |
854 } // namespace WebCore | 854 } // namespace WebCore |
OLD | NEW |