Bug 1337718 part.4 Make EditorEventListener::KeyUp() take const WidgetKeyboardEvent* instead of nsIDOMKeyEvent* r=m_kato

MozReview-Commit-ID: K9zCJsYgfbL

--HG--
extra : rebase_source : 77941f0fe5be600a61576706968f25ff13d218c7
This commit is contained in:
Masayuki Nakano 2017-02-08 20:22:57 +09:00
Родитель 2f6ff9d325
Коммит c58f95a48b
2 изменённых файлов: 7 добавлений и 11 удалений

Просмотреть файл

@ -400,10 +400,8 @@ EditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
return KeyDown(keyEvent);
}
// keyup
case eKeyUp: {
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aEvent);
return KeyUp(keyEvent);
}
case eKeyUp:
return KeyUp(internalEvent->AsKeyboardEvent());
#endif // #ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
// keypress
case eKeyPress:
@ -543,9 +541,9 @@ bool IsCtrlShiftPressed(nsIDOMKeyEvent* aEvent, bool& isRTL)
// RenderWidgetHostViewWin::OnKeyEvent.
nsresult
EditorEventListener::KeyUp(nsIDOMKeyEvent* aKeyEvent)
EditorEventListener::KeyUp(const WidgetKeyboardEvent* aKeyboardEvent)
{
if (NS_WARN_IF(!aKeyEvent) || DetachedFromEditor()) {
if (NS_WARN_IF(!aKeyboardEvent) || DetachedFromEditor()) {
return NS_OK;
}
@ -555,10 +553,8 @@ EditorEventListener::KeyUp(nsIDOMKeyEvent* aKeyEvent)
// XXX Why doesn't this method check if it's consumed?
RefPtr<EditorBase> editorBase(mEditorBase);
uint32_t keyCode = 0;
aKeyEvent->GetKeyCode(&keyCode);
if ((keyCode == nsIDOMKeyEvent::DOM_VK_SHIFT ||
keyCode == nsIDOMKeyEvent::DOM_VK_CONTROL) &&
if ((aKeyboardEvent->mKeyCode == NS_VK_SHIFT ||
aKeyboardEvent->mKeyCode == NS_VK_CONTROL) &&
mShouldSwitchTextDirection && editorBase->IsPlaintextEditor()) {
editorBase->SwitchTextDirectionTo(mSwitchToRTL ?
nsIPlaintextEditor::eEditorRightToLeft :

Просмотреть файл

@ -58,7 +58,7 @@ protected:
#ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
nsresult KeyDown(nsIDOMKeyEvent* aKeyEvent);
nsresult KeyUp(nsIDOMKeyEvent* aKeyEvent);
nsresult KeyUp(const WidgetKeyboardEvent* aKeyboardEvent);
#endif
nsresult KeyPress(WidgetKeyboardEvent* aKeyboardEvent);
nsresult HandleChangeComposition(WidgetCompositionEvent* aCompositionEvent);