diff options
author | jparent@chromium.org <jparent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-18 00:37:25 +0000 |
---|---|---|
committer | jparent@chromium.org <jparent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-18 00:37:25 +0000 |
commit | 832e469e8a6ef16f172103f30b25d9748c21a6e1 (patch) | |
tree | 54578015582929955f3f115c1aad6307bf4970f5 /webkit | |
parent | 200e80dc6a93fa165551590e9cb1ba589ec0958e (diff) | |
download | chromium_src-832e469e8a6ef16f172103f30b25d9748c21a6e1.zip chromium_src-832e469e8a6ef16f172103f30b25d9748c21a6e1.tar.gz chromium_src-832e469e8a6ef16f172103f30b25d9748c21a6e1.tar.bz2 |
Spellcheck should not only work if the element is contentEditable, it should also work if the document is in designMode. WebKit has an helper function to check if something is editable in any way (and properly excludes things like read only text areas), so use that here instead of our home grown check. Note that this code defaults text inputs to not be spell checkable, which is preserving the current behavior.
BUG=14870
TEST=Will commit a WebKit LayoutTest for this after I check this in.
Review URL: http://codereview.chromium.org/155611
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21034 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/editor_client_impl.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc index 5094545..bd88c92 100644 --- a/webkit/glue/editor_client_impl.cc +++ b/webkit/glue/editor_client_impl.cc @@ -118,6 +118,8 @@ bool EditorClientImpl::isSelectTrailingWhitespaceEnabled() { } bool EditorClientImpl::ShouldSpellcheckByDefault() { + // Spellcheck should be enabled for all editable areas (such as textareas, + // contentEditable regions, and designMode docs), except text inputs. const WebCore::Frame* frame = web_view_->GetFocusedWebCoreFrame(); if (!frame) return false; @@ -133,12 +135,8 @@ bool EditorClientImpl::ShouldSpellcheckByDefault() { const WebCore::RenderObject* renderer = node->renderer(); if (!renderer) return false; - // We should also retrieve the contenteditable attribute of this element to - // determine if this element needs spell-checking. - const WebCore::EUserModify user_modify = renderer->style()->userModify(); - return (renderer->isTextArea() && editor->canEdit()) || - user_modify == WebCore::READ_WRITE || - user_modify == WebCore::READ_WRITE_PLAINTEXT_ONLY; + + return (!renderer->isTextField() && editor->canEdit()); } bool EditorClientImpl::isContinuousSpellCheckingEnabled() { |