Bug 3535 - Spelling suggestions in the context menu don't call the should* delegate methods
Summary: Spelling suggestions in the context menu don't call the should* delegate methods
Status: VERIFIED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 412
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Dave Hyatt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-14 14:47 PDT by Duncan Wilcox
Modified: 2005-07-03 15:47 PDT (History)
0 users

See Also:


Attachments
Fixes the problem (905 bytes, patch)
2005-06-14 15:03 PDT, Duncan Wilcox
no flags Details | Formatted Diff | Diff
testcase (1.43 KB, application/octet-stream)
2005-06-15 03:18 PDT, Duncan Wilcox
no flags Details
Patch and ChangeLog entry (1.77 KB, patch)
2005-06-24 04:02 PDT, Duncan Wilcox
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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]
testcase

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

r=me
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.