Bug 1376417 - part1: IMEInputHandler should notify Cocoa of layout change with [NSTextInputContext invalidateCharacterCoordinates] r=m_kato

I found invalidateCharacterCoordinates in NSTextInputContext. It's available 10.6 and later.

Calling this API does NOT make visible candidate window follow window move nor something to change layout, though. But we should call it.

MozReview-Commit-ID: KbllLDwlMOz

--HG--
extra : rebase_source : 175377bf7dd703dcd304ffbb8648e350080c07fc
This commit is contained in:
Masayuki Nakano 2017-06-29 16:03:57 +09:00
parent 247cf78259
commit 3bf2045197
2 changed files with 18 additions and 0 deletions

View File

@ -813,6 +813,7 @@ public:
virtual void OnFocusChangeInGecko(bool aFocus);
void OnSelectionChange(const IMENotification& aIMENotification);
void OnLayoutChange();
/**
* Call [NSTextInputContext handleEvent] for mouse event support of IME

View File

@ -2772,6 +2772,9 @@ IMEInputHandler::NotifyIME(TextEventDispatcher* aTextEventDispatcher,
case NOTIFY_IME_OF_SELECTION_CHANGE:
OnSelectionChange(aNotification);
return NS_OK;
case NOTIFY_IME_OF_POSITION_CHANGE:
OnLayoutChange();
return NS_OK;
default:
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -4270,6 +4273,20 @@ IMEInputHandler::OnSelectionChange(const IMENotification& aIMENotification)
}
}
void
IMEInputHandler::OnLayoutChange()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
if (!IsFocused()) {
return;
}
NSTextInputContext* inputContext = [mView inputContext];
[inputContext invalidateCharacterCoordinates];
NS_OBJC_END_TRY_ABORT_BLOCK;
}
bool
IMEInputHandler::OnHandleEvent(NSEvent* aEvent)
{