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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 // Now we remove markers on everything between startOfFirstWord and | 756 // Now we remove markers on everything between startOfFirstWord and |
757 // endOfLastWord. However, if an autocorrection change a single word to | 757 // endOfLastWord. However, if an autocorrection change a single word to |
758 // multiple words, we want to remove correction mark from all the resulted | 758 // multiple words, we want to remove correction mark from all the resulted |
759 // words even we only edit one of them. For example, assuming autocorrection | 759 // words even we only edit one of them. For example, assuming autocorrection |
760 // changes "avantgarde" to "avant garde", we will have CorrectionIndicator | 760 // changes "avantgarde" to "avant garde", we will have CorrectionIndicator |
761 // marker on both words and on the whitespace between them. If we then edit | 761 // marker on both words and on the whitespace between them. If we then edit |
762 // garde, we would like to remove the marker from word "avant" and whitespace | 762 // garde, we would like to remove the marker from word "avant" and whitespace |
763 // as well. So we need to get the continous range of of marker that contains | 763 // as well. So we need to get the continous range of of marker that contains |
764 // the word in question, and remove marker on that whole range. | 764 // the word in question, and remove marker on that whole range. |
765 const EphemeralRange word_range(remove_marker_start, remove_marker_end); | 765 const EphemeralRange word_range(remove_marker_start, remove_marker_end); |
766 document->Markers().RemoveMarkers( | 766 document->Markers().RemoveMarkers(word_range, |
767 word_range, DocumentMarker::MisspellingMarkers(), | 767 DocumentMarker::MisspellingMarkers()); |
768 DocumentMarkerController::kRemovePartiallyOverlappingMarker); | |
769 } | 768 } |
770 | 769 |
771 void SpellChecker::DidEndEditingOnTextField(Element* e) { | 770 void SpellChecker::DidEndEditingOnTextField(Element* e) { |
772 TRACE_EVENT0("blink", "SpellChecker::didEndEditingOnTextField"); | 771 TRACE_EVENT0("blink", "SpellChecker::didEndEditingOnTextField"); |
773 | 772 |
774 // Remove markers when deactivating a selection in an <input type="text"/>. | 773 // Remove markers when deactivating a selection in an <input type="text"/>. |
775 // Prevent new ones from appearing too. | 774 // Prevent new ones from appearing too. |
776 if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) | 775 if (!RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) |
777 spell_check_requester_->CancelCheck(); | 776 spell_check_requester_->CancelCheck(); |
778 TextControlElement* text_control_element = ToTextControlElement(e); | 777 TextControlElement* text_control_element = ToTextControlElement(e); |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 if (!input.IsFocusedElementInDocument()) | 1197 if (!input.IsFocusedElementInDocument()) |
1199 return false; | 1198 return false; |
1200 } | 1199 } |
1201 } | 1200 } |
1202 HTMLElement* element = | 1201 HTMLElement* element = |
1203 Traversal<HTMLElement>::FirstAncestorOrSelf(*position.AnchorNode()); | 1202 Traversal<HTMLElement>::FirstAncestorOrSelf(*position.AnchorNode()); |
1204 return element && element->IsSpellCheckingEnabled(); | 1203 return element && element->IsSpellCheckingEnabled(); |
1205 } | 1204 } |
1206 | 1205 |
1207 } // namespace blink | 1206 } // namespace blink |
OLD | NEW |