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 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 && !isSelectionInTextField(oldSelection) | 796 && !isSelectionInTextField(oldSelection) |
797 && (isSelectionInTextArea(oldSelection) || oldSelection.isContentEdi
table()) | 797 && (isSelectionInTextArea(oldSelection) || oldSelection.isContentEdi
table()) |
798 && oldSelection.start().inDocument()) { | 798 && oldSelection.start().inDocument()) { |
799 spellCheckOldSelection(oldSelection, newAdjacentWords); | 799 spellCheckOldSelection(oldSelection, newAdjacentWords); |
800 } | 800 } |
801 | 801 |
802 // FIXME(http://crbug.com/382809): | 802 // FIXME(http://crbug.com/382809): |
803 // shouldEraseMarkersAfterChangeSelection is true, we cause synchronous | 803 // shouldEraseMarkersAfterChangeSelection is true, we cause synchronous |
804 // layout. | 804 // layout. |
805 if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTyp
eSpelling)) { | 805 if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTyp
eSpelling)) { |
806 if (RefPtrWillBeRawPtr<Range> wordRange = newAdjacentWords.toNormali
zedRange()) | 806 Position start, end; |
807 m_frame.document()->markers().removeMarkers(wordRange.get(), Doc
umentMarker::Spelling); | 807 if (newAdjacentWords.toNormalizedPositions(start, end)) |
| 808 m_frame.document()->markers().removeMarkers(start, end, Document
Marker::Spelling); |
808 } | 809 } |
809 if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTyp
eGrammar)) { | 810 if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTyp
eGrammar)) { |
810 if (RefPtrWillBeRawPtr<Range> sentenceRange = newSelectedSentence.to
NormalizedRange()) | 811 Position start, end; |
811 m_frame.document()->markers().removeMarkers(sentenceRange.get(),
DocumentMarker::Grammar); | 812 if (newSelectedSentence.toNormalizedPositions(start, end)) |
| 813 m_frame.document()->markers().removeMarkers(start, end, Document
Marker::Grammar); |
812 } | 814 } |
813 } | 815 } |
814 | 816 |
815 // When continuous spell checking is off, existing markers disappear after t
he selection changes. | 817 // When continuous spell checking is off, existing markers disappear after t
he selection changes. |
816 if (!isContinuousSpellCheckingEnabled) | 818 if (!isContinuousSpellCheckingEnabled) |
817 m_frame.document()->markers().removeMarkers(DocumentMarker::Spelling); | 819 m_frame.document()->markers().removeMarkers(DocumentMarker::Spelling); |
818 if (!isContinuousGrammarCheckingEnabled) | 820 if (!isContinuousGrammarCheckingEnabled) |
819 m_frame.document()->markers().removeMarkers(DocumentMarker::Grammar); | 821 m_frame.document()->markers().removeMarkers(DocumentMarker::Grammar); |
820 } | 822 } |
821 | 823 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 } | 929 } |
928 | 930 |
929 void SpellChecker::requestTextChecking(const Element& element) | 931 void SpellChecker::requestTextChecking(const Element& element) |
930 { | 932 { |
931 RefPtrWillBeRawPtr<Range> rangeToCheck = rangeOfContents(const_cast<Element*
>(&element)); | 933 RefPtrWillBeRawPtr<Range> rangeToCheck = rangeOfContents(const_cast<Element*
>(&element)); |
932 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec
kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe
ck, rangeToCheck)); | 934 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec
kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe
ck, rangeToCheck)); |
933 } | 935 } |
934 | 936 |
935 | 937 |
936 } // namespace blink | 938 } // namespace blink |
OLD | NEW |