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

Side by Side Diff: Source/web/EditorClientImpl.cpp

Issue 21694005: Spell check whole content of an editable element when it gets focused. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: style & spurious comment removal. Created 7 years, 4 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
« no previous file with comments | « Source/core/html/HTMLTextAreaElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/core/html/HTMLTextAreaElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698