Bug 558976 part.3 Implement nsIWidget::NotifyIME() on Cocoa r=smichaud

This commit is contained in:
Masayuki Nakano 2013-03-06 15:14:34 +09:00
parent f0a51c925c
commit 1583cc4d22
4 changed files with 23 additions and 31 deletions

View File

@ -444,14 +444,12 @@ public:
NS_IMETHOD ActivateNativeMenuItemAt(const nsAString& indexString);
NS_IMETHOD ForceUpdateNativeMenuAt(const nsAString& indexString);
NS_IMETHOD ResetInputState();
NS_IMETHOD NotifyIME(NotificationToIME aNotification) MOZ_OVERRIDE;
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
const InputContextAction& aAction);
NS_IMETHOD_(InputContext) GetInputContext();
NS_IMETHOD CancelIMEComposition();
NS_IMETHOD GetToggledKeyState(uint32_t aKeyCode,
bool* aLEDState);
NS_IMETHOD OnIMEFocusChange(bool aFocus);
// nsIPluginWidget
// outClipRect and outOrigin are in display pixels (not device pixels)

View File

@ -1664,14 +1664,29 @@ bool nsChildView::HasPendingInputEvent()
#pragma mark -
// Force Input Method Editor to commit the uncommitted input
// Note that this and other IME methods don't necessarily
// get called on the same ChildView that input is going through.
NS_IMETHODIMP nsChildView::ResetInputState()
NS_IMETHODIMP
nsChildView::NotifyIME(NotificationToIME aNotification)
{
NS_ENSURE_TRUE(mTextInputHandler, NS_ERROR_NOT_AVAILABLE);
mTextInputHandler->CommitIMEComposition();
return NS_OK;
switch (aNotification) {
case REQUEST_TO_COMMIT_COMPOSITION:
NS_ENSURE_TRUE(mTextInputHandler, NS_ERROR_NOT_AVAILABLE);
mTextInputHandler->CommitIMEComposition();
return NS_OK;
case REQUEST_TO_CANCEL_COMPOSITION:
NS_ENSURE_TRUE(mTextInputHandler, NS_ERROR_NOT_AVAILABLE);
mTextInputHandler->CancelIMEComposition();
return NS_OK;
case NOTIFY_IME_OF_FOCUS:
NS_ENSURE_TRUE(mTextInputHandler, NS_ERROR_NOT_AVAILABLE);
mTextInputHandler->OnFocusChangeInGecko(true);
return NS_OK;
case NOTIFY_IME_OF_BLUR:
NS_ENSURE_TRUE(mTextInputHandler, NS_ERROR_NOT_AVAILABLE);
mTextInputHandler->OnFocusChangeInGecko(false);
return NS_OK;
default:
return NS_ERROR_NOT_IMPLEMENTED;
}
}
NS_IMETHODIMP_(void)
@ -1729,14 +1744,6 @@ nsChildView::GetInputContext()
return mInputContext;
}
// Destruct and don't commit the IME composition string.
NS_IMETHODIMP nsChildView::CancelIMEComposition()
{
NS_ENSURE_TRUE(mTextInputHandler, NS_ERROR_NOT_AVAILABLE);
mTextInputHandler->CancelIMEComposition();
return NS_OK;
}
NS_IMETHODIMP nsChildView::GetToggledKeyState(uint32_t aKeyCode,
bool* aLEDState)
{
@ -1762,13 +1769,6 @@ NS_IMETHODIMP nsChildView::GetToggledKeyState(uint32_t aKeyCode,
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
NS_IMETHODIMP nsChildView::OnIMEFocusChange(bool aFocus)
{
NS_ENSURE_TRUE(mTextInputHandler, NS_ERROR_NOT_AVAILABLE);
mTextInputHandler->OnFocusChangeInGecko(aFocus);
return NS_OK;
}
NSView<mozView>* nsChildView::GetEditorView()
{
NSView<mozView>* editorView = mView;

View File

@ -286,7 +286,6 @@ public:
void SetMenuBar(nsMenuBarX* aMenuBar);
nsMenuBarX *GetMenuBar();
NS_IMETHOD ResetInputState();
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
const InputContextAction& aAction)
{

View File

@ -1651,11 +1651,6 @@ NS_IMETHODIMP nsCocoaWindow::GetSheetWindowParent(NSWindow** sheetWindowParent)
return NS_OK;
}
NS_IMETHODIMP nsCocoaWindow::ResetInputState()
{
return NS_OK;
}
// Invokes callback and ProcessEvent methods on Event Listener object
NS_IMETHODIMP
nsCocoaWindow::DispatchEvent(nsGUIEvent* event, nsEventStatus& aStatus)