mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1230216
- Changing nsIDOM*Event interfaces so that they don't inherit nsIDOMEvent. r=smaug
All the event interfaces changed except for nsIDOMUIEvent and its inheritors.
This commit is contained in:
parent
93a0336c8f
commit
a0cc9ade83
@ -344,7 +344,7 @@ TextInputProcessor::PrepareKeyboardEventForComposition(
|
||||
|
||||
aKeyboardEvent =
|
||||
aOptionalArgc && aDOMKeyEvent ?
|
||||
aDOMKeyEvent->GetInternalNSEvent()->AsKeyboardEvent() : nullptr;
|
||||
aDOMKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent() : nullptr;
|
||||
if (!aKeyboardEvent || aOptionalArgc < 2) {
|
||||
aKeyFlags = 0;
|
||||
}
|
||||
@ -769,7 +769,7 @@ TextInputProcessor::Keydown(nsIDOMKeyEvent* aDOMKeyEvent,
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
WidgetKeyboardEvent* originalKeyEvent =
|
||||
aDOMKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
aDOMKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
if (NS_WARN_IF(!originalKeyEvent)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
@ -875,7 +875,7 @@ TextInputProcessor::Keyup(nsIDOMKeyEvent* aDOMKeyEvent,
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
WidgetKeyboardEvent* originalKeyEvent =
|
||||
aDOMKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
aDOMKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
if (NS_WARN_IF(!originalKeyEvent)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
@ -4955,13 +4955,13 @@ nsContentUtils::GetAccelKeyCandidates(nsIDOMKeyEvent* aDOMKeyEvent,
|
||||
NS_PRECONDITION(aCandidates.IsEmpty(), "aCandidates must be empty");
|
||||
|
||||
nsAutoString eventType;
|
||||
aDOMKeyEvent->GetType(eventType);
|
||||
aDOMKeyEvent->AsEvent()->GetType(eventType);
|
||||
// Don't process if aDOMKeyEvent is not a keypress event.
|
||||
if (!eventType.EqualsLiteral("keypress"))
|
||||
return;
|
||||
|
||||
WidgetKeyboardEvent* nativeKeyEvent =
|
||||
aDOMKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
aDOMKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
if (nativeKeyEvent) {
|
||||
NS_ASSERTION(nativeKeyEvent->mClass == eKeyboardEventClass,
|
||||
"wrong type of native event");
|
||||
|
@ -584,7 +584,7 @@ IMEStateManager::OnMouseButtonEventInEditor(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
WidgetMouseEvent* internalEvent =
|
||||
aMouseEvent->GetInternalNSEvent()->AsMouseEvent();
|
||||
aMouseEvent->AsEvent()->GetInternalNSEvent()->AsMouseEvent();
|
||||
if (NS_WARN_IF(!internalEvent)) {
|
||||
MOZ_LOG(sISMLog, LogLevel::Debug,
|
||||
("ISM: IMEStateManager::OnMouseButtonEventInEditor(), "
|
||||
@ -597,7 +597,7 @@ IMEStateManager::OnMouseButtonEventInEditor(nsPresContext* aPresContext,
|
||||
|
||||
if (MOZ_LOG_TEST(sISMLog, LogLevel::Info)) {
|
||||
nsAutoString eventType;
|
||||
aMouseEvent->GetType(eventType);
|
||||
aMouseEvent->AsEvent()->GetType(eventType);
|
||||
MOZ_LOG(sISMLog, LogLevel::Info,
|
||||
("ISM: IMEStateManager::OnMouseButtonEventInEditor(), "
|
||||
"mouse event (type=%s, button=%d) is %s",
|
||||
@ -630,7 +630,7 @@ IMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
|
||||
NS_ENSURE_TRUE_VOID(widget);
|
||||
|
||||
bool isTrusted;
|
||||
nsresult rv = aMouseEvent->GetIsTrusted(&isTrusted);
|
||||
nsresult rv = aMouseEvent->AsEvent()->GetIsTrusted(&isTrusted);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
if (!isTrusted) {
|
||||
MOZ_LOG(sISMLog, LogLevel::Debug,
|
||||
|
@ -346,6 +346,12 @@ UIEvent::IsChar() const
|
||||
return keyEvent ? keyEvent->isChar : false;
|
||||
}
|
||||
|
||||
mozilla::dom::Event*
|
||||
UIEvent::AsEvent(void)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
UIEvent::DuplicatePrivateData()
|
||||
{
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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 "nsIDOMEvent.idl"
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* Animation events are defined in:
|
||||
@ -11,8 +11,9 @@
|
||||
* http://dev.w3.org/csswg/css3-animations/#animation-events-
|
||||
*/
|
||||
|
||||
[builtinclass, uuid(772c7069-3f7d-42cf-97ab-b32f1c0b83da)]
|
||||
interface nsIDOMAnimationEvent : nsIDOMEvent {
|
||||
[builtinclass, uuid(ce6d1db3-53b8-4ade-9baa-70f4947200a2)]
|
||||
interface nsIDOMAnimationEvent : nsISupports
|
||||
{
|
||||
readonly attribute DOMString animationName;
|
||||
readonly attribute float elapsedTime;
|
||||
readonly attribute DOMString pseudoElement;
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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 "nsIDOMEvent.idl"
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* The nsIDOMBeforeUnloadEvent interface is the interface for events
|
||||
@ -15,8 +15,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
[builtinclass, uuid(96abf41b-32a8-4ff6-a0d6-4ade4ddebf89)]
|
||||
interface nsIDOMBeforeUnloadEvent : nsIDOMEvent
|
||||
[builtinclass, uuid(26c83933-a5a4-455e-8c46-69fa24dfa991)]
|
||||
interface nsIDOMBeforeUnloadEvent : nsISupports
|
||||
{
|
||||
/**
|
||||
* Attribute used to pass back a return value from a beforeunload
|
||||
|
@ -4,12 +4,12 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "domstubs.idl"
|
||||
#include "nsIDOMEvent.idl"
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMDataTransfer;
|
||||
|
||||
[builtinclass, uuid(4ef84980-52c2-425c-b41a-2ee75ec5d497)]
|
||||
interface nsIDOMClipboardEvent : nsIDOMEvent
|
||||
[builtinclass, uuid(b54d6144-3980-4895-83c7-82f158bc1cf5)]
|
||||
interface nsIDOMClipboardEvent : nsISupports
|
||||
{
|
||||
readonly attribute nsIDOMDataTransfer clipboardData;
|
||||
|
||||
|
@ -3,10 +3,10 @@
|
||||
* 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 "nsIDOMEvent.idl"
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[builtinclass, uuid(7efbe68a-811a-4159-801c-226948cfd08f)]
|
||||
interface nsIDOMCommandEvent : nsIDOMEvent
|
||||
[builtinclass, uuid(73a50e55-3eaa-4a38-a588-9b68a6d65032)]
|
||||
interface nsIDOMCommandEvent : nsISupports
|
||||
{
|
||||
readonly attribute DOMString command;
|
||||
|
||||
|
@ -3,11 +3,11 @@
|
||||
* 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 "nsIDOMEvent.idl"
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIVariant.idl"
|
||||
|
||||
[builtinclass, uuid(31ceb43e-5f49-43bf-9a18-3b60a535c814)]
|
||||
interface nsIDOMDataContainerEvent : nsIDOMEvent
|
||||
[builtinclass, uuid(a9f1f528-d106-4fea-8663-2d7f64b627a9)]
|
||||
interface nsIDOMDataContainerEvent : nsISupports
|
||||
{
|
||||
/**
|
||||
* Return the data associated with the given key.
|
||||
|
@ -3,7 +3,8 @@
|
||||
* 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 "nsIDOMEvent.idl"
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIDOMWindow.idl"
|
||||
|
||||
/**
|
||||
* The nsIDOMMessageEvent interface is used for server-sent events and for
|
||||
@ -12,8 +13,8 @@
|
||||
* For more information on this interface, please see
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/#messageevent
|
||||
*/
|
||||
[builtinclass, uuid(4408a2f5-614f-40a3-8786-e16bd3f74e32)]
|
||||
interface nsIDOMMessageEvent : nsIDOMEvent
|
||||
[builtinclass, uuid(5d57bc56-30cf-4839-9e98-17f940120ec0)]
|
||||
interface nsIDOMMessageEvent : nsISupports
|
||||
{
|
||||
/**
|
||||
* Custom string data associated with this event.
|
||||
|
@ -3,10 +3,11 @@
|
||||
* 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 "nsIDOMEvent.idl"
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIDOMNode.idl"
|
||||
|
||||
[builtinclass, uuid(df7e4cd9-e41f-4c8e-a764-2e3191d2f463)]
|
||||
interface nsIDOMMutationEvent : nsIDOMEvent
|
||||
[builtinclass, uuid(30c9997f-bc4c-4890-b890-febb6ae3051b)]
|
||||
interface nsIDOMMutationEvent : nsISupports
|
||||
{
|
||||
const unsigned short MODIFICATION = 1;
|
||||
const unsigned short ADDITION = 2;
|
||||
|
@ -3,7 +3,9 @@
|
||||
* 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 "nsIDOMEvent.idl"
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIDOMClientRectList.idl"
|
||||
#include "nsIDOMClientRect.idl"
|
||||
|
||||
interface nsIDOMPaintRequestList;
|
||||
|
||||
@ -12,8 +14,8 @@ interface nsIDOMPaintRequestList;
|
||||
* event, which fires at a window when painting has happened in
|
||||
* that window.
|
||||
*/
|
||||
[builtinclass, uuid(550f660c-65a5-4e17-b828-3dbec7c44304)]
|
||||
interface nsIDOMNotifyPaintEvent : nsIDOMEvent
|
||||
[builtinclass, uuid(63f573a0-3e4e-474b-a0c2-bb4ca93febaa)]
|
||||
interface nsIDOMNotifyPaintEvent : nsISupports
|
||||
{
|
||||
/**
|
||||
* Get a list of rectangles which are affected. The rectangles are in CSS pixels
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 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 "nsIDOMEvent.idl"
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* Transition events are defined in:
|
||||
@ -11,8 +11,8 @@
|
||||
* http://dev.w3.org/csswg/css3-transitions/#transition-events-
|
||||
*/
|
||||
|
||||
[builtinclass, uuid(acb69403-0dcb-4db0-9ffc-8a22cc56c4eb)]
|
||||
interface nsIDOMTransitionEvent : nsIDOMEvent {
|
||||
[builtinclass, uuid(ee3499bf-0f14-4bb6-829c-19ad24fd4a85)]
|
||||
interface nsIDOMTransitionEvent : nsISupports {
|
||||
readonly attribute DOMString propertyName;
|
||||
readonly attribute float elapsedTime;
|
||||
readonly attribute DOMString pseudoElement;
|
||||
|
@ -3,7 +3,8 @@
|
||||
* 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 "nsIDOMEvent.idl"
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIDOMWindow.idl"
|
||||
|
||||
/**
|
||||
* The nsIDOMUIEvent interface is the datatype for all UI events in the
|
||||
@ -13,8 +14,18 @@
|
||||
* http://www.w3.org/TR/DOM-Level-2-Events/
|
||||
*/
|
||||
|
||||
[builtinclass, uuid(db058d10-1db9-4cf9-bb4c-483c304a137f)]
|
||||
interface nsIDOMUIEvent : nsIDOMEvent
|
||||
%{C++
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Event;
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
||||
[ptr] native EventPtr(mozilla::dom::Event);
|
||||
|
||||
[builtinclass, uuid(75996b57-51f0-4c9c-aaaa-e35eaf347b66)]
|
||||
interface nsIDOMUIEvent : nsISupports
|
||||
{
|
||||
readonly attribute nsIDOMWindow view;
|
||||
readonly attribute long detail;
|
||||
@ -38,4 +49,6 @@ interface nsIDOMUIEvent : nsIDOMEvent
|
||||
attribute boolean cancelBubble;
|
||||
|
||||
readonly attribute boolean isChar;
|
||||
|
||||
[notxpcom, nostdcall] EventPtr AsEvent();
|
||||
};
|
||||
|
@ -55,6 +55,7 @@ using mozilla::DefaultXDisplay;
|
||||
#include "mozilla/MiscEvents.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/dom/HTMLObjectElementBinding.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "nsFrameSelection.h"
|
||||
|
@ -90,8 +90,8 @@ nsXBLKeyEventHandler::ExecuteMatchedHandlers(
|
||||
uint32_t aCharCode,
|
||||
const IgnoreModifierState& aIgnoreModifierState)
|
||||
{
|
||||
WidgetEvent* event = aKeyEvent->GetInternalNSEvent();
|
||||
nsCOMPtr<EventTarget> target = aKeyEvent->InternalDOMEvent()->GetCurrentTarget();
|
||||
WidgetEvent* event = aKeyEvent->AsEvent()->GetInternalNSEvent();
|
||||
nsCOMPtr<EventTarget> target = aKeyEvent->AsEvent()->InternalDOMEvent()->GetCurrentTarget();
|
||||
|
||||
bool executed = false;
|
||||
for (uint32_t i = 0; i < mProtoHandlers.Length(); ++i) {
|
||||
@ -101,7 +101,7 @@ nsXBLKeyEventHandler::ExecuteMatchedHandlers(
|
||||
(hasAllowUntrustedAttr && handler->AllowUntrustedEvents()) ||
|
||||
(!hasAllowUntrustedAttr && !mIsBoundToChrome && !mUsingContentXBLScope)) &&
|
||||
handler->KeyEventMatched(aKeyEvent, aCharCode, aIgnoreModifierState)) {
|
||||
handler->ExecuteHandler(target, aKeyEvent);
|
||||
handler->ExecuteHandler(target, aKeyEvent->AsEvent());
|
||||
executed = true;
|
||||
}
|
||||
}
|
||||
|
@ -909,7 +909,7 @@ nsXBLPrototypeHandler::ModifiersMatchMask(
|
||||
nsIDOMUIEvent* aEvent,
|
||||
const IgnoreModifierState& aIgnoreModifierState)
|
||||
{
|
||||
WidgetInputEvent* inputEvent = aEvent->GetInternalNSEvent()->AsInputEvent();
|
||||
WidgetInputEvent* inputEvent = aEvent->AsEvent()->GetInternalNSEvent()->AsInputEvent();
|
||||
NS_ENSURE_TRUE(inputEvent, false);
|
||||
|
||||
if (mKeyMask & cMetaMask) {
|
||||
|
@ -262,13 +262,13 @@ nsresult
|
||||
nsXBLWindowKeyHandler::WalkHandlers(nsIDOMKeyEvent* aKeyEvent, nsIAtom* aEventType)
|
||||
{
|
||||
bool prevent;
|
||||
aKeyEvent->GetDefaultPrevented(&prevent);
|
||||
aKeyEvent->AsEvent()->GetDefaultPrevented(&prevent);
|
||||
if (prevent)
|
||||
return NS_OK;
|
||||
|
||||
bool trustedEvent = false;
|
||||
// Don't process the event if it was not dispatched from a trusted source
|
||||
aKeyEvent->GetIsTrusted(&trustedEvent);
|
||||
aKeyEvent->AsEvent()->GetIsTrusted(&trustedEvent);
|
||||
|
||||
if (!trustedEvent)
|
||||
return NS_OK;
|
||||
@ -281,7 +281,7 @@ nsXBLWindowKeyHandler::WalkHandlers(nsIDOMKeyEvent* aKeyEvent, nsIAtom* aEventTy
|
||||
if (!el) {
|
||||
if (mUserHandler) {
|
||||
WalkHandlersInternal(aKeyEvent, aEventType, mUserHandler, true);
|
||||
aKeyEvent->GetDefaultPrevented(&prevent);
|
||||
aKeyEvent->AsEvent()->GetDefaultPrevented(&prevent);
|
||||
if (prevent)
|
||||
return NS_OK; // Handled by the user bindings. Our work here is done.
|
||||
}
|
||||
@ -322,14 +322,14 @@ void
|
||||
nsXBLWindowKeyHandler::HandleEventOnCapture(nsIDOMKeyEvent* aEvent)
|
||||
{
|
||||
WidgetKeyboardEvent* widgetEvent =
|
||||
aEvent->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
aEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
|
||||
if (widgetEvent->mFlags.mNoCrossProcessBoundaryForwarding) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<mozilla::dom::Element> originalTarget =
|
||||
do_QueryInterface(aEvent->GetInternalNSEvent()->originalTarget);
|
||||
do_QueryInterface(aEvent->AsEvent()->GetInternalNSEvent()->originalTarget);
|
||||
if (!EventStateManager::IsRemoteTarget(originalTarget)) {
|
||||
return;
|
||||
}
|
||||
@ -353,7 +353,7 @@ nsXBLWindowKeyHandler::HandleEventOnCapture(nsIDOMKeyEvent* aEvent)
|
||||
// yet, it means it wasn't processed by content. We'll not call any
|
||||
// of the handlers at this moment, and will wait for the event to be
|
||||
// redispatched with mNoCrossProcessBoundaryForwarding = 1 to process it.
|
||||
aEvent->StopPropagation();
|
||||
aEvent->AsEvent()->StopPropagation();
|
||||
}
|
||||
}
|
||||
|
||||
@ -478,7 +478,7 @@ nsXBLWindowKeyHandler::WalkHandlersAndExecute(
|
||||
// Try all of the handlers until we find one that matches the event.
|
||||
for (nsXBLPrototypeHandler *currHandler = aHandler; currHandler;
|
||||
currHandler = currHandler->GetNextHandler()) {
|
||||
bool stopped = aKeyEvent->IsDispatchStopped();
|
||||
bool stopped = aKeyEvent->AsEvent()->IsDispatchStopped();
|
||||
if (stopped) {
|
||||
// The event is finished, don't execute any more handlers
|
||||
return false;
|
||||
@ -552,7 +552,7 @@ nsXBLWindowKeyHandler::WalkHandlersAndExecute(
|
||||
return true;
|
||||
}
|
||||
|
||||
rv = currHandler->ExecuteHandler(piTarget, aKeyEvent);
|
||||
rv = currHandler->ExecuteHandler(piTarget, aKeyEvent->AsEvent());
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
return true;
|
||||
}
|
||||
@ -565,7 +565,7 @@ nsXBLWindowKeyHandler::WalkHandlersAndExecute(
|
||||
// retry to look for a shortcut key without the Windows-Logo key press.
|
||||
if (!aIgnoreModifierState.mOS) {
|
||||
WidgetKeyboardEvent* keyEvent =
|
||||
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
aKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
if (keyEvent && keyEvent->IsOS()) {
|
||||
IgnoreModifierState ignoreModifierState(aIgnoreModifierState);
|
||||
ignoreModifierState.mOS = true;
|
||||
@ -582,7 +582,7 @@ bool
|
||||
nsXBLWindowKeyHandler::HasHandlerForEvent(nsIDOMKeyEvent* aEvent,
|
||||
bool* aOutReservedForChrome)
|
||||
{
|
||||
if (!aEvent->InternalDOMEvent()->IsTrusted()) {
|
||||
if (!aEvent->AsEvent()->InternalDOMEvent()->IsTrusted()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -596,7 +596,7 @@ nsXBLWindowKeyHandler::HasHandlerForEvent(nsIDOMKeyEvent* aEvent,
|
||||
}
|
||||
|
||||
nsAutoString eventType;
|
||||
aEvent->GetType(eventType);
|
||||
aEvent->AsEvent()->GetType(eventType);
|
||||
nsCOMPtr<nsIAtom> eventTypeAtom = do_GetAtom(eventType);
|
||||
NS_ENSURE_TRUE(eventTypeAtom, false);
|
||||
|
||||
|
@ -115,7 +115,7 @@ nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||
}
|
||||
|
||||
// Get the node that was clicked on.
|
||||
EventTarget* target = mouseEvent->InternalDOMEvent()->GetTarget();
|
||||
EventTarget* target = mouseEvent->AsEvent()->InternalDOMEvent()->GetTarget();
|
||||
nsCOMPtr<nsIDOMNode> targetNode = do_QueryInterface(target);
|
||||
|
||||
if (!targetNode && mIsContext) {
|
||||
@ -144,7 +144,7 @@ nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||
}
|
||||
|
||||
bool preventDefault;
|
||||
mouseEvent->GetDefaultPrevented(&preventDefault);
|
||||
mouseEvent->AsEvent()->GetDefaultPrevented(&preventDefault);
|
||||
if (preventDefault && targetNode && mIsContext) {
|
||||
// Someone called preventDefault on a context menu.
|
||||
// Let's make sure they are allowed to do so.
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/dom/Element.h" // for Element, nsINode::AsElement
|
||||
#include "mozilla/dom/Text.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/mozalloc.h" // for operator new, etc
|
||||
#include "nsAString.h" // for nsAString_internal::Length, etc
|
||||
#include "nsCCUncollectableMarker.h" // for nsCCUncollectableMarker
|
||||
@ -4615,7 +4616,7 @@ nsEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
||||
// HandleKeyPressEvent()'s switch statement.
|
||||
|
||||
WidgetKeyboardEvent* nativeKeyEvent =
|
||||
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
aKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
NS_ENSURE_TRUE(nativeKeyEvent, NS_ERROR_UNEXPECTED);
|
||||
NS_ASSERTION(nativeKeyEvent->mMessage == eKeyPress,
|
||||
"HandleKeyPressEvent gets non-keypress event");
|
||||
@ -4625,7 +4626,7 @@ nsEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
||||
// consume backspace for disabled and readonly textfields, to prevent
|
||||
// back in history, which could be confusing to users
|
||||
if (nativeKeyEvent->keyCode == nsIDOMKeyEvent::DOM_VK_BACK_SPACE) {
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->AsEvent()->PreventDefault();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -4636,7 +4637,7 @@ nsEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
||||
case nsIDOMKeyEvent::DOM_VK_SHIFT:
|
||||
case nsIDOMKeyEvent::DOM_VK_CONTROL:
|
||||
case nsIDOMKeyEvent::DOM_VK_ALT:
|
||||
aKeyEvent->PreventDefault(); // consumed
|
||||
aKeyEvent->AsEvent()->PreventDefault(); // consumed
|
||||
return NS_OK;
|
||||
case nsIDOMKeyEvent::DOM_VK_BACK_SPACE:
|
||||
if (nativeKeyEvent->IsControl() || nativeKeyEvent->IsAlt() ||
|
||||
@ -4644,7 +4645,7 @@ nsEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
||||
return NS_OK;
|
||||
}
|
||||
DeleteSelection(nsIEditor::ePrevious, nsIEditor::eStrip);
|
||||
aKeyEvent->PreventDefault(); // consumed
|
||||
aKeyEvent->AsEvent()->PreventDefault(); // consumed
|
||||
return NS_OK;
|
||||
case nsIDOMKeyEvent::DOM_VK_DELETE:
|
||||
// on certain platforms (such as windows) the shift key
|
||||
@ -4656,7 +4657,7 @@ nsEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
||||
return NS_OK;
|
||||
}
|
||||
DeleteSelection(nsIEditor::eNext, nsIEditor::eStrip);
|
||||
aKeyEvent->PreventDefault(); // consumed
|
||||
aKeyEvent->AsEvent()->PreventDefault(); // consumed
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -448,7 +448,7 @@ nsEditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||
// editor shouldn't handle this click event.
|
||||
if (mMouseDownOrUpConsumedByIME) {
|
||||
mMouseDownOrUpConsumedByIME = false;
|
||||
mouseEvent->PreventDefault();
|
||||
mouseEvent->AsEvent()->PreventDefault();
|
||||
return NS_OK;
|
||||
}
|
||||
return MouseClick(mouseEvent);
|
||||
@ -611,7 +611,7 @@ nsEditorEventListener::KeyPress(nsIDOMKeyEvent* aKeyEvent)
|
||||
{
|
||||
NS_ENSURE_TRUE(aKeyEvent, NS_OK);
|
||||
|
||||
if (!mEditor->IsAcceptableInputEvent(aKeyEvent)) {
|
||||
if (!mEditor->IsAcceptableInputEvent(aKeyEvent->AsEvent())) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -622,7 +622,7 @@ nsEditorEventListener::KeyPress(nsIDOMKeyEvent* aKeyEvent)
|
||||
// below.
|
||||
|
||||
bool defaultPrevented;
|
||||
aKeyEvent->GetDefaultPrevented(&defaultPrevented);
|
||||
aKeyEvent->AsEvent()->GetDefaultPrevented(&defaultPrevented);
|
||||
if (defaultPrevented) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -630,7 +630,7 @@ nsEditorEventListener::KeyPress(nsIDOMKeyEvent* aKeyEvent)
|
||||
nsresult rv = mEditor->HandleKeyPressEvent(aKeyEvent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aKeyEvent->GetDefaultPrevented(&defaultPrevented);
|
||||
aKeyEvent->AsEvent()->GetDefaultPrevented(&defaultPrevented);
|
||||
if (defaultPrevented) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -641,7 +641,7 @@ nsEditorEventListener::KeyPress(nsIDOMKeyEvent* aKeyEvent)
|
||||
|
||||
// Now, ask the native key bindings to handle the event.
|
||||
WidgetKeyboardEvent* keyEvent =
|
||||
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
aKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
MOZ_ASSERT(keyEvent,
|
||||
"DOM key event's internal event must be WidgetKeyboardEvent");
|
||||
nsIWidget* widget = keyEvent->widget;
|
||||
@ -658,7 +658,7 @@ nsEditorEventListener::KeyPress(nsIDOMKeyEvent* aKeyEvent)
|
||||
nsIWidget::NativeKeyBindingsForRichTextEditor,
|
||||
*keyEvent, DoCommandCallback, doc);
|
||||
if (handled) {
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->AsEvent()->PreventDefault();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -668,7 +668,7 @@ nsEditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent)
|
||||
{
|
||||
// nothing to do if editor isn't editable or clicked on out of the editor.
|
||||
if (mEditor->IsReadonly() || mEditor->IsDisabled() ||
|
||||
!mEditor->IsAcceptableInputEvent(aMouseEvent)) {
|
||||
!mEditor->IsAcceptableInputEvent(aMouseEvent->AsEvent())) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -683,7 +683,7 @@ nsEditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent)
|
||||
}
|
||||
|
||||
bool preventDefault;
|
||||
nsresult rv = aMouseEvent->GetDefaultPrevented(&preventDefault);
|
||||
nsresult rv = aMouseEvent->AsEvent()->GetDefaultPrevented(&preventDefault);
|
||||
if (NS_FAILED(rv) || preventDefault) {
|
||||
// We're done if 'preventdefault' is true (see for example bug 70698).
|
||||
return rv;
|
||||
@ -754,8 +754,8 @@ nsEditorEventListener::HandleMiddleClickPaste(nsIDOMMouseEvent* aMouseEvent)
|
||||
|
||||
// Prevent the event from propagating up to be possibly handled
|
||||
// again by the containing window:
|
||||
aMouseEvent->StopPropagation();
|
||||
aMouseEvent->PreventDefault();
|
||||
aMouseEvent->AsEvent()->StopPropagation();
|
||||
aMouseEvent->AsEvent()->PreventDefault();
|
||||
|
||||
// We processed the event, whether drop/paste succeeded or not
|
||||
return NS_OK;
|
||||
@ -770,7 +770,7 @@ nsEditorEventListener::NotifyIMEOfMouseButtonEvent(
|
||||
}
|
||||
|
||||
bool defaultPrevented;
|
||||
nsresult rv = aMouseEvent->GetDefaultPrevented(&defaultPrevented);
|
||||
nsresult rv = aMouseEvent->AsEvent()->GetDefaultPrevented(&defaultPrevented);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
if (defaultPrevented) {
|
||||
return false;
|
||||
@ -840,7 +840,7 @@ nsEditorEventListener::DragOver(nsIDOMDragEvent* aDragEvent)
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
bool defaultPrevented;
|
||||
aDragEvent->GetDefaultPrevented(&defaultPrevented);
|
||||
aDragEvent->AsEvent()->GetDefaultPrevented(&defaultPrevented);
|
||||
if (defaultPrevented) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -850,7 +850,7 @@ nsEditorEventListener::DragOver(nsIDOMDragEvent* aDragEvent)
|
||||
NS_ENSURE_TRUE(dropParent, NS_ERROR_FAILURE);
|
||||
|
||||
if (dropParent->IsEditable() && CanDrop(aDragEvent)) {
|
||||
aDragEvent->PreventDefault(); // consumed
|
||||
aDragEvent->AsEvent()->PreventDefault(); // consumed
|
||||
|
||||
if (!mCaret) {
|
||||
return NS_OK;
|
||||
@ -869,7 +869,7 @@ nsEditorEventListener::DragOver(nsIDOMDragEvent* aDragEvent)
|
||||
if (!IsFileControlTextBox()) {
|
||||
// This is needed when dropping on an input, to prevent the editor for
|
||||
// the editable parent from receiving the event.
|
||||
aDragEvent->StopPropagation();
|
||||
aDragEvent->AsEvent()->StopPropagation();
|
||||
}
|
||||
|
||||
if (mCaret) {
|
||||
@ -914,7 +914,7 @@ nsEditorEventListener::Drop(nsIDOMDragEvent* aDragEvent)
|
||||
CleanupDragDropCaret();
|
||||
|
||||
bool defaultPrevented;
|
||||
aDragEvent->GetDefaultPrevented(&defaultPrevented);
|
||||
aDragEvent->AsEvent()->GetDefaultPrevented(&defaultPrevented);
|
||||
if (defaultPrevented) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -932,14 +932,14 @@ nsEditorEventListener::Drop(nsIDOMDragEvent* aDragEvent)
|
||||
// since someone else handling it might be unintentional and the
|
||||
// user could probably re-drag to be not over the disabled/readonly
|
||||
// editfields if that is what is desired.
|
||||
return aDragEvent->StopPropagation();
|
||||
return aDragEvent->AsEvent()->StopPropagation();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
aDragEvent->StopPropagation();
|
||||
aDragEvent->PreventDefault();
|
||||
return mEditor->InsertFromDrop(aDragEvent);
|
||||
aDragEvent->AsEvent()->StopPropagation();
|
||||
aDragEvent->AsEvent()->PreventDefault();
|
||||
return mEditor->InsertFromDrop(aDragEvent->AsEvent());
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1183,7 +1183,7 @@ nsEditorEventListener::ShouldHandleNativeKeyBindings(nsIDOMKeyEvent* aKeyEvent)
|
||||
// mouse events.
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
aKeyEvent->GetTarget(getter_AddRefs(target));
|
||||
aKeyEvent->AsEvent()->GetTarget(getter_AddRefs(target));
|
||||
nsCOMPtr<nsIContent> targetContent = do_QueryInterface(target);
|
||||
if (!targetContent) {
|
||||
return false;
|
||||
|
@ -617,7 +617,7 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
||||
}
|
||||
|
||||
WidgetKeyboardEvent* nativeKeyEvent =
|
||||
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
aKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
NS_ENSURE_TRUE(nativeKeyEvent, NS_ERROR_UNEXPECTED);
|
||||
NS_ASSERTION(nativeKeyEvent->mMessage == eKeyPress,
|
||||
"HandleKeyPressEvent gets non-keypress event");
|
||||
@ -676,12 +676,12 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (handled) {
|
||||
return aKeyEvent->PreventDefault(); // consumed
|
||||
return aKeyEvent->AsEvent()->PreventDefault(); // consumed
|
||||
}
|
||||
if (nativeKeyEvent->IsShift()) {
|
||||
return NS_OK; // don't type text for shift tabs
|
||||
}
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->AsEvent()->PreventDefault();
|
||||
return TypedText(NS_LITERAL_STRING("\t"), eTypedText);
|
||||
}
|
||||
case nsIDOMKeyEvent::DOM_VK_RETURN:
|
||||
@ -689,7 +689,7 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
||||
nativeKeyEvent->IsMeta() || nativeKeyEvent->IsOS()) {
|
||||
return NS_OK;
|
||||
}
|
||||
aKeyEvent->PreventDefault(); // consumed
|
||||
aKeyEvent->AsEvent()->PreventDefault(); // consumed
|
||||
if (nativeKeyEvent->IsShift() && !IsPlaintextEditor()) {
|
||||
// only inserts a br node
|
||||
return TypedText(EmptyString(), eTypedBR);
|
||||
@ -706,7 +706,7 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
||||
// we don't PreventDefault() here or keybindings like control-x won't work
|
||||
return NS_OK;
|
||||
}
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->AsEvent()->PreventDefault();
|
||||
nsAutoString str(nativeKeyEvent->charCode);
|
||||
return TypedText(str, eTypedText);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ nsHTMLEditorEventListener::MouseUp(nsIDOMMouseEvent* aMouseEvent)
|
||||
nsHTMLEditor* htmlEditor = GetHTMLEditor();
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
nsresult rv = aMouseEvent->GetTarget(getter_AddRefs(target));
|
||||
nsresult rv = aMouseEvent->AsEvent()->GetTarget(getter_AddRefs(target));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(target, NS_ERROR_NULL_POINTER);
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(target);
|
||||
@ -80,7 +80,7 @@ nsHTMLEditorEventListener::MouseDown(nsIDOMMouseEvent* aMouseEvent)
|
||||
nsHTMLEditor* htmlEditor = GetHTMLEditor();
|
||||
// Contenteditable should disregard mousedowns outside it.
|
||||
// IsAcceptableInputEvent() checks it for a mouse event.
|
||||
if (!htmlEditor->IsAcceptableInputEvent(aMouseEvent)) {
|
||||
if (!htmlEditor->IsAcceptableInputEvent(aMouseEvent->AsEvent())) {
|
||||
// If it's not acceptable mousedown event (including when mousedown event
|
||||
// is fired outside of the active editing host), we need to commit
|
||||
// composition because it will be change the selection to the clicked
|
||||
@ -103,7 +103,7 @@ nsHTMLEditorEventListener::MouseDown(nsIDOMMouseEvent* aMouseEvent)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
rv = aMouseEvent->GetExplicitOriginalTarget(getter_AddRefs(target));
|
||||
rv = aMouseEvent->AsEvent()->GetExplicitOriginalTarget(getter_AddRefs(target));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(target, NS_ERROR_NULL_POINTER);
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(target);
|
||||
@ -190,7 +190,7 @@ nsHTMLEditorEventListener::MouseDown(nsIDOMMouseEvent* aMouseEvent)
|
||||
// Prevent bubbling if we changed selection or
|
||||
// for all context clicks
|
||||
if (element || isContextClick) {
|
||||
aMouseEvent->PreventDefault();
|
||||
aMouseEvent->AsEvent()->PreventDefault();
|
||||
return NS_OK;
|
||||
}
|
||||
} else if (!isContextClick && buttonNumber == 0 && clickCount == 1) {
|
||||
@ -198,7 +198,7 @@ nsHTMLEditorEventListener::MouseDown(nsIDOMMouseEvent* aMouseEvent)
|
||||
int32_t clientX, clientY;
|
||||
aMouseEvent->GetClientX(&clientX);
|
||||
aMouseEvent->GetClientY(&clientY);
|
||||
htmlEditor->MouseDown(clientX, clientY, element, aMouseEvent);
|
||||
htmlEditor->MouseDown(clientX, clientY, element, aMouseEvent->AsEvent());
|
||||
}
|
||||
|
||||
return nsEditorEventListener::MouseDown(aMouseEvent);
|
||||
@ -208,7 +208,7 @@ nsresult
|
||||
nsHTMLEditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
nsresult rv = aMouseEvent->GetTarget(getter_AddRefs(target));
|
||||
nsresult rv = aMouseEvent->AsEvent()->GetTarget(getter_AddRefs(target));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(target, NS_ERROR_NULL_POINTER);
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(target);
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/Selection.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/TextComposition.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
@ -361,7 +362,7 @@ nsPlaintextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
||||
}
|
||||
|
||||
WidgetKeyboardEvent* nativeKeyEvent =
|
||||
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
aKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
NS_ENSURE_TRUE(nativeKeyEvent, NS_ERROR_UNEXPECTED);
|
||||
NS_ASSERTION(nativeKeyEvent->mMessage == eKeyPress,
|
||||
"HandleKeyPressEvent gets non-keypress event");
|
||||
@ -388,7 +389,7 @@ nsPlaintextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
||||
}
|
||||
|
||||
// else we insert the tab straight through
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->AsEvent()->PreventDefault();
|
||||
return TypedText(NS_LITERAL_STRING("\t"), eTypedText);
|
||||
}
|
||||
case nsIDOMKeyEvent::DOM_VK_RETURN:
|
||||
@ -397,7 +398,7 @@ nsPlaintextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
||||
nativeKeyEvent->IsOS()) {
|
||||
return NS_OK;
|
||||
}
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->AsEvent()->PreventDefault();
|
||||
return TypedText(EmptyString(), eTypedBreak);
|
||||
}
|
||||
|
||||
@ -409,7 +410,7 @@ nsPlaintextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
|
||||
// we don't PreventDefault() here or keybindings like control-x won't work
|
||||
return NS_OK;
|
||||
}
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->AsEvent()->PreventDefault();
|
||||
nsAutoString str(nativeKeyEvent->charCode);
|
||||
return TypedText(str, eTypedText);
|
||||
}
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsRange.h"
|
||||
#include "mozilla/dom/Selection.h"
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "LayersLogging.h"
|
||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "nsDocument.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
@ -65,6 +65,7 @@
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/TimelineConsumers.h"
|
||||
#include "nsAnimationManager.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
#include "ipc/Nuwa.h"
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsUTF8Utils.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -165,7 +166,7 @@ nsMenuBarFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent)
|
||||
|
||||
nsAutoTArray<uint32_t, 10> accessKeys;
|
||||
WidgetKeyboardEvent* nativeKeyEvent =
|
||||
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
aKeyEvent->AsEvent()->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
if (nativeKeyEvent)
|
||||
nsContentUtils::GetAccessKeyCandidates(nativeKeyEvent, accessKeys);
|
||||
if (accessKeys.IsEmpty() && charCode)
|
||||
|
@ -294,7 +294,7 @@ Modifiers
|
||||
nsMenuBarListener::GetModifiersForAccessKey(nsIDOMKeyEvent* aKeyEvent)
|
||||
{
|
||||
WidgetInputEvent* inputEvent =
|
||||
aKeyEvent->GetInternalNSEvent()->AsInputEvent();
|
||||
aKeyEvent->AsEvent()->GetInternalNSEvent()->AsInputEvent();
|
||||
MOZ_ASSERT(inputEvent);
|
||||
|
||||
static const Modifiers kPossibleModifiersForAccessKey =
|
||||
|
@ -1910,7 +1910,7 @@ nsMenuPopupFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent, bool& doAction
|
||||
|
||||
static DOMTimeStamp lastKeyTime = 0;
|
||||
DOMTimeStamp keyTime;
|
||||
aKeyEvent->GetTimeStamp(&keyTime);
|
||||
aKeyEvent->AsEvent()->GetTimeStamp(&keyTime);
|
||||
|
||||
if (charCode == 0) {
|
||||
if (keyCode == nsIDOMKeyEvent::DOM_VK_BACK_SPACE) {
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
@ -741,7 +742,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
mChildInfosAfterCount = 0;
|
||||
|
||||
int32_t c;
|
||||
nsPoint pt = nsLayoutUtils::GetDOMEventCoordinatesRelativeTo(mouseEvent,
|
||||
nsPoint pt = nsLayoutUtils::GetDOMEventCoordinatesRelativeTo(mouseEvent->AsEvent(),
|
||||
mParentBox);
|
||||
if (isHorizontal) {
|
||||
c = pt.x;
|
||||
|
@ -2008,7 +2008,7 @@ nsXULPopupManager::HandleShortcutNavigation(nsIDOMKeyEvent* aKeyEvent,
|
||||
{
|
||||
// On Windows, don't check shortcuts when the accelerator key is down.
|
||||
#ifdef XP_WIN
|
||||
WidgetInputEvent* evt = aKeyEvent->GetInternalNSEvent()->AsInputEvent();
|
||||
WidgetInputEvent* evt = aKeyEvent->AsEvent()->GetInternalNSEvent()->AsInputEvent();
|
||||
if (evt && evt->IsAccel()) {
|
||||
return false;
|
||||
}
|
||||
@ -2024,7 +2024,7 @@ nsXULPopupManager::HandleShortcutNavigation(nsIDOMKeyEvent* aKeyEvent,
|
||||
if (result) {
|
||||
aFrame->ChangeMenuItem(result, false, true);
|
||||
if (action) {
|
||||
WidgetGUIEvent* evt = aKeyEvent->GetInternalNSEvent()->AsGUIEvent();
|
||||
WidgetGUIEvent* evt = aKeyEvent->AsEvent()->GetInternalNSEvent()->AsGUIEvent();
|
||||
nsMenuFrame* menuToOpen = result->Enter(evt);
|
||||
if (menuToOpen) {
|
||||
nsCOMPtr<nsIContent> content = menuToOpen->GetContent();
|
||||
@ -2211,9 +2211,9 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode(
|
||||
aTopVisibleMenuItem->PopupType() != ePopupTypeMenu) {
|
||||
if (keyCode == nsIDOMKeyEvent::DOM_VK_ESCAPE) {
|
||||
HidePopup(aTopVisibleMenuItem->Content(), false, false, false, true);
|
||||
aKeyEvent->StopPropagation();
|
||||
aKeyEvent->StopCrossProcessForwarding();
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->AsEvent()->StopPropagation();
|
||||
aKeyEvent->AsEvent()->StopCrossProcessForwarding();
|
||||
aKeyEvent->AsEvent()->PreventDefault();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -2270,7 +2270,9 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode(
|
||||
// Otherwise, tell the active menubar, if any, to activate the menu. The
|
||||
// Enter method will return a menu if one needs to be opened as a result.
|
||||
nsMenuFrame* menuToOpen = nullptr;
|
||||
WidgetGUIEvent* GUIEvent = aKeyEvent->GetInternalNSEvent()->AsGUIEvent();
|
||||
WidgetGUIEvent* GUIEvent = aKeyEvent->AsEvent()->
|
||||
GetInternalNSEvent()->AsGUIEvent();
|
||||
|
||||
if (aTopVisibleMenuItem) {
|
||||
menuToOpen = aTopVisibleMenuItem->Frame()->Enter(GUIEvent);
|
||||
} else if (mActiveMenuBar) {
|
||||
@ -2288,9 +2290,9 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode(
|
||||
}
|
||||
|
||||
if (consume) {
|
||||
aKeyEvent->StopPropagation();
|
||||
aKeyEvent->StopCrossProcessForwarding();
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->AsEvent()->StopPropagation();
|
||||
aKeyEvent->AsEvent()->StopCrossProcessForwarding();
|
||||
aKeyEvent->AsEvent()->PreventDefault();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -2461,7 +2463,7 @@ nsXULPopupManager::HandleEvent(nsIDOMEvent* aEvent)
|
||||
}
|
||||
|
||||
nsAutoString eventType;
|
||||
keyEvent->GetType(eventType);
|
||||
aEvent->GetType(eventType);
|
||||
if (eventType.EqualsLiteral("keyup")) {
|
||||
return KeyUp(keyEvent);
|
||||
}
|
||||
@ -2487,14 +2489,14 @@ nsXULPopupManager::KeyUp(nsIDOMKeyEvent* aKeyEvent)
|
||||
return NS_OK;
|
||||
|
||||
if (item->IgnoreKeys() == eIgnoreKeys_Handled) {
|
||||
aKeyEvent->StopCrossProcessForwarding();
|
||||
aKeyEvent->AsEvent()->StopCrossProcessForwarding();
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
aKeyEvent->StopPropagation();
|
||||
aKeyEvent->StopCrossProcessForwarding();
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->AsEvent()->StopPropagation();
|
||||
aKeyEvent->AsEvent()->StopCrossProcessForwarding();
|
||||
aKeyEvent->AsEvent()->PreventDefault();
|
||||
|
||||
return NS_OK; // I am consuming event
|
||||
}
|
||||
@ -2545,8 +2547,8 @@ nsXULPopupManager::KeyDown(nsIDOMKeyEvent* aKeyEvent)
|
||||
else if (mActiveMenuBar)
|
||||
mActiveMenuBar->MenuClosed();
|
||||
}
|
||||
aKeyEvent->StopPropagation();
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->AsEvent()->StopPropagation();
|
||||
aKeyEvent->AsEvent()->PreventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2554,10 +2556,10 @@ nsXULPopupManager::KeyDown(nsIDOMKeyEvent* aKeyEvent)
|
||||
// listeners from becoming confused.
|
||||
|
||||
if (!item || item->IgnoreKeys() != eIgnoreKeys_Handled) {
|
||||
aKeyEvent->StopPropagation();
|
||||
aKeyEvent->AsEvent()->StopPropagation();
|
||||
}
|
||||
|
||||
aKeyEvent->StopCrossProcessForwarding();
|
||||
aKeyEvent->AsEvent()->StopCrossProcessForwarding();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -2584,10 +2586,10 @@ nsXULPopupManager::KeyPress(nsIDOMKeyEvent* aKeyEvent)
|
||||
bool onlyHandled = item && item->IgnoreKeys() == eIgnoreKeys_Handled;
|
||||
bool handled = HandleShortcutNavigation(keyEvent, nullptr);
|
||||
|
||||
aKeyEvent->StopCrossProcessForwarding();
|
||||
aKeyEvent->AsEvent()->StopCrossProcessForwarding();
|
||||
if (handled || (consume && !onlyHandled)) {
|
||||
aKeyEvent->StopPropagation();
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->AsEvent()->StopPropagation();
|
||||
aKeyEvent->AsEvent()->PreventDefault();
|
||||
}
|
||||
|
||||
return NS_OK; // I am consuming event
|
||||
|
Loading…
Reference in New Issue
Block a user