Bug 3535

Summary: Spelling suggestions in the context menu don't call the should* delegate methods
Product: WebKit Reporter: Duncan Wilcox <duncan>
Component: HTML EditingAssignee: Dave Hyatt <hyatt>
Severity: Normal    
Priority: P2    
Version: 412   
Hardware: Mac   
OS: OS X 10.4   
Description Flags
Fixes the problem
Patch and ChangeLog entry darin: review+

Description Duncan Wilcox 2005-06-14 14:47:56 PDT
Type some miss-spelled text, control click, select a correct spelling from the context menu, the delegate:

- (BOOL)webView:(WebView *)webView shouldInsertText:(NSString *)text replacingDOMRange:(DOMRange 
*)range givenAction:(WebViewInsertAction)action

isn't called, instead the:

- (void)webViewDidChange:(NSNotification *)notification

is called right away.
Comment 1 Duncan Wilcox 2005-06-14 15:03:13 PDT
Created attachment 2339 [details]
Fixes the problem
Comment 2 Joost de Valk (AlthA) 2005-06-14 23:31:25 PDT
I'd like to know if this is a real problem? Could you attach a testcase?
Comment 3 Duncan Wilcox 2005-06-15 03:18:09 PDT
Created attachment 2355 [details]

I suppose that it doesn't make any difference at all if you are using the
default editing delegate, however it certainly is a violation of the editing
delegate protocol.

The editing delegate is allowed to return a NO/FALSE to
webView:shouldInsertText:replacingDOMRange:givenAction:, for example try
building the attached testcase (create an empty project in xcode and replace
main.m with this code) and typing "three".

The editing delegate replaces all "e"s with "i"s, so you will see "thrii". The
contextual menu will propose "three", and when you select it you will
incorrectly get "three", because the webkit isn't going through the delegate
correctly. With the patch applied you will get "thrii" instead, which is weird
but is correct :)
Comment 4 Darin Adler 2005-06-23 14:26:38 PDT
Yes, this is a real editing bug. We have lots of cases where we're not calling the editing delegates, and we 
should be doing that consistently in all cases.
Comment 5 Darin Adler 2005-06-23 14:29:58 PDT
It's hard to make test cases for these things -- we'd need to enhance DumpRenderTree to dump when the 
editing delegate is called at the very least.
Comment 6 Duncan Wilcox 2005-06-24 04:02:25 PDT
Created attachment 2626 [details]
Patch and ChangeLog entry
Comment 7 Darin Adler 2005-06-24 08:36:06 PDT
Comment on attachment 2626 [details]
Patch and ChangeLog entry

Comment 8 Joost de Valk (AlthA) 2005-07-03 08:07:55 PDT
Reporter, please mark this bug as verified if it has been fixed for you.