Bug 1436508 part 12. Remove nsIDOMKeyEvent. r=masayuki

MozReview-Commit-ID: 8giqG5iHiIf
This commit is contained in:
Boris Zbarsky 2018-02-09 11:17:10 -05:00
Родитель 92bbd744e1
Коммит 034e47c66b
19 изменённых файлов: 76 добавлений и 63 удалений

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

@ -11,6 +11,7 @@
#include "mozilla/TextEvents.h"
#include "mozilla/TextInputProcessor.h"
#include "mozilla/widget/IMEData.h"
#include "mozilla/dom/KeyboardEvent.h"
#include "nsContentUtils.h"
#include "nsIDocShell.h"
#include "nsIWidget.h"
@ -568,7 +569,7 @@ TextInputProcessor::MaybeDispatchKeyupForComposition(
nsresult
TextInputProcessor::PrepareKeyboardEventForComposition(
nsIDOMKeyEvent* aDOMKeyEvent,
KeyboardEvent* aDOMKeyEvent,
uint32_t& aKeyFlags,
uint8_t aOptionalArgc,
WidgetKeyboardEvent*& aKeyboardEvent)
@ -577,7 +578,7 @@ TextInputProcessor::PrepareKeyboardEventForComposition(
aKeyboardEvent =
aOptionalArgc && aDOMKeyEvent ?
aDOMKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent() : nullptr;
aDOMKeyEvent->WidgetEventPtr()->AsKeyboardEvent() : nullptr;
if (!aKeyboardEvent || aOptionalArgc < 2) {
aKeyFlags = 0;
}
@ -594,7 +595,7 @@ TextInputProcessor::PrepareKeyboardEventForComposition(
}
NS_IMETHODIMP
TextInputProcessor::StartComposition(nsIDOMKeyEvent* aDOMKeyEvent,
TextInputProcessor::StartComposition(nsIDOMEvent* aDOMKeyEvent,
uint32_t aKeyFlags,
uint8_t aOptionalArgc,
bool* aSucceeded)
@ -603,11 +604,19 @@ TextInputProcessor::StartComposition(nsIDOMKeyEvent* aDOMKeyEvent,
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
*aSucceeded = false;
RefPtr<KeyboardEvent> keyEvent;
if (aDOMKeyEvent) {
keyEvent = aDOMKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
if (NS_WARN_IF(!keyEvent)) {
return NS_ERROR_INVALID_ARG;
}
}
RefPtr<TextEventDispatcher> kungFuDeathGrip(mDispatcher);
WidgetKeyboardEvent* keyboardEvent;
nsresult rv =
PrepareKeyboardEventForComposition(aDOMKeyEvent, aKeyFlags, aOptionalArgc,
PrepareKeyboardEventForComposition(keyEvent, aKeyFlags, aOptionalArgc,
keyboardEvent);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -684,7 +693,7 @@ TextInputProcessor::SetCaretInPendingComposition(uint32_t aOffset)
}
NS_IMETHODIMP
TextInputProcessor::FlushPendingComposition(nsIDOMKeyEvent* aDOMKeyEvent,
TextInputProcessor::FlushPendingComposition(nsIDOMEvent* aDOMKeyEvent,
uint32_t aKeyFlags,
uint8_t aOptionalArgc,
bool* aSucceeded)
@ -700,9 +709,17 @@ TextInputProcessor::FlushPendingComposition(nsIDOMKeyEvent* aDOMKeyEvent,
RefPtr<TextEventDispatcher> kungFuDeathGrip(mDispatcher);
bool wasComposing = IsComposing();
RefPtr<KeyboardEvent> keyEvent;
if (aDOMKeyEvent) {
keyEvent = aDOMKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
if (NS_WARN_IF(!keyEvent)) {
return NS_ERROR_INVALID_ARG;
}
}
WidgetKeyboardEvent* keyboardEvent;
nsresult rv =
PrepareKeyboardEventForComposition(aDOMKeyEvent, aKeyFlags, aOptionalArgc,
PrepareKeyboardEventForComposition(keyEvent, aKeyFlags, aOptionalArgc,
keyboardEvent);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -736,15 +753,23 @@ TextInputProcessor::FlushPendingComposition(nsIDOMKeyEvent* aDOMKeyEvent,
}
NS_IMETHODIMP
TextInputProcessor::CommitComposition(nsIDOMKeyEvent* aDOMKeyEvent,
TextInputProcessor::CommitComposition(nsIDOMEvent* aDOMKeyEvent,
uint32_t aKeyFlags,
uint8_t aOptionalArgc)
{
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
RefPtr<KeyboardEvent> keyEvent;
if (aDOMKeyEvent) {
keyEvent = aDOMKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
if (NS_WARN_IF(!keyEvent)) {
return NS_ERROR_INVALID_ARG;
}
}
WidgetKeyboardEvent* keyboardEvent;
nsresult rv =
PrepareKeyboardEventForComposition(aDOMKeyEvent, aKeyFlags, aOptionalArgc,
PrepareKeyboardEventForComposition(keyEvent, aKeyFlags, aOptionalArgc,
keyboardEvent);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -755,7 +780,7 @@ TextInputProcessor::CommitComposition(nsIDOMKeyEvent* aDOMKeyEvent,
NS_IMETHODIMP
TextInputProcessor::CommitCompositionWith(const nsAString& aCommitString,
nsIDOMKeyEvent* aDOMKeyEvent,
nsIDOMEvent* aDOMKeyEvent,
uint32_t aKeyFlags,
uint8_t aOptionalArgc,
bool* aSucceeded)
@ -763,9 +788,17 @@ TextInputProcessor::CommitCompositionWith(const nsAString& aCommitString,
MOZ_RELEASE_ASSERT(aSucceeded, "aSucceeded must not be nullptr");
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
RefPtr<KeyboardEvent> keyEvent;
if (aDOMKeyEvent) {
keyEvent = aDOMKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
if (NS_WARN_IF(!keyEvent)) {
return NS_ERROR_INVALID_ARG;
}
}
WidgetKeyboardEvent* keyboardEvent;
nsresult rv =
PrepareKeyboardEventForComposition(aDOMKeyEvent, aKeyFlags, aOptionalArgc,
PrepareKeyboardEventForComposition(keyEvent, aKeyFlags, aOptionalArgc,
keyboardEvent);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -819,15 +852,23 @@ TextInputProcessor::CommitCompositionInternal(
}
NS_IMETHODIMP
TextInputProcessor::CancelComposition(nsIDOMKeyEvent* aDOMKeyEvent,
TextInputProcessor::CancelComposition(nsIDOMEvent* aDOMKeyEvent,
uint32_t aKeyFlags,
uint8_t aOptionalArgc)
{
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
RefPtr<KeyboardEvent> keyEvent;
if (aDOMKeyEvent) {
keyEvent = aDOMKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
if (NS_WARN_IF(!keyEvent)) {
return NS_ERROR_INVALID_ARG;
}
}
WidgetKeyboardEvent* keyboardEvent;
nsresult rv =
PrepareKeyboardEventForComposition(aDOMKeyEvent, aKeyFlags, aOptionalArgc,
PrepareKeyboardEventForComposition(keyEvent, aKeyFlags, aOptionalArgc,
keyboardEvent);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -1027,7 +1068,7 @@ TextInputProcessor::PrepareKeyboardEventToDispatch(
}
NS_IMETHODIMP
TextInputProcessor::Keydown(nsIDOMKeyEvent* aDOMKeyEvent,
TextInputProcessor::Keydown(nsIDOMEvent* aDOMKeyEvent,
uint32_t aKeyFlags,
uint8_t aOptionalArgc,
uint32_t* aConsumedFlags)
@ -1041,7 +1082,7 @@ TextInputProcessor::Keydown(nsIDOMKeyEvent* aDOMKeyEvent,
return NS_ERROR_INVALID_ARG;
}
WidgetKeyboardEvent* originalKeyEvent =
aDOMKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent();
aDOMKeyEvent->InternalDOMEvent()->WidgetEventPtr()->AsKeyboardEvent();
if (NS_WARN_IF(!originalKeyEvent)) {
return NS_ERROR_INVALID_ARG;
}
@ -1114,7 +1155,7 @@ TextInputProcessor::KeydownInternal(const WidgetKeyboardEvent& aKeyboardEvent,
}
NS_IMETHODIMP
TextInputProcessor::Keyup(nsIDOMKeyEvent* aDOMKeyEvent,
TextInputProcessor::Keyup(nsIDOMEvent* aDOMKeyEvent,
uint32_t aKeyFlags,
uint8_t aOptionalArgc,
bool* aDoDefault)
@ -1128,7 +1169,7 @@ TextInputProcessor::Keyup(nsIDOMKeyEvent* aDOMKeyEvent,
return NS_ERROR_INVALID_ARG;
}
WidgetKeyboardEvent* originalKeyEvent =
aDOMKeyEvent->AsEvent()->WidgetEventPtr()->AsKeyboardEvent();
aDOMKeyEvent->InternalDOMEvent()->WidgetEventPtr()->AsKeyboardEvent();
if (NS_WARN_IF(!originalKeyEvent)) {
return NS_ERROR_INVALID_ARG;
}

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

@ -17,6 +17,10 @@
namespace mozilla {
namespace dom {
class KeyboardEvent;
} // namespace dom
class TextInputProcessor final : public nsITextInputProcessor
, public widget::TextEventDispatcherListener
{
@ -77,7 +81,7 @@ private:
bool IsValidEventTypeForComposition(
const WidgetKeyboardEvent& aKeyboardEvent) const;
nsresult PrepareKeyboardEventForComposition(
nsIDOMKeyEvent* aDOMKeyEvent,
dom::KeyboardEvent* aDOMKeyEvent,
uint32_t& aKeyFlags,
uint8_t aOptionalArgc,
WidgetKeyboardEvent*& aKeyboardEvent);

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

@ -74,7 +74,6 @@ class nsIDOMDocument;
class nsIDOMDocumentFragment;
class nsIDOMEvent;
class nsIDOMHTMLInputElement;
class nsIDOMKeyEvent;
class nsIDOMNode;
class nsIDragSession;
class nsIEventTarget;

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

@ -56,7 +56,6 @@
#include "nsMenuPopupFrame.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMKeyEvent.h"
#include "nsIObserverService.h"
#include "nsIDocShell.h"
#include "nsIDOMWheelEvent.h"

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

@ -13,7 +13,6 @@
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsAtom.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMEventListener.h"
#include "nsIScriptContext.h"

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

@ -35,7 +35,6 @@ NS_IMPL_ADDREF_INHERITED(KeyboardEvent, UIEvent)
NS_IMPL_RELEASE_INHERITED(KeyboardEvent, UIEvent)
NS_INTERFACE_MAP_BEGIN(KeyboardEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMKeyEvent)
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
bool

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

@ -10,14 +10,12 @@
#include "mozilla/dom/UIEvent.h"
#include "mozilla/dom/KeyboardEventBinding.h"
#include "mozilla/EventForwards.h"
#include "nsIDOMKeyEvent.h"
#include "nsRFPService.h"
namespace mozilla {
namespace dom {
class KeyboardEvent : public UIEvent,
public nsIDOMKeyEvent
class KeyboardEvent : public UIEvent
{
public:
KeyboardEvent(EventTarget* aOwner,
@ -26,12 +24,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMKeyEvent Interface
NS_DECL_NSIDOMKEYEVENT
// Forward to base class
NS_FORWARD_TO_UIEVENT
virtual KeyboardEvent* AsKeyboardEvent() override
{
return this;

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

@ -15,7 +15,6 @@
#include "nsIDocumentInlines.h"
#include "nsDOMTokenList.h"
#include "nsIDOMEvent.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMEventListener.h"
#include "nsIFrame.h"

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

@ -5,7 +5,7 @@
#include "nsISupports.idl"
interface nsIDOMKeyEvent;
interface nsIDOMEvent;
interface mozIDOMWindow;
interface nsITextInputProcessorCallback;
@ -311,7 +311,7 @@ interface nsITextInputProcessor : nsISupports
* canceled by the web application.
*/
[optional_argc]
boolean startComposition([optional] in nsIDOMKeyEvent aKeyboardEvent,
boolean startComposition([optional] in nsIDOMEvent aKeyboardEvent,
[optional] in unsigned long aKeyFlags);
/**
@ -402,7 +402,7 @@ interface nsITextInputProcessor : nsISupports
*/
[optional_argc]
boolean flushPendingComposition(
[optional] in nsIDOMKeyEvent aKeyboardEvent,
[optional] in nsIDOMEvent aKeyboardEvent,
[optional] in unsigned long aKeyFlags);
/**
@ -416,7 +416,7 @@ interface nsITextInputProcessor : nsISupports
* @param aKeyFlags See KEY_* constants.
*/
[optional_argc]
void commitComposition([optional] in nsIDOMKeyEvent aKeyboardEvent,
void commitComposition([optional] in nsIDOMEvent aKeyboardEvent,
[optional] in unsigned long aKeyFlags);
/**
@ -438,7 +438,7 @@ interface nsITextInputProcessor : nsISupports
*/
[optional_argc]
boolean commitCompositionWith(in DOMString aCommitString,
[optional] in nsIDOMKeyEvent aKeyboardEvent,
[optional] in nsIDOMEvent aKeyboardEvent,
[optional] in unsigned long aKeyFlags);
/**
@ -457,7 +457,7 @@ interface nsITextInputProcessor : nsISupports
* @param aKeyFlags See KEY_* constants.
*/
[optional_argc]
void cancelComposition([optional] in nsIDOMKeyEvent aKeyboardEvent,
void cancelComposition([optional] in nsIDOMEvent aKeyboardEvent,
[optional] in unsigned long aKeyFlags);
// Specifying KEY_DEFAULT_PREVENTED can dispatch key events whose
@ -547,14 +547,14 @@ interface nsITextInputProcessor : nsISupports
* default action has been taken).
*/
[optional_argc]
unsigned long keydown(in nsIDOMKeyEvent aKeyboardEvent,
unsigned long keydown(in nsIDOMEvent aKeyboardEvent,
[optional] in unsigned long aKeyFlags);
/**
* Similar to keydown(), but this dispatches only a keyup event.
*/
[optional_argc]
boolean keyup(in nsIDOMKeyEvent aKeyboardEvent,
boolean keyup(in nsIDOMEvent aKeyboardEvent,
[optional] in unsigned long aKeyFlags);
/**

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

@ -16,7 +16,6 @@ XPIDL_SOURCES += [
'nsIDOMEventListener.idl',
'nsIDOMEventTarget.idl',
'nsIDOMFocusEvent.idl',
'nsIDOMKeyEvent.idl',
'nsIDOMMouseEvent.idl',
'nsIDOMMouseScrollEvent.idl',
'nsIDOMMutationEvent.idl',

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

@ -1,11 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMUIEvent.idl"
[builtinclass, uuid(2e52eb99-670d-469a-b51f-8efee2dd091d)]
interface nsIDOMKeyEvent : nsIDOMUIEvent
{
};

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

@ -14,7 +14,6 @@
#include "nsSMILTimedElement.h"
#include "nsSMILInstanceTime.h"
#include "nsSMILParserUtils.h"
#include "nsIDOMKeyEvent.h"
#include "nsString.h"
#include <limits>

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

@ -730,8 +730,7 @@ nsXBLPrototypeHandler::KeyEventMatched(
return false;
}
return ModifiersMatchMask(static_cast<nsIDOMKeyEvent*>(aKeyEvent),
aIgnoreModifierState);
return ModifiersMatchMask(aKeyEvent, aIgnoreModifierState);
}
bool

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

@ -18,7 +18,6 @@ class nsCaret;
class nsIContent;
class nsIDOMDragEvent;
class nsIDOMEvent;
class nsIDOMKeyEvent;
class nsIDOMMouseEvent;
class nsIPresShell;
class nsPresContext;

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

@ -935,7 +935,7 @@ HTMLEditor::UpdateBaseURL()
/**
* This routine is needed to provide a bottleneck for typing for logging
* purposes. Can't use HandleKeyPress() (above) for that since it takes
* a nsIDOMKeyEvent* parameter. So instead we pass enough info through
* a WidgetKeyboardEvent* parameter. So instead we pass enough info through
* to TypedText() to determine what action to take, but without passing
* an event.
*/

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

@ -389,7 +389,7 @@ TextEditor::HandleKeyPressEvent(WidgetKeyboardEvent* aKeyboardEvent)
/* This routine is needed to provide a bottleneck for typing for logging
purposes. Can't use HandleKeyPress() (above) for that since it takes
a nsIDOMKeyEvent* parameter. So instead we pass enough info through
a WidgetKeyboardEvent* parameter. So instead we pass enough info through
to TypedText() to determine what action to take, but without passing
an event.
*/

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

@ -12,7 +12,6 @@
#include "nsIDOMWindow.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMElement.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMEvent.h"
#include "nsIDocument.h"
#include "nsIDocShell.h"

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

@ -15,7 +15,7 @@
* @param codeNameIndex The codeNameIndex of this contorl key.
* See PhysicalKeyCodeNameList.h for details.
* @param keyCode The keyCode of this control key.
* See nsIDOMKeyEvent.idl for details.
* See KeyEvent.webidl for details.
*
* Use KEY to define the key with its modifier states. The key will be spoofed
* with given modifier states.
@ -24,7 +24,7 @@
* @param codeNameIndex The codeNameIndex of this key.
* See PhysicalKeyCodeNameList.h for details.
* @param keyCode The keyCode of this key.
* See nsIDOMKeyEvent.idl for details.
* See KeyEvent.webidl for details.
* @param modifiers The spoofing modifier states for this key.
* See BasicEvents.h for details.
*/

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

@ -38,7 +38,6 @@
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLMediaElement.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMMouseScrollEvent.h"
#include "nsIDOMMutationEvent.h"
@ -115,7 +114,6 @@
#include "mozilla/dom/HTMLHtmlElementBinding.h"
#include "mozilla/dom/HTMLInputElementBinding.h"
#include "mozilla/dom/HTMLMediaElementBinding.h"
#include "mozilla/dom/KeyEventBinding.h"
#include "mozilla/dom/ListBoxObjectBinding.h"
#include "mozilla/dom/MediaListBinding.h"
#include "mozilla/dom/MessageEventBinding.h"
@ -245,7 +243,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
DEFINE_SHIM(HTMLFormElement),
DEFINE_SHIM(HTMLInputElement),
DEFINE_SHIM(HTMLMediaElement),
DEFINE_SHIM(KeyEvent),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIListBoxObject, ListBoxObject),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIMenuBoxObject, MenuBoxObject),
DEFINE_SHIM(MouseEvent),