Bug 1262363 - Call [NSTextInputContext handleEvent] for mouse support on IME. r=masayuki

Some IME handles mouse event by handleEvent method of NSTextInputcontext.  So we should call it on mouse event for IME

MozReview-Commit-ID: 6lyXCpOJ3yr

--HG--
extra : rebase_source : a180e0750a2f40838cf24d2985638f96899cf2d4
extra : histedit_source : 84ea9a9b113b33d8dc982b855e2271931c1084f9
This commit is contained in:
Makoto Kato 2016-04-27 21:14:43 +09:00
parent 74cc8abae0
commit fe5bf359ac
3 changed files with 45 additions and 0 deletions

View File

@ -755,6 +755,11 @@ public:
void OnSelectionChange(const IMENotification& aIMENotification);
/**
* Call [NSTextInputContext handleEvent] for mouse event support of IME
*/
bool OnHandleEvent(NSEvent* aEvent);
/**
* SetMarkedText() is a handler of setMarkedText of NSTextInput.
*

View File

@ -3967,6 +3967,16 @@ IMEInputHandler::OnSelectionChange(const IMENotification& aIMENotification)
}
}
bool
IMEInputHandler::OnHandleEvent(NSEvent* aEvent)
{
if (!IsFocused()) {
return false;
}
NSTextInputContext* inputContext = [mView inputContext];
return [inputContext handleEvent:aEvent];
}
#pragma mark -

View File

@ -4512,6 +4512,9 @@ NSEvent* gLastDragMouseDownEvent = nil;
// in order to send gecko events we'll need a gecko widget
if (!mGeckoChild)
return;
if (mTextInputHandler->OnHandleEvent(theEvent)) {
return;
}
NSUInteger modifierFlags = [theEvent modifierFlags];
@ -4546,6 +4549,9 @@ NSEvent* gLastDragMouseDownEvent = nil;
if (!mGeckoChild || mBlockedLastMouseDown)
return;
if (mTextInputHandler->OnHandleEvent(theEvent)) {
return;
}
nsAutoRetainCocoaObject kungFuDeathGrip(self);
@ -4675,6 +4681,9 @@ NewCGSRegionFromRegion(const LayoutDeviceIntRegion& aRegion,
if (!mGeckoChild)
return;
if (mTextInputHandler->OnHandleEvent(theEvent)) {
return;
}
WidgetMouseEvent geckoEvent(true, eMouseMove, mGeckoChild,
WidgetMouseEvent::eReal);
@ -4691,6 +4700,9 @@ NewCGSRegionFromRegion(const LayoutDeviceIntRegion& aRegion,
if (!mGeckoChild)
return;
if (mTextInputHandler->OnHandleEvent(theEvent)) {
return;
}
gLastDragView = self;
@ -4718,6 +4730,9 @@ NewCGSRegionFromRegion(const LayoutDeviceIntRegion& aRegion,
[self maybeRollup:theEvent];
if (!mGeckoChild)
return;
if (mTextInputHandler->OnHandleEvent(theEvent)) {
return;
}
// The right mouse went down, fire off a right mouse down event to gecko
WidgetMouseEvent geckoEvent(true, eMouseDown, mGeckoChild,
@ -4742,6 +4757,9 @@ NewCGSRegionFromRegion(const LayoutDeviceIntRegion& aRegion,
if (!mGeckoChild)
return;
if (mTextInputHandler->OnHandleEvent(theEvent)) {
return;
}
WidgetMouseEvent geckoEvent(true, eMouseUp, mGeckoChild,
WidgetMouseEvent::eReal);
@ -4759,6 +4777,9 @@ NewCGSRegionFromRegion(const LayoutDeviceIntRegion& aRegion,
{
if (!mGeckoChild)
return;
if (mTextInputHandler->OnHandleEvent(theEvent)) {
return;
}
WidgetMouseEvent geckoEvent(true, eMouseMove, mGeckoChild,
WidgetMouseEvent::eReal);
@ -4782,6 +4803,9 @@ NewCGSRegionFromRegion(const LayoutDeviceIntRegion& aRegion,
if (!mGeckoChild)
return;
if (mTextInputHandler->OnHandleEvent(theEvent)) {
return;
}
WidgetMouseEvent geckoEvent(true, eMouseDown, mGeckoChild,
WidgetMouseEvent::eReal);
@ -4798,6 +4822,9 @@ NewCGSRegionFromRegion(const LayoutDeviceIntRegion& aRegion,
{
if (!mGeckoChild)
return;
if (mTextInputHandler->OnHandleEvent(theEvent)) {
return;
}
WidgetMouseEvent geckoEvent(true, eMouseUp, mGeckoChild,
WidgetMouseEvent::eReal);
@ -4812,6 +4839,9 @@ NewCGSRegionFromRegion(const LayoutDeviceIntRegion& aRegion,
{
if (!mGeckoChild)
return;
if (mTextInputHandler->OnHandleEvent(theEvent)) {
return;
}
WidgetMouseEvent geckoEvent(true, eMouseMove, mGeckoChild,
WidgetMouseEvent::eReal);