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 2080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2091 | 2091 |
2092 // Don't check spelling and grammar if the change of selection is trigge
red by spelling correction itself. | 2092 // Don't check spelling and grammar if the change of selection is trigge
red by spelling correction itself. |
2093 bool shouldCheckSpellingAndGrammar = !(options & FrameSelection::SpellCo
rrectionTriggered); | 2093 bool shouldCheckSpellingAndGrammar = !(options & FrameSelection::SpellCo
rrectionTriggered); |
2094 | 2094 |
2095 // When typing we check spelling elsewhere, so don't redo it here. | 2095 // When typing we check spelling elsewhere, so don't redo it here. |
2096 // If this is a change in selection resulting from a delete operation, | 2096 // If this is a change in selection resulting from a delete operation, |
2097 // oldSelection may no longer be in the document. | 2097 // oldSelection may no longer be in the document. |
2098 if (shouldCheckSpellingAndGrammar | 2098 if (shouldCheckSpellingAndGrammar |
2099 && closeTyping | 2099 && closeTyping |
2100 && oldSelection.isContentEditable() | 2100 && oldSelection.isContentEditable() |
2101 && oldSelection.start().deprecatedNode() | 2101 && oldSelection.start().inDocument() |
2102 && oldSelection.start().anchorNode()->inDocument() | |
2103 && !isSelectionInTextField(oldSelection)) { | 2102 && !isSelectionInTextField(oldSelection)) { |
2104 spellCheckOldSelection(oldSelection, newAdjacentWords, newSelectedSe
ntence); | 2103 spellCheckOldSelection(oldSelection, newAdjacentWords, newSelectedSe
ntence); |
2105 } | 2104 } |
2106 | 2105 |
2107 if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTyp
eSpelling)) { | 2106 if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTyp
eSpelling)) { |
2108 if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange()) | 2107 if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange()) |
2109 m_frame->document()->markers()->removeMarkers(wordRange.get(), D
ocumentMarker::Spelling); | 2108 m_frame->document()->markers()->removeMarkers(wordRange.get(), D
ocumentMarker::Spelling); |
2110 } | 2109 } |
2111 if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTyp
eGrammar)) { | 2110 if (textChecker().shouldEraseMarkersAfterChangeSelection(TextCheckingTyp
eGrammar)) { |
2112 if (RefPtr<Range> sentenceRange = newSelectedSentence.toNormalizedRa
nge()) | 2111 if (RefPtr<Range> sentenceRange = newSelectedSentence.toNormalizedRa
nge()) |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2208 return WebCore::unifiedTextCheckerEnabled(m_frame); | 2207 return WebCore::unifiedTextCheckerEnabled(m_frame); |
2209 } | 2208 } |
2210 | 2209 |
2211 void Editor::toggleOverwriteModeEnabled() | 2210 void Editor::toggleOverwriteModeEnabled() |
2212 { | 2211 { |
2213 m_overwriteModeEnabled = !m_overwriteModeEnabled; | 2212 m_overwriteModeEnabled = !m_overwriteModeEnabled; |
2214 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled); | 2213 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled); |
2215 }; | 2214 }; |
2216 | 2215 |
2217 } // namespace WebCore | 2216 } // namespace WebCore |
OLD | NEW |