OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple, Inc. All rights reserved. |
3 * Copyright (C) 2012 Google, Inc. All rights reserved. | 3 * Copyright (C) 2012 Google, Inc. All rights reserved. |
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 if (isContinuousSpellCheckingEnabled()) { | 144 if (isContinuousSpellCheckingEnabled()) { |
145 m_spellCheckThisFieldStatus = SpellCheckForcedOff; | 145 m_spellCheckThisFieldStatus = SpellCheckForcedOff; |
146 if (Page* page = m_webView->page()) { | 146 if (Page* page = m_webView->page()) { |
147 for (Frame* frame = page->mainFrame(); frame && frame->document(); f
rame = frame->tree()->traverseNext()) { | 147 for (Frame* frame = page->mainFrame(); frame && frame->document(); f
rame = frame->tree()->traverseNext()) { |
148 frame->document()->markers()->removeMarkers(DocumentMarker::Spel
ling | DocumentMarker::Grammar); | 148 frame->document()->markers()->removeMarkers(DocumentMarker::Spel
ling | DocumentMarker::Grammar); |
149 } | 149 } |
150 } | 150 } |
151 } else { | 151 } else { |
152 m_spellCheckThisFieldStatus = SpellCheckForcedOn; | 152 m_spellCheckThisFieldStatus = SpellCheckForcedOn; |
153 if (Frame* frame = m_webView->focusedWebCoreFrame()) { | 153 if (Frame* frame = m_webView->focusedWebCoreFrame()) { |
154 if (unifiedTextCheckerEnabled(frame)) { | 154 VisibleSelection frameSelection = frame->selection()->selection(); |
155 VisibleSelection frameSelection = frame->selection()->selection(
); | 155 // If a selection is in an editable element spell check its content. |
156 // If a selection is in an editable element spell check its cont
ent. | 156 if (Element* rootEditableElement = frameSelection.rootEditableElemen
t()) { |
157 if (Element* rootEditableElement = frameSelection.rootEditableEl
ement()) { | 157 frame->editor()->elementDidBeginEditing(rootEditableElement); |
158 VisibleSelection selection = VisibleSelection::selectionFrom
ContentsOfNode(rootEditableElement); | |
159 frame->editor()->markMisspellingsAndBadGrammar(selection); | |
160 } | |
161 } | 158 } |
162 } | 159 } |
163 } | 160 } |
164 } | 161 } |
165 | 162 |
166 bool EditorClientImpl::isGrammarCheckingEnabled() | 163 bool EditorClientImpl::isGrammarCheckingEnabled() |
167 { | 164 { |
168 const Frame* frame = m_webView->focusedWebCoreFrame(); | 165 const Frame* frame = m_webView->focusedWebCoreFrame(); |
169 return frame && frame->settings() && (frame->settings()->asynchronousSpellCh
eckingEnabled() || frame->settings()->unifiedTextCheckerEnabled()); | 166 return frame && frame->settings() && (frame->settings()->asynchronousSpellCh
eckingEnabled() || frame->settings()->unifiedTextCheckerEnabled()); |
170 } | 167 } |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 #endif | 778 #endif |
782 } | 779 } |
783 | 780 |
784 void EditorClientImpl::willSetInputMethodState() | 781 void EditorClientImpl::willSetInputMethodState() |
785 { | 782 { |
786 if (m_webView->client()) | 783 if (m_webView->client()) |
787 m_webView->client()->resetInputMethod(); | 784 m_webView->client()->resetInputMethod(); |
788 } | 785 } |
789 | 786 |
790 } // namesace WebKit | 787 } // namesace WebKit |
OLD | NEW |