Bug 4699 - _updateSelectionForInputManager MUST ensure that input methods receive kCMFixTextService even if no marked text
Summary: _updateSelectionForInputManager MUST ensure that input methods receive kCMFix...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Dave Hyatt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-27 16:27 PDT by Evan Gross
Modified: 2005-09-25 20:49 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Evan Gross 2005-08-27 16:27:09 PDT
Input methods that do not maintain an active inline input area still need to know when the selection has 
changed. Generally this is determined by such an input method when it receives the kCMFixTextService 
component call. This call is made to TSM via -[NSInputManager markedTextAbandoned:].

Right now, _updateSelectionForInputManager test whether there is marked text, and returns 
immediately if that's the case:

- (void)_updateSelectionForInputManager
{
    if (![self hasMarkedText] || _private->ignoreMarkedTextSelectionChange)
	return;

...

This is incorrect. The above needs to be changed to eliminate the hasMarkedText test, and continue on 
to do the "right thing" depending on whether the selection is inside the marked text or not.

So the above needs to be changed to:

- (void)_updateSelectionForInputManager
{
    if (_private->ignoreMarkedTextSelectionChange)
	return;

and then the "right thing" will be done for the case when an input method doesn't maintain an active 
inline input area.
Comment 1 Alexey Proskuryakov 2005-09-04 09:08:17 PDT
Evan, could you please point to some documentation specifying this behavior? The documentation at 
<http://developer.apple.com/documentation/Carbon/Reference/Text_Services_Manager/tsm_refchap/
chapter_1.2_section_6.html> doesn't suggest such usage...

My own input method works with inline input, so I haven't researched this myself a lot.
Comment 2 Evan Gross 2005-09-04 18:03:38 PDT
(In reply to comment #1)
> Evan, could you please point to some documentation specifying this behavior? The documentation at 
> <http://developer.apple.com/documentation/Carbon/Reference/Text_Services_Manager/
tsm_refchap/
> chapter_1.2_section_6.html> doesn't suggest such usage...
> 
> My own input method works with inline input, so I haven't researched this myself a lot.

There's no actual documentation for this, probably because until my input method came along, there 
wasn't one that didn't maintain an inline input area AND needed to know when the selection in the 
document changed.

The better solution might be to make sure that mouse events in WebView get passed along to the active 
input method. This is what happens in NSTextView. Problem is, I have no idea how this is or should 
actually be done. I think it may be happening (in NSTextView's case) somewhere other than the 
NSTextInput protocol methods or even mouseDown. Probably at some lower level mortals can't "get at". 
So the solution I propose here is one that's both do-able, works, and really shouldn't have any side-
effects on input methods that do inline input as well (a call to fix should just be ignored by such an 
input method when there's no inline input happening, anyway).
Comment 3 Alexey Proskuryakov 2005-09-07 10:55:29 PDT
I agree, making it pass mouse events to input methods sounds like a much better solution. Here is how 
it happens in NSTextView:

#6  0x933adbd0 in TSMEventToTextService ()
#7  0x933adb44 in TSMEventToInputMethod ()
#8  0x933b4294 in TSMProcessMouseEvent ()
#9  0x9399a790 in -[NSTSMInputContext handleMouseEvent:] ()
#10 0x93758eb4 in -[NSTextView mouseDown:] ()
#11 0x9368d9c8 in -[NSWindow sendEvent:] ()
#12 0x93636bfc in -[NSApplication sendEvent:] ()
#13 0x9362e090 in -[NSApplication run] ()
#14 0x9371e8bc in NSApplicationMain ()
Comment 4 Evan Gross 2005-09-07 18:40:52 PDT
(In reply to comment #3)
> I agree, making it pass mouse events to input methods sounds like a much better solution. Here is 
how 
> it happens in NSTextView:
> 
> #6  0x933adbd0 in TSMEventToTextService ()
> #7  0x933adb44 in TSMEventToInputMethod ()
> #8  0x933b4294 in TSMProcessMouseEvent ()
> #9  0x9399a790 in -[NSTSMInputContext handleMouseEvent:] ()
> #10 0x93758eb4 in -[NSTextView mouseDown:] ()
> #11 0x9368d9c8 in -[NSWindow sendEvent:] ()
> #12 0x93636bfc in -[NSApplication sendEvent:] ()
> #13 0x9362e090 in -[NSApplication run] ()
> #14 0x9371e8bc in NSApplicationMain ()
> 

Sure, that's how it's done in NSTextView, but I see no way to do the same for WebView (well, unless you 
work at Apple). NSTSMInputContext isn't public (as you well know), and I have no idea if it's ok to call -
[NSTSMInputContext handleMouseEvent:] from within -[WebHTMLView mouseDown:].

So yes, -[WebHTMLView mouseDown:] is obviously not finished (there's that TEXTINPUT comment, but 
no corresponding code!), and needs to be, but how?

If you have any ideas, fire away...
Comment 5 Alexey Proskuryakov 2005-09-07 21:56:44 PDT
Please see my comment in bug 4394.

My understanding is that if we get that bug fixed, this one becomes INVALID, right?
Comment 6 Evan Gross 2005-09-07 22:07:04 PDT
(In reply to comment #5)

Theoretically, YES, fixing 4394 should take care of this issue (as well as others).

So now to figure out how to implement -[WebHTMLView(WebNSTextInputSupport) 
characterIndexForPoint:]. I really think it needs to be done, as it's probably needed elsewhere as well 
(PosToOffset??).
Comment 7 Evan Gross 2005-09-25 20:49:04 PDT
Seems a non-issue now that #4394 is fixed. At least not for my input method. I think we can pretty safely 
mark it as invalid.