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

Side by Side Diff: third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp

Issue 2806683002: Don't ever split DocumentMarkers on remove (Closed)
Patch Set: Leave partial markers in place for non-splitting case, preserve endpoints for splitting case Created 3 years, 8 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
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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 // Now we remove markers on everything between startOfFirstWord and 745 // Now we remove markers on everything between startOfFirstWord and
746 // endOfLastWord. However, if an autocorrection change a single word to 746 // endOfLastWord. However, if an autocorrection change a single word to
747 // multiple words, we want to remove correction mark from all the resulted 747 // multiple words, we want to remove correction mark from all the resulted
748 // words even we only edit one of them. For example, assuming autocorrection 748 // words even we only edit one of them. For example, assuming autocorrection
749 // changes "avantgarde" to "avant garde", we will have CorrectionIndicator 749 // changes "avantgarde" to "avant garde", we will have CorrectionIndicator
750 // marker on both words and on the whitespace between them. If we then edit 750 // marker on both words and on the whitespace between them. If we then edit
751 // garde, we would like to remove the marker from word "avant" and whitespace 751 // garde, we would like to remove the marker from word "avant" and whitespace
752 // as well. So we need to get the continous range of of marker that contains 752 // as well. So we need to get the continous range of of marker that contains
753 // the word in question, and remove marker on that whole range. 753 // the word in question, and remove marker on that whole range.
754 const EphemeralRange wordRange(removeMarkerStart, removeMarkerEnd); 754 const EphemeralRange wordRange(removeMarkerStart, removeMarkerEnd);
755 document->markers().removeMarkers( 755 document->markers().removeMarkers(wordRange,
756 wordRange, DocumentMarker::MisspellingMarkers(), 756 DocumentMarker::MisspellingMarkers());
757 DocumentMarkerController::RemovePartiallyOverlappingMarker);
758 } 757 }
759 758
760 void SpellChecker::didEndEditingOnTextField(Element* e) { 759 void SpellChecker::didEndEditingOnTextField(Element* e) {
761 TRACE_EVENT0("blink", "SpellChecker::didEndEditingOnTextField"); 760 TRACE_EVENT0("blink", "SpellChecker::didEndEditingOnTextField");
762 761
763 // Remove markers when deactivating a selection in an <input type="text"/>. 762 // Remove markers when deactivating a selection in an <input type="text"/>.
764 // Prevent new ones from appearing too. 763 // Prevent new ones from appearing too.
765 if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) 764 if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled())
766 m_spellCheckRequester->cancelCheck(); 765 m_spellCheckRequester->cancelCheck();
767 TextControlElement* textControlElement = toTextControlElement(e); 766 TextControlElement* textControlElement = toTextControlElement(e);
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 if (!input.isFocusedElementInDocument()) 1178 if (!input.isFocusedElementInDocument())
1180 return false; 1179 return false;
1181 } 1180 }
1182 } 1181 }
1183 HTMLElement* element = 1182 HTMLElement* element =
1184 Traversal<HTMLElement>::firstAncestorOrSelf(*position.anchorNode()); 1183 Traversal<HTMLElement>::firstAncestorOrSelf(*position.anchorNode());
1185 return element && element->isSpellCheckingEnabled(); 1184 return element && element->isSpellCheckingEnabled();
1186 } 1185 }
1187 1186
1188 } // namespace blink 1187 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698