| 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 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 return; | 872 return; |
| 873 } | 873 } |
| 874 | 874 |
| 875 TRACE_EVENT0("blink", "SpellChecker::respondToChangedSelection"); | 875 TRACE_EVENT0("blink", "SpellChecker::respondToChangedSelection"); |
| 876 if (!IsSpellCheckingEnabledAt(old_selection_start)) | 876 if (!IsSpellCheckingEnabledAt(old_selection_start)) |
| 877 return; | 877 return; |
| 878 | 878 |
| 879 // When spell checking is off, existing markers disappear after the selection | 879 // When spell checking is off, existing markers disappear after the selection |
| 880 // changes. | 880 // changes. |
| 881 if (!IsSpellCheckingEnabled()) { | 881 if (!IsSpellCheckingEnabled()) { |
| 882 GetFrame().GetDocument()->Markers().RemoveMarkers( | 882 GetFrame().GetDocument()->Markers().RemoveMarkersOfTypes( |
| 883 DocumentMarker::kSpelling); | 883 DocumentMarker::kSpelling); |
| 884 GetFrame().GetDocument()->Markers().RemoveMarkers(DocumentMarker::kGrammar); | 884 GetFrame().GetDocument()->Markers().RemoveMarkersOfTypes( |
| 885 DocumentMarker::kGrammar); |
| 885 return; | 886 return; |
| 886 } | 887 } |
| 887 | 888 |
| 888 if (!(options & FrameSelection::kCloseTyping)) | 889 if (!(options & FrameSelection::kCloseTyping)) |
| 889 return; | 890 return; |
| 890 if (!ShouldCheckOldSelection(old_selection_start)) | 891 if (!ShouldCheckOldSelection(old_selection_start)) |
| 891 return; | 892 return; |
| 892 | 893 |
| 893 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets | 894 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| 894 // needs to be audited. See http://crbug.com/590369 for more details. | 895 // needs to be audited. See http://crbug.com/590369 for more details. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 915 SpellCheckOldSelection(old_selection_start, new_adjacent_words); | 916 SpellCheckOldSelection(old_selection_start, new_adjacent_words); |
| 916 } | 917 } |
| 917 | 918 |
| 918 void SpellChecker::RespondToChangedContents() { | 919 void SpellChecker::RespondToChangedContents() { |
| 919 UpdateMarkersForWordsAffectedByEditing(true); | 920 UpdateMarkersForWordsAffectedByEditing(true); |
| 920 if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) | 921 if (RuntimeEnabledFeatures::idleTimeSpellCheckingEnabled()) |
| 921 idle_spell_check_callback_->SetNeedsInvocation(); | 922 idle_spell_check_callback_->SetNeedsInvocation(); |
| 922 } | 923 } |
| 923 | 924 |
| 924 void SpellChecker::RemoveSpellingMarkers() { | 925 void SpellChecker::RemoveSpellingMarkers() { |
| 925 GetFrame().GetDocument()->Markers().RemoveMarkers( | 926 GetFrame().GetDocument()->Markers().RemoveMarkersOfTypes( |
| 926 DocumentMarker::MisspellingMarkers()); | 927 DocumentMarker::MisspellingMarkers()); |
| 927 } | 928 } |
| 928 | 929 |
| 929 void SpellChecker::RemoveSpellingMarkersUnderWords( | 930 void SpellChecker::RemoveSpellingMarkersUnderWords( |
| 930 const Vector<String>& words) { | 931 const Vector<String>& words) { |
| 931 DocumentMarkerController& marker_controller = | 932 DocumentMarkerController& marker_controller = |
| 932 GetFrame().GetDocument()->Markers(); | 933 GetFrame().GetDocument()->Markers(); |
| 933 marker_controller.RemoveSpellingMarkersUnderWords(words); | 934 marker_controller.RemoveSpellingMarkersUnderWords(words); |
| 934 marker_controller.RepaintMarkers(); | 935 marker_controller.RepaintMarkers(); |
| 935 } | 936 } |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 if (!input.IsFocusedElementInDocument()) | 1198 if (!input.IsFocusedElementInDocument()) |
| 1198 return false; | 1199 return false; |
| 1199 } | 1200 } |
| 1200 } | 1201 } |
| 1201 HTMLElement* element = | 1202 HTMLElement* element = |
| 1202 Traversal<HTMLElement>::FirstAncestorOrSelf(*position.AnchorNode()); | 1203 Traversal<HTMLElement>::FirstAncestorOrSelf(*position.AnchorNode()); |
| 1203 return element && element->IsSpellCheckingEnabled(); | 1204 return element && element->IsSpellCheckingEnabled(); |
| 1204 } | 1205 } |
| 1205 | 1206 |
| 1206 } // namespace blink | 1207 } // namespace blink |
| OLD | NEW |