Setting the WebContinuousSpellCheckingEnabled default to 1 should enable continuous spell checking on all text fields and text areas in WebKit without having to change the setting through the contextual menu. The current production Safari 2.0.4 (419.3) on Mac OS X 10.4.7 (8J135/PowerPC) does this for text areas, but not text fields. On a locally-built WebKit r15401, neither text fields nor text areas have continuous spell checking on if this default is set.
Just to note, I do not believe this should be on for text fields by default. But it should be on for text areas by default. The former mimics the rest of Mac OS X.
<rdar://problem/4631821>
Changing title of bug and removed NativeTextField keyword per Comment #1. Production Safari only has continuous spell checking on text areas when WebContinuousSpellCheckingEnabled is set, not text fields.
Created attachment 10520 [details] Proposed Patch Although, it has been mentioned this should be specific to TextAreas only, this patch makes changes globally. Meaning, if you change enable/disable spell checking on a text area, it will also enable/disable it on text fields. However, it does remember its state until it's changed again :) After discussion with Adele, maybe a separate bug can be filed (if it is, in fact, a bug) to make the setting separate from text fields.
To me, having the text field and text area set separately seems more like a bug than a feature. When I first enabled the spell checker in shipping Safari on a text area and then later typed something in a field (e.g. subject line in an email client) I was very surprised the typed text wasn't checked automatically and that I was forced to enable it again. What do you guys think?
For Safari's sake, I think a single setting to control both text fields and textareas would be best. I don't know if other WebKit clients might want to control these separately.
I agree with John and Vladimir - if selected, all editable text fields should be spellchecked and the setting should be persistent (it's frustrating to have to re-enable spellcheck for every field). It seems bizarre to think that someone would want to spellcheck textareas but not text input fields. Then again, since it doesn't do anything more than underline misspelled words without user interaction, it seems bizarre to me that anyone wouldn't want continuous spellcheck enabled all the time.
Comment on attachment 10520 [details] Proposed Patch isContinuousSpellCheckingEnabled is semi hot code, so it would be best to just have a file static BOOL continuousSpellCheckingEnabled. This will be faster than a lookup through NSUserDefaults. Also we usually don't store these toggled settings in a NSUserDefault, the application would normally do this and call setContinuousSpellCheckingEnabled with the default value. We don't have a default for setSmartInsertDeleteEnabled, etc. If we did add a new NSUserDefaults key, it should be added to WebPreferenceKeysPrivate.h.
Created attachment 10792 [details] Patch Revised As discussed on IRC, just minor changes were made to this patch (only read from NSUserDefaults once per session) as shipping Safari does use WebContinuousSpellCheckingEnabled.
Comment on attachment 10792 [details] Patch Revised This looks good. We still should add WebContinuousSpellCheckingEnabled as a define in WebPreferenceKeysPrivate.h.
Created attachment 10801 [details] Patch added a define in WebPreferencesPrivate.h
Comment on attachment 10801 [details] Patch Sorry. I meant WebPreferenceKeysPrivate.h. You will see other keys in there.
Created attachment 10804 [details] Yet another Patch define moved to WebPrefenceKeysPrivate.h
Vladimir, can you please be sure to double-check your patches for tabs in future? Landed in r16823.
Patch for this bug doesn't reproduce the previous behavior. Before, only TextArea's always obeyed the spell checking preference. TextFields did not. And having spell checking active for TextFields is really something situational, since you type actual words in TextFields much less often than TextAreas.
Jon, as you read the previous comments you'll see we were trying to figure out what the default behaviour should be. At the end, I think most people agreed that to have text areas and text fields set separately didn't make much sense and is kind of confusing for the user. Once you set it for text areas and you know it's working there, you go type something in the subject field (for example) and all of the sudden, nothing gets checked. So you either assume you've spelled everything correctly, or that the spell checker is not available/implemented for text fields, both of which may not be true. And regarding typing words in text fields much less than in text areas, I agree you type fewer words in fields than in areas, but they're words, nonetheless.
There might be more cases where a one-line text field might be intended to hold non-words than a multi-line textarea, but we decided that it makes more sense for the setting to apply to both.
*** Bug 9884 has been marked as a duplicate of this bug. ***