Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: Source/core/editing/Editor.cpp

Issue 23450030: Introduce Position::inDocument() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/core/editing/DeleteSelectionCommand.cpp ('k') | Source/core/editing/IndentOutdentCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698