diff options
author | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-28 21:18:04 +0000 |
---|---|---|
committer | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-28 21:18:04 +0000 |
commit | 67d43dfe024d8df65b49e068720b6ba07eebc324 (patch) | |
tree | 0ec05242c541026a022e9be896b13c4cbd2ab39b /webkit/glue/editor_client_impl.cc | |
parent | 65d55d8a39fa6d3438b8b14f4b7a5bd961728142 (diff) | |
download | chromium_src-67d43dfe024d8df65b49e068720b6ba07eebc324.zip chromium_src-67d43dfe024d8df65b49e068720b6ba07eebc324.tar.gz chromium_src-67d43dfe024d8df65b49e068720b6ba07eebc324.tar.bz2 |
Fix for spell check underlines disappearing when user clicks out of the Text Box. WebKit removes all spell check markers in Frame::respondToChangedSelection() if, for a text box, the ShouldSpellcheckByDefault() method we have defined in the glue returns false. The problem is, ShouldSpellcheckByDefault() is also called just after the user clicks outside the textbox. As a result, it either detects that the text box is not a focussed node, or determines that the editor is not editable, and returns false, which makes the Frame remove all the markers from the corresponding document object.
BUG=www.crbug.com/6058
TEST=Write random stuff in a text box - after the underlines appear, click outside the text box - the underlines should not disappear. Other functionalities of spellcheck, such as changing spell check language, toggling spell check language on/off, should not be affected at all.
Review URL: http://codereview.chromium.org/159516
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21892 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/editor_client_impl.cc')
-rw-r--r-- | webkit/glue/editor_client_impl.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc index bd88c92..6fe6a73 100644 --- a/webkit/glue/editor_client_impl.cc +++ b/webkit/glue/editor_client_impl.cc @@ -130,13 +130,19 @@ bool EditorClientImpl::ShouldSpellcheckByDefault() { if (!document) return false; const WebCore::Node* node = document->focusedNode(); + // If |node| is NULL, we default to allowing spellchecking. This is done in + // order to mitigate the issue when the user clicks outside the textbox, as a + // result of which |node| becomes NULL, resulting in all the spell check + // markers being deleted. Also, the Frame will decide not to do spellchecking + // if the user can't edit - so returning true here will not cause any problems + // to the Frame's behavior. if (!node) - return false; + return true; const WebCore::RenderObject* renderer = node->renderer(); if (!renderer) return false; - return (!renderer->isTextField() && editor->canEdit()); + return !renderer->isTextField(); } bool EditorClientImpl::isContinuousSpellCheckingEnabled() { |