mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 719320 part.1 Add DOM3 WheelEvent r=smaug, sr=jst
This commit is contained in:
parent
b65f0c5cbe
commit
acbe3bbdd7
@ -720,6 +720,7 @@ GK_ATOM(ontransitionend, "ontransitionend")
|
||||
GK_ATOM(onunderflow, "onunderflow")
|
||||
GK_ATOM(onunload, "onunload")
|
||||
GK_ATOM(onupgradeneeded, "onupgradeneeded")
|
||||
GK_ATOM(onwheel, "onwheel")
|
||||
GK_ATOM(open, "open")
|
||||
GK_ATOM(optgroup, "optgroup")
|
||||
GK_ATOM(optimum, "optimum")
|
||||
|
@ -600,6 +600,10 @@ NON_IDL_EVENT(underflow,
|
||||
NS_SCROLLPORT_UNDERFLOW,
|
||||
EventNameType_XUL,
|
||||
NS_EVENT_NULL)
|
||||
NON_IDL_EVENT(wheel,
|
||||
NS_WHEEL_WHEEL,
|
||||
EventNameType_XUL,
|
||||
NS_WHEEL_EVENT)
|
||||
|
||||
// Various SVG events
|
||||
NON_IDL_EVENT(SVGLoad,
|
||||
|
176
content/events/src/DOMWheelEvent.cpp
Normal file
176
content/events/src/DOMWheelEvent.cpp
Normal file
@ -0,0 +1,176 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* 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 "DOMWheelEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
||||
DOMCI_DATA(WheelEvent, mozilla::dom::DOMWheelEvent)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
DOMWheelEvent::DOMWheelEvent(nsPresContext* aPresContext,
|
||||
widget::WheelEvent* aWheelEvent)
|
||||
: nsDOMMouseEvent(aPresContext, aWheelEvent ? aWheelEvent :
|
||||
new widget::WheelEvent(false, 0, nullptr))
|
||||
{
|
||||
if (aWheelEvent) {
|
||||
mEventIsInternal = false;
|
||||
} else {
|
||||
mEventIsInternal = true;
|
||||
mEvent->time = PR_Now();
|
||||
mEvent->refPoint.x = mEvent->refPoint.y = 0;
|
||||
static_cast<widget::WheelEvent*>(mEvent)->inputSource =
|
||||
nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
DOMWheelEvent::~DOMWheelEvent()
|
||||
{
|
||||
if (mEventIsInternal && mEvent) {
|
||||
MOZ_ASSERT(mEvent->eventStructType == NS_WHEEL_EVENT,
|
||||
"The mEvent must be WheelEvent");
|
||||
delete static_cast<widget::WheelEvent*>(mEvent);
|
||||
mEvent = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(DOMWheelEvent, nsDOMMouseEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(DOMWheelEvent, nsDOMMouseEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(DOMWheelEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMWheelEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WheelEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMWheelEvent::InitWheelEvent(const nsAString & aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
nsIDOMWindow *aView,
|
||||
PRInt32 aDetail,
|
||||
PRInt32 aScreenX,
|
||||
PRInt32 aScreenY,
|
||||
PRInt32 aClientX,
|
||||
PRInt32 aClientY,
|
||||
PRUint16 aButton,
|
||||
nsIDOMEventTarget *aRelatedTarget,
|
||||
const nsAString& aModifiersList,
|
||||
double aDeltaX,
|
||||
double aDeltaY,
|
||||
double aDeltaZ,
|
||||
PRUint32 aDeltaMode)
|
||||
{
|
||||
nsresult rv =
|
||||
nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable, aView,
|
||||
aDetail, aScreenX, aScreenY,
|
||||
aClientX, aClientY, aButton,
|
||||
aRelatedTarget, aModifiersList);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
widget::WheelEvent* wheelEvent = static_cast<widget::WheelEvent*>(mEvent);
|
||||
wheelEvent->deltaX = aDeltaX;
|
||||
wheelEvent->deltaY = aDeltaY;
|
||||
wheelEvent->deltaZ = aDeltaZ;
|
||||
wheelEvent->deltaMode = aDeltaMode;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMWheelEvent::GetDeltaX(double* aDeltaX)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDeltaX);
|
||||
|
||||
*aDeltaX = static_cast<widget::WheelEvent*>(mEvent)->deltaX;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMWheelEvent::GetDeltaY(double* aDeltaY)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDeltaY);
|
||||
|
||||
*aDeltaY = static_cast<widget::WheelEvent*>(mEvent)->deltaY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMWheelEvent::GetDeltaZ(double* aDeltaZ)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDeltaZ);
|
||||
|
||||
*aDeltaZ = static_cast<widget::WheelEvent*>(mEvent)->deltaZ;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMWheelEvent::GetDeltaMode(PRUint32* aDeltaMode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDeltaMode);
|
||||
|
||||
*aDeltaMode = static_cast<widget::WheelEvent*>(mEvent)->deltaMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DOMWheelEvent::InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal)
|
||||
{
|
||||
WheelEventInit d;
|
||||
nsresult rv = d.Init(aCx, aVal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoString modifierList;
|
||||
if (d.ctrlKey) {
|
||||
modifierList.AppendLiteral(NS_DOM_KEYNAME_CONTROL);
|
||||
}
|
||||
if (d.shiftKey) {
|
||||
if (!modifierList.IsEmpty()) {
|
||||
modifierList.AppendLiteral(" ");
|
||||
}
|
||||
modifierList.AppendLiteral(NS_DOM_KEYNAME_SHIFT);
|
||||
}
|
||||
if (d.altKey) {
|
||||
if (!modifierList.IsEmpty()) {
|
||||
modifierList.AppendLiteral(" ");
|
||||
}
|
||||
modifierList.AppendLiteral(NS_DOM_KEYNAME_ALT);
|
||||
}
|
||||
if (d.metaKey) {
|
||||
if (!modifierList.IsEmpty()) {
|
||||
modifierList.AppendLiteral(" ");
|
||||
}
|
||||
modifierList.AppendLiteral(NS_DOM_KEYNAME_META);
|
||||
}
|
||||
|
||||
rv = InitWheelEvent(aType, d.bubbles, d.cancelable,
|
||||
d.view, d.detail, d.screenX, d.screenY,
|
||||
d.clientX, d.clientY, d.button, d.relatedTarget,
|
||||
modifierList, d.deltaX, d.deltaY, d.deltaZ, d.deltaMode);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
static_cast<widget::WheelEvent*>(mEvent)->buttons = d.buttons;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
nsresult NS_NewDOMWheelEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
widget::WheelEvent *aEvent)
|
||||
{
|
||||
dom::DOMWheelEvent* it = new dom::DOMWheelEvent(aPresContext, aEvent);
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
39
content/events/src/DOMWheelEvent.h
Normal file
39
content/events/src/DOMWheelEvent.h
Normal file
@ -0,0 +1,39 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_dom_DOMWheelEvent_h__
|
||||
#define mozilla_dom_DOMWheelEvent_h__
|
||||
|
||||
#include "nsIDOMWheelEvent.h"
|
||||
#include "nsDOMMouseEvent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DOMWheelEvent : public nsDOMMouseEvent,
|
||||
public nsIDOMWheelEvent
|
||||
{
|
||||
public:
|
||||
DOMWheelEvent(nsPresContext* aPresContext,
|
||||
widget::WheelEvent* aWheelEvent);
|
||||
virtual ~DOMWheelEvent();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMWheelEvent Interface
|
||||
NS_DECL_NSIDOMWHEELEVENT
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMMOUSEEVENT
|
||||
|
||||
virtual nsresult InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_DOMWheelEvent_h__
|
@ -62,6 +62,7 @@ CPPSRCS = \
|
||||
nsDOMAnimationEvent.cpp \
|
||||
nsDOMTouchEvent.cpp \
|
||||
nsDOMCompositionEvent.cpp \
|
||||
DOMWheelEvent.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_B2G_RIL
|
||||
|
@ -52,7 +52,7 @@ static const char* const sEventNames[] = {
|
||||
"DOMNodeRemovedFromDocument", "DOMNodeInsertedIntoDocument",
|
||||
"DOMAttrModified", "DOMCharacterDataModified",
|
||||
"DOMActivate", "DOMFocusIn", "DOMFocusOut",
|
||||
"pageshow", "pagehide", "DOMMouseScroll", "MozMousePixelScroll",
|
||||
"pageshow", "pagehide", "DOMMouseScroll", "MozMousePixelScroll", "wheel",
|
||||
"offline", "online", "copy", "cut", "paste", "open", "message", "show",
|
||||
"SVGLoad", "SVGUnload", "SVGAbort", "SVGError", "SVGResize", "SVGScroll",
|
||||
"SVGZoom",
|
||||
@ -191,6 +191,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMEvent)
|
||||
switch (tmp->mEvent->eventStructType) {
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_WHEEL_EVENT:
|
||||
case NS_SIMPLE_GESTURE_EVENT:
|
||||
case NS_MOZTOUCH_EVENT:
|
||||
static_cast<nsMouseEvent_base*>(tmp->mEvent)->relatedTarget = nullptr;
|
||||
@ -218,6 +219,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEvent)
|
||||
switch (tmp->mEvent->eventStructType) {
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_WHEEL_EVENT:
|
||||
case NS_SIMPLE_GESTURE_EVENT:
|
||||
case NS_MOZTOUCH_EVENT:
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
|
||||
@ -732,6 +734,25 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
newEvent = mouseScrollEvent;
|
||||
break;
|
||||
}
|
||||
case NS_WHEEL_EVENT:
|
||||
{
|
||||
widget::WheelEvent* wheelEvent =
|
||||
new widget::WheelEvent(false, msg, nullptr);
|
||||
isInputEvent = true;
|
||||
widget::WheelEvent* oldWheelEvent =
|
||||
static_cast<widget::WheelEvent*>(mEvent);
|
||||
wheelEvent->deltaX = oldWheelEvent->deltaX;
|
||||
wheelEvent->deltaY = oldWheelEvent->deltaY;
|
||||
wheelEvent->deltaZ = oldWheelEvent->deltaZ;
|
||||
wheelEvent->deltaMode = oldWheelEvent->deltaMode;
|
||||
wheelEvent->relatedTarget = oldWheelEvent->relatedTarget;
|
||||
wheelEvent->button = oldWheelEvent->button;
|
||||
wheelEvent->buttons = oldWheelEvent->buttons;
|
||||
wheelEvent->modifiers = oldWheelEvent->modifiers;
|
||||
wheelEvent->inputSource = oldWheelEvent->inputSource;
|
||||
newEvent = wheelEvent;
|
||||
break;
|
||||
}
|
||||
case NS_SCROLLPORT_EVENT:
|
||||
{
|
||||
newEvent = new nsScrollPortEvent(false, msg, nullptr);
|
||||
@ -1157,6 +1178,7 @@ nsDOMEvent::GetScreenCoords(nsPresContext* aPresContext,
|
||||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
aEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
aEvent->eventStructType != NS_WHEEL_EVENT &&
|
||||
aEvent->eventStructType != NS_MOZTOUCH_EVENT &&
|
||||
aEvent->eventStructType != NS_TOUCH_EVENT &&
|
||||
aEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
@ -1216,6 +1238,7 @@ nsDOMEvent::GetClientCoords(nsPresContext* aPresContext,
|
||||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
aEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
aEvent->eventStructType != NS_WHEEL_EVENT &&
|
||||
aEvent->eventStructType != NS_MOZTOUCH_EVENT &&
|
||||
aEvent->eventStructType != NS_TOUCH_EVENT &&
|
||||
aEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
@ -1390,6 +1413,8 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
|
||||
return sEventNames[eDOMEvents_DOMMouseScroll];
|
||||
case NS_MOUSE_PIXEL_SCROLL:
|
||||
return sEventNames[eDOMEvents_MozMousePixelScroll];
|
||||
case NS_WHEEL_WHEEL:
|
||||
return sEventNames[eDOMEvents_wheel];
|
||||
case NS_OFFLINE:
|
||||
return sEventNames[eDOMEvents_offline];
|
||||
case NS_ONLINE:
|
||||
|
@ -102,6 +102,7 @@ public:
|
||||
eDOMEvents_pagehide,
|
||||
eDOMEvents_DOMMouseScroll,
|
||||
eDOMEvents_MozMousePixelScroll,
|
||||
eDOMEvents_wheel,
|
||||
eDOMEvents_offline,
|
||||
eDOMEvents_online,
|
||||
eDOMEvents_copy,
|
||||
|
@ -85,6 +85,7 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, bool aCanBubble, bool a
|
||||
{
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_WHEEL_EVENT:
|
||||
case NS_DRAG_EVENT:
|
||||
case NS_SIMPLE_GESTURE_EVENT:
|
||||
case NS_MOZTOUCH_EVENT:
|
||||
@ -139,6 +140,7 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString& aType,
|
||||
switch(mEvent->eventStructType) {
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_WHEEL_EVENT:
|
||||
case NS_DRAG_EVENT:
|
||||
case NS_SIMPLE_GESTURE_EVENT:
|
||||
case NS_MOZTOUCH_EVENT:
|
||||
@ -167,6 +169,7 @@ nsDOMMouseEvent::InitFromCtor(const nsAString& aType,
|
||||
switch(mEvent->eventStructType) {
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_WHEEL_EVENT:
|
||||
case NS_DRAG_EVENT:
|
||||
case NS_SIMPLE_GESTURE_EVENT:
|
||||
case NS_MOZTOUCH_EVENT:
|
||||
@ -206,6 +209,7 @@ nsDOMMouseEvent::GetButton(PRUint16* aButton)
|
||||
{
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_WHEEL_EVENT:
|
||||
case NS_DRAG_EVENT:
|
||||
case NS_SIMPLE_GESTURE_EVENT:
|
||||
case NS_MOZTOUCH_EVENT:
|
||||
@ -227,6 +231,7 @@ nsDOMMouseEvent::GetButtons(PRUint16* aButtons)
|
||||
{
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_WHEEL_EVENT:
|
||||
case NS_DRAG_EVENT:
|
||||
case NS_SIMPLE_GESTURE_EVENT:
|
||||
case NS_MOZTOUCH_EVENT:
|
||||
@ -250,6 +255,7 @@ nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
|
||||
{
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_WHEEL_EVENT:
|
||||
case NS_DRAG_EVENT:
|
||||
case NS_SIMPLE_GESTURE_EVENT:
|
||||
case NS_MOZTOUCH_EVENT:
|
||||
|
@ -114,6 +114,7 @@ nsDOMUIEvent::GetMovementPoint()
|
||||
(mEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
mEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
mEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
mEvent->eventStructType != NS_WHEEL_EVENT &&
|
||||
mEvent->eventStructType != NS_MOZTOUCH_EVENT &&
|
||||
mEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
mEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT)) {
|
||||
@ -312,6 +313,7 @@ nsDOMUIEvent::GetLayerPoint()
|
||||
(mEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
mEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
mEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
mEvent->eventStructType != NS_WHEEL_EVENT &&
|
||||
mEvent->eventStructType != NS_MOZTOUCH_EVENT &&
|
||||
mEvent->eventStructType != NS_TOUCH_EVENT &&
|
||||
mEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
aEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
aEvent->eventStructType != NS_WHEEL_EVENT &&
|
||||
aEvent->eventStructType != NS_MOZTOUCH_EVENT &&
|
||||
aEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
aEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT)) {
|
||||
@ -64,6 +65,7 @@ public:
|
||||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
aEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
aEvent->eventStructType != NS_WHEEL_EVENT &&
|
||||
aEvent->eventStructType != NS_MOZTOUCH_EVENT &&
|
||||
aEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
aEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT) ||
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "sampler.h"
|
||||
#include "GeneratedEvents.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
#define NS_TARGET_CHAIN_FORCE_CONTENT_DISPATCH (1 << 0)
|
||||
#define NS_TARGET_CHAIN_WANTS_WILL_HANDLE_EVENT (1 << 1)
|
||||
#define NS_TARGET_CHAIN_MAY_HAVE_MANAGER (1 << 2)
|
||||
@ -734,6 +736,9 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext,
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
return NS_NewDOMMouseScrollEvent(aDOMEvent, aPresContext,
|
||||
static_cast<nsInputEvent*>(aEvent));
|
||||
case NS_WHEEL_EVENT:
|
||||
return NS_NewDOMWheelEvent(aDOMEvent, aPresContext,
|
||||
static_cast<widget::WheelEvent*>(aEvent));
|
||||
case NS_DRAG_EVENT:
|
||||
return NS_NewDOMDragEvent(aDOMEvent, aPresContext,
|
||||
static_cast<nsDragEvent*>(aEvent));
|
||||
|
@ -1029,7 +1029,8 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
if (NS_IS_TRUSTED_EVENT(aEvent) &&
|
||||
((NS_IS_MOUSE_EVENT_STRUCT(aEvent) &&
|
||||
IsMouseEventReal(aEvent)) ||
|
||||
aEvent->eventStructType == NS_MOUSE_SCROLL_EVENT)) {
|
||||
aEvent->eventStructType == NS_MOUSE_SCROLL_EVENT ||
|
||||
aEvent->eventStructType == NS_WHEEL_EVENT)) {
|
||||
if (!sIsPointerLocked) {
|
||||
sLastScreenPoint = nsDOMUIEvent::CalculateScreenPoint(aPresContext, aEvent);
|
||||
sLastClientPoint = nsDOMUIEvent::CalculateClientPoint(aPresContext, aEvent, nullptr);
|
||||
@ -1044,6 +1045,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
aEvent->message != NS_MOUSE_ENTER &&
|
||||
aEvent->message != NS_MOUSE_EXIT) ||
|
||||
aEvent->eventStructType == NS_MOUSE_SCROLL_EVENT ||
|
||||
aEvent->eventStructType == NS_WHEEL_EVENT ||
|
||||
aEvent->eventStructType == NS_KEY_EVENT)) {
|
||||
if (gMouseOrKeyboardEventCounter == 0) {
|
||||
nsCOMPtr<nsIObserverService> obs =
|
||||
@ -1663,6 +1665,10 @@ nsEventStateManager::DispatchCrossProcessEvent(nsEvent* aEvent,
|
||||
nsMouseScrollEvent* scrollEvent = static_cast<nsMouseScrollEvent*>(aEvent);
|
||||
return remote->SendMouseScrollEvent(*scrollEvent);
|
||||
}
|
||||
case NS_WHEEL_EVENT: {
|
||||
widget::WheelEvent* wheelEvent = static_cast<widget::WheelEvent*>(aEvent);
|
||||
return remote->SendMouseWheelEvent(*wheelEvent);
|
||||
}
|
||||
case NS_TOUCH_EVENT: {
|
||||
// Let the child process synthesize a mouse event if needed, and
|
||||
// ensure we don't synthesize one in this process.
|
||||
@ -1711,6 +1717,7 @@ CrossProcessSafeEvent(const nsEvent& aEvent)
|
||||
switch (aEvent.eventStructType) {
|
||||
case NS_KEY_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_WHEEL_EVENT:
|
||||
return true;
|
||||
case NS_MOUSE_EVENT:
|
||||
switch (aEvent.message) {
|
||||
|
@ -84,6 +84,7 @@ MOCHITEST_FILES = \
|
||||
test_bug741666.html \
|
||||
test_dom_keyboard_event.html \
|
||||
test_dom_mouse_event.html \
|
||||
test_dom_wheel_event.html \
|
||||
test_bug603008.html \
|
||||
test_bug716822.html \
|
||||
test_bug742376.html \
|
||||
|
51
content/events/test/test_dom_wheel_event.html
Normal file
51
content/events/test/test_dom_wheel_event.html
Normal file
@ -0,0 +1,51 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for D3E WheelEvent</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(runTests, window);
|
||||
|
||||
function testMakingUntrustedEvent()
|
||||
{
|
||||
const kCreateEventArgs = [
|
||||
"WheelEvent", "wheelevent", "wheelEvent", "Wheelevent"
|
||||
];
|
||||
|
||||
for (var i = 0; i < kCreateEventArgs.length; i++) {
|
||||
try {
|
||||
// We never support WheelEvent construction with document.createEvent().
|
||||
var event = document.createEvent(kCreateEventArgs[i]);
|
||||
ok(false, "document.createEvent(" + kCreateEventArgs[i] + ") should throw an error");
|
||||
} catch (e) {
|
||||
ok(true, "document.createEvent(" + kCreateEventArgs[i] + ") threw an error");
|
||||
}
|
||||
}
|
||||
|
||||
var wheelEvent = new WheelEvent("wheel");
|
||||
ok(wheelEvent instanceof WheelEvent,
|
||||
"new WheelEvent() should create an instance of WheelEvent");
|
||||
ok(typeof(wheelEvent.initWheelEvent) != "function",
|
||||
"WheelEvent must not have initWheelEvent()");
|
||||
}
|
||||
|
||||
function runTests()
|
||||
{
|
||||
testMakingUntrustedEvent();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -451,16 +451,16 @@ try {
|
||||
} catch(exp) {
|
||||
ex = true;
|
||||
}
|
||||
ok(ex, "First parameter is required!");
|
||||
ok(ex, "MouseEvent: First parameter is required!");
|
||||
ex = false;
|
||||
|
||||
e = new MouseEvent("hello");
|
||||
ok(e.type, "hello", "Wrong event type!");
|
||||
ok(!e.isTrusted, "Event shouldn't be trusted!");
|
||||
ok(!e.bubbles, "Event shouldn't bubble!");
|
||||
ok(!e.cancelable, "Event shouldn't be cancelable!");
|
||||
ok(e.type, "hello", "MouseEvent: Wrong event type!");
|
||||
ok(!e.isTrusted, "MouseEvent: Event shouldn't be trusted!");
|
||||
ok(!e.bubbles, "MouseEvent: Event shouldn't bubble!");
|
||||
ok(!e.cancelable, "MouseEvent: Event shouldn't be cancelable!");
|
||||
document.dispatchEvent(e);
|
||||
is(receivedEvent, e, "Wrong event!");
|
||||
is(receivedEvent, e, "MouseEvent: Wrong event!");
|
||||
|
||||
var mouseEventProps =
|
||||
[ { screenX: 0 },
|
||||
@ -494,7 +494,7 @@ var testProps =
|
||||
var defaultMouseEventValues = {};
|
||||
for (var i = 0; i < mouseEventProps.length; ++i) {
|
||||
for (prop in mouseEventProps[i]) {
|
||||
ok(prop in e, "MouseEvent doesn't have property " + prop + "!");
|
||||
ok(prop in e, "MouseEvent: MouseEvent doesn't have property " + prop + "!");
|
||||
defaultMouseEventValues[prop] = mouseEventProps[i][prop];
|
||||
}
|
||||
}
|
||||
@ -504,9 +504,86 @@ while (testProps.length) {
|
||||
e = new MouseEvent("foo", p);
|
||||
for (var def in defaultMouseEventValues) {
|
||||
if (!(def in p)) {
|
||||
is(e[def], defaultMouseEventValues[def], "Wrong default value for " + def + "!");
|
||||
is(e[def], defaultMouseEventValues[def],
|
||||
"MouseEvent: Wrong default value for " + def + "!");
|
||||
} else {
|
||||
is(e[def], p[def], "Wrong event init value for " + def + "!");
|
||||
is(e[def], p[def], "MouseEvent: Wrong event init value for " + def + "!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WheelEvent
|
||||
|
||||
try {
|
||||
e = new WheelEvent();
|
||||
} catch(exp) {
|
||||
ex = true;
|
||||
}
|
||||
ok(ex, "WheelEvent: First parameter is required!");
|
||||
ex = false;
|
||||
|
||||
e = new WheelEvent("hello");
|
||||
ok(e.type, "hello", "WheelEvent: Wrong event type!");
|
||||
ok(!e.isTrusted, "WheelEvent: Event shouldn't be trusted!");
|
||||
ok(!e.bubbles, "WheelEvent: Event shouldn't bubble!");
|
||||
ok(!e.cancelable, "WheelEvent: Event shouldn't be cancelable!");
|
||||
document.dispatchEvent(e);
|
||||
is(receivedEvent, e, "WheelEvent: Wrong event!");
|
||||
|
||||
var wheelEventProps =
|
||||
[ { screenX: 0 },
|
||||
{ screenY: 0 },
|
||||
{ clientX: 0 },
|
||||
{ clientY: 0 },
|
||||
{ ctrlKey: false },
|
||||
{ shiftKey: false },
|
||||
{ altKey: false },
|
||||
{ metaKey: false },
|
||||
{ button: 0 },
|
||||
{ buttons: 0 },
|
||||
{ relatedTarget: null },
|
||||
{ deltaX: 0.0 },
|
||||
{ deltaY: 0.0 },
|
||||
{ deltaZ: 0.0 },
|
||||
{ deltaMode: 0 }
|
||||
];
|
||||
|
||||
var testWheelProps =
|
||||
[
|
||||
{ screenX: 1 },
|
||||
{ screenY: 2 },
|
||||
{ clientX: 3 },
|
||||
{ clientY: 4 },
|
||||
{ ctrlKey: true },
|
||||
{ shiftKey: true },
|
||||
{ altKey: true },
|
||||
{ metaKey: true },
|
||||
{ button: 5 },
|
||||
{ buttons: 6 },
|
||||
{ relatedTarget: window },
|
||||
{ deltaX: 7.8 },
|
||||
{ deltaY: 9.1 },
|
||||
{ deltaZ: 2.3 },
|
||||
{ deltaMode: 4 }
|
||||
];
|
||||
|
||||
var defaultWheelEventValues = {};
|
||||
for (var i = 0; i < wheelEventProps.length; ++i) {
|
||||
for (prop in wheelEventProps[i]) {
|
||||
ok(prop in e, "WheelEvent: WheelEvent doesn't have property " + prop + "!");
|
||||
defaultWheelEventValues[prop] = wheelEventProps[i][prop];
|
||||
}
|
||||
}
|
||||
|
||||
while (testWheelProps.length) {
|
||||
var p = testWheelProps.shift();
|
||||
e = new WheelEvent("foo", p);
|
||||
for (var def in defaultWheelEventValues) {
|
||||
if (!(def in p)) {
|
||||
is(e[def], defaultWheelEventValues[def],
|
||||
"WheelEvent: Wrong default value for " + def + "!");
|
||||
} else {
|
||||
is(e[def], p[def], "WheelEvent: Wrong event init value for " + def + "!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,6 +151,7 @@ NS_NewXBLEventHandler(nsXBLPrototypeHandler* aHandler,
|
||||
case NS_DRAG_EVENT:
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_WHEEL_EVENT:
|
||||
case NS_SIMPLE_GESTURE_EVENT:
|
||||
*aResult = new nsXBLMouseEventHandler(aHandler);
|
||||
break;
|
||||
|
@ -199,6 +199,7 @@
|
||||
#include "nsIDOMCompositionEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMMouseScrollEvent.h"
|
||||
#include "nsIDOMWheelEvent.h"
|
||||
#include "nsIDOMDragEvent.h"
|
||||
#include "nsIDOMCommandEvent.h"
|
||||
#include "nsIDOMPopupBlockedEvent.h"
|
||||
@ -814,6 +815,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(MouseScrollEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(WheelEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(DragEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(KeyboardEvent, nsDOMGenericSH,
|
||||
@ -1749,6 +1752,7 @@ NS_DEFINE_CONTRACT_CTOR(MozActivity, NS_DOMACTIVITY_CONTRACTID)
|
||||
NS_DEFINE_EVENT_CTOR(Event)
|
||||
NS_DEFINE_EVENT_CTOR(UIEvent)
|
||||
NS_DEFINE_EVENT_CTOR(MouseEvent)
|
||||
NS_DEFINE_EVENT_CTOR(WheelEvent)
|
||||
#ifdef MOZ_B2G_RIL
|
||||
NS_DEFINE_EVENT_CTOR(MozWifiStatusChangeEvent)
|
||||
NS_DEFINE_EVENT_CTOR(MozWifiConnectionInfoEvent)
|
||||
@ -1787,6 +1791,7 @@ static const nsConstructorFuncMapData kConstructorFuncMap[] =
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(Event)
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(UIEvent)
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MouseEvent)
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(WheelEvent)
|
||||
#ifdef MOZ_B2G_RIL
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MozWifiStatusChangeEvent)
|
||||
NS_DEFINE_EVENT_CONSTRUCTOR_FUNC_DATA(MozWifiConnectionInfoEvent)
|
||||
@ -2657,6 +2662,12 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(WheelEvent, nsIDOMWheelEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWheelEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMouseEvent)
|
||||
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(DragEvent, nsIDOMDragEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDragEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMouseEvent)
|
||||
|
@ -39,6 +39,7 @@ DOMCI_CLASS(MutationEvent)
|
||||
DOMCI_CLASS(UIEvent)
|
||||
DOMCI_CLASS(MouseEvent)
|
||||
DOMCI_CLASS(MouseScrollEvent)
|
||||
DOMCI_CLASS(WheelEvent)
|
||||
DOMCI_CLASS(DragEvent)
|
||||
DOMCI_CLASS(KeyboardEvent)
|
||||
DOMCI_CLASS(CompositionEvent)
|
||||
|
@ -57,6 +57,7 @@ XPIDLSRCS = \
|
||||
nsIDOMHashChangeEvent.idl \
|
||||
nsIDOMCustomEvent.idl \
|
||||
nsIDOMCompositionEvent.idl \
|
||||
nsIDOMWheelEvent.idl \
|
||||
nsIWifiEventInits.idl \
|
||||
$(NULL)
|
||||
|
||||
|
@ -22,6 +22,11 @@ class nsInvalidateRequestList;
|
||||
namespace IPC {
|
||||
class Message;
|
||||
}
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
class WheelEvent;
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
%}
|
||||
|
||||
/**
|
||||
@ -267,6 +272,8 @@ NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContex
|
||||
nsresult
|
||||
NS_NewDOMMouseScrollEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsInputEvent *aEvent);
|
||||
nsresult
|
||||
NS_NewDOMWheelEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, mozilla::widget::WheelEvent *aEvent);
|
||||
nsresult
|
||||
NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsDragEvent *aEvent);
|
||||
nsresult
|
||||
NS_NewDOMKeyboardEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsKeyEvent *aEvent);
|
||||
|
56
dom/interfaces/events/nsIDOMWheelEvent.idl
Normal file
56
dom/interfaces/events/nsIDOMWheelEvent.idl
Normal file
@ -0,0 +1,56 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* 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 "nsIDOMMouseEvent.idl"
|
||||
|
||||
[scriptable, builtinclass, uuid(5b689c9c-ce82-4836-bb7b-f2fa0c3d2f32)]
|
||||
interface nsIDOMWheelEvent : nsIDOMMouseEvent
|
||||
{
|
||||
const unsigned long DOM_DELTA_PIXEL = 0x00;
|
||||
const unsigned long DOM_DELTA_LINE = 0x01;
|
||||
const unsigned long DOM_DELTA_PAGE = 0x02;
|
||||
|
||||
// Note that DOM Level 3 Events defines the type of delta values as float.
|
||||
// However, we should use double for them. Javascript engine always uses
|
||||
// double even if interface attributes are float. If we defined them
|
||||
// as float, that would cause error at casting from float to double.
|
||||
// E.g., following function may return false if the deltaX is float:
|
||||
//
|
||||
// function () {
|
||||
// var event = new WheelEvent("wheel", { deltaX: 0.1 });
|
||||
// return (event.deltaX == 0.1);
|
||||
// }
|
||||
|
||||
readonly attribute double deltaX;
|
||||
readonly attribute double deltaY;
|
||||
readonly attribute double deltaZ;
|
||||
readonly attribute unsigned long deltaMode;
|
||||
|
||||
[noscript] void initWheelEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in nsIDOMWindow viewArg,
|
||||
in long detailArg,
|
||||
in long screenXArg,
|
||||
in long screenYArg,
|
||||
in long clientXArg,
|
||||
in long clientYArg,
|
||||
in unsigned short buttonArg,
|
||||
in nsIDOMEventTarget relatedTargetArg,
|
||||
in DOMString modifiersListArg,
|
||||
in double deltaXArg,
|
||||
in double deltaYArg,
|
||||
in double deltaZArg,
|
||||
in unsigned long deltaMode);
|
||||
};
|
||||
|
||||
dictionary WheelEventInit : MouseEventInit
|
||||
{
|
||||
double deltaX;
|
||||
double deltaY;
|
||||
double deltaZ;
|
||||
unsigned long deltaMode;
|
||||
};
|
@ -42,6 +42,7 @@ using nsIntSize;
|
||||
using nsKeyEvent;
|
||||
using nsMouseEvent;
|
||||
using nsMouseScrollEvent;
|
||||
using mozilla::widget::WheelEvent;
|
||||
using nsQueryContentEvent;
|
||||
using nsRect;
|
||||
using nsSelectionEvent;
|
||||
@ -306,6 +307,7 @@ child:
|
||||
RealMouseEvent(nsMouseEvent event);
|
||||
RealKeyEvent(nsKeyEvent event);
|
||||
MouseScrollEvent(nsMouseScrollEvent event);
|
||||
MouseWheelEvent(WheelEvent event);
|
||||
RealTouchEvent(nsTouchEvent event);
|
||||
|
||||
/**
|
||||
|
@ -72,6 +72,7 @@ using namespace mozilla::layers;
|
||||
using namespace mozilla::layout;
|
||||
using namespace mozilla::docshell;
|
||||
using namespace mozilla::dom::indexedDB;
|
||||
using namespace mozilla::widget;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(ContentListener, nsIDOMEventListener)
|
||||
|
||||
@ -829,6 +830,14 @@ TabChild::RecvMouseScrollEvent(const nsMouseScrollEvent& event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvMouseWheelEvent(const WheelEvent& event)
|
||||
{
|
||||
WheelEvent localEvent(event);
|
||||
DispatchWidgetEvent(localEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvRealTouchEvent(const nsTouchEvent& aEvent)
|
||||
{
|
||||
|
@ -189,6 +189,7 @@ public:
|
||||
virtual bool RecvRealMouseEvent(const nsMouseEvent& event);
|
||||
virtual bool RecvRealKeyEvent(const nsKeyEvent& event);
|
||||
virtual bool RecvMouseScrollEvent(const nsMouseScrollEvent& event);
|
||||
virtual bool RecvMouseWheelEvent(const mozilla::widget::WheelEvent& event);
|
||||
virtual bool RecvRealTouchEvent(const nsTouchEvent& event);
|
||||
virtual bool RecvKeyEvent(const nsString& aType,
|
||||
const PRInt32& aKeyCode,
|
||||
|
@ -347,6 +347,13 @@ bool TabParent::SendMouseScrollEvent(nsMouseScrollEvent& event)
|
||||
return PBrowserParent::SendMouseScrollEvent(e);
|
||||
}
|
||||
|
||||
bool TabParent::SendMouseWheelEvent(WheelEvent& event)
|
||||
{
|
||||
WheelEvent e(event);
|
||||
MaybeForwardEventToRenderFrame(event, &e);
|
||||
return PBrowserParent::SendMouseWheelEvent(event);
|
||||
}
|
||||
|
||||
bool TabParent::SendRealKeyEvent(nsKeyEvent& event)
|
||||
{
|
||||
nsKeyEvent e(event);
|
||||
|
@ -144,6 +144,7 @@ public:
|
||||
bool aPreventDefault);
|
||||
bool SendRealMouseEvent(nsMouseEvent& event);
|
||||
bool SendMouseScrollEvent(nsMouseScrollEvent& event);
|
||||
bool SendMouseWheelEvent(mozilla::widget::WheelEvent& event);
|
||||
bool SendRealKeyEvent(nsKeyEvent& event);
|
||||
bool SendRealTouchEvent(nsTouchEvent& event);
|
||||
|
||||
|
@ -7,6 +7,7 @@ dictionaries = [
|
||||
[ 'EventInit', 'nsIDOMEvent.idl' ],
|
||||
[ 'UIEventInit', 'nsIDOMUIEvent.idl' ],
|
||||
[ 'MouseEventInit', 'nsIDOMMouseEvent.idl' ],
|
||||
[ 'WheelEventInit', 'nsIDOMWheelEvent.idl' ],
|
||||
[ 'IDBObjectStoreParameters', 'nsIIDBDatabase.idl' ],
|
||||
[ 'IDBIndexParameters', 'nsIIDBObjectStore.idl' ],
|
||||
[ 'BlobPropertyBag', 'nsIDOMFile.idl' ],
|
||||
|
@ -1024,6 +1024,7 @@ nsLayoutUtils::GetEventCoordinatesRelativeTo(const nsEvent* aEvent, nsIFrame* aF
|
||||
{
|
||||
if (!aEvent || (aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
aEvent->eventStructType != NS_WHEEL_EVENT &&
|
||||
aEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
aEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT &&
|
||||
aEvent->eventStructType != NS_GESTURENOTIFY_EVENT &&
|
||||
|
@ -5645,8 +5645,10 @@ PresShell::HandleEvent(nsIFrame *aFrame,
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
nsIContent* capturingContent =
|
||||
NS_IS_MOUSE_EVENT(aEvent) || aEvent->eventStructType == NS_MOUSE_SCROLL_EVENT ?
|
||||
GetCapturingContent() : nullptr;
|
||||
NS_IS_MOUSE_EVENT(aEvent) ||
|
||||
aEvent->eventStructType == NS_MOUSE_SCROLL_EVENT ||
|
||||
aEvent->eventStructType == NS_WHEEL_EVENT ?
|
||||
GetCapturingContent() : nullptr;
|
||||
|
||||
nsCOMPtr<nsIDocument> retargetEventDoc;
|
||||
if (!aDontRetargetEvents) {
|
||||
|
@ -436,7 +436,8 @@ nsXULPopupManager::InitTriggerEvent(nsIDOMEvent* aEvent, nsIContent* aPopup,
|
||||
nsIFrame* rootDocumentRootFrame = rootDocPresContext->
|
||||
PresShell()->FrameManager()->GetRootFrame();
|
||||
if ((event->eventStructType == NS_MOUSE_EVENT ||
|
||||
event->eventStructType == NS_MOUSE_SCROLL_EVENT) &&
|
||||
event->eventStructType == NS_MOUSE_SCROLL_EVENT ||
|
||||
event->eventStructType == NS_WHEEL_EVENT) &&
|
||||
!(static_cast<nsGUIEvent *>(event))->widget) {
|
||||
// no widget, so just use the client point if available
|
||||
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
|
||||
|
@ -618,6 +618,7 @@ KeymapWrapper::InitInputEvent(nsInputEvent& aInputEvent,
|
||||
switch(aInputEvent.eventStructType) {
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_WHEEL_EVENT:
|
||||
case NS_DRAG_EVENT:
|
||||
case NS_SIMPLE_GESTURE_EVENT:
|
||||
case NS_MOZTOUCH_EVENT:
|
||||
|
@ -85,6 +85,8 @@ class nsPluginEvent;
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
class WheelEvent;
|
||||
|
||||
// All modifier keys should be defined here. This is used for managing
|
||||
// modifier states for DOM Level 3 or later.
|
||||
enum Modifier {
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMWheelEvent.h"
|
||||
#include "nsIDOMDataTransfer.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMTouchEvent.h"
|
||||
@ -92,6 +93,7 @@ class nsHashKey;
|
||||
#define NS_MOZTOUCH_EVENT 42
|
||||
#define NS_PLUGIN_EVENT 43
|
||||
#define NS_TOUCH_EVENT 44
|
||||
#define NS_WHEEL_EVENT 45
|
||||
|
||||
// These flags are sort of a mess. They're sort of shared between event
|
||||
// listener flags and event flags, but only some of them. You've been
|
||||
@ -537,6 +539,9 @@ class nsHashKey;
|
||||
#define NS_POINTERLOCKCHANGE (NS_POINTERLOCK_START)
|
||||
#define NS_POINTERLOCKERROR (NS_POINTERLOCK_START + 1)
|
||||
|
||||
#define NS_WHEEL_EVENT_START 5400
|
||||
#define NS_WHEEL_WHEEL (NS_WHEEL_EVENT_START)
|
||||
|
||||
/**
|
||||
* Return status for event processors, nsEventStatus, is defined in
|
||||
* nsEvent.h.
|
||||
@ -1381,6 +1386,42 @@ public:
|
||||
PRInt32 scrollOverflow;
|
||||
};
|
||||
|
||||
/**
|
||||
* WheelEvent is used only for DOM Level 3 WheelEvent (dom::DOMWheelEvent).
|
||||
*/
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
class WheelEvent : public nsMouseEvent_base
|
||||
{
|
||||
private:
|
||||
friend class mozilla::dom::PBrowserParent;
|
||||
friend class mozilla::dom::PBrowserChild;
|
||||
|
||||
WheelEvent()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
WheelEvent(bool aIsTrusted, PRUint32 aMessage, nsIWidget* aWidget) :
|
||||
nsMouseEvent_base(aIsTrusted, aMessage, aWidget, NS_WHEEL_EVENT),
|
||||
deltaX(0.0), deltaY(0.0), deltaZ(0.0),
|
||||
deltaMode(nsIDOMWheelEvent::DOM_DELTA_PIXEL)
|
||||
{
|
||||
}
|
||||
|
||||
double deltaX;
|
||||
double deltaY;
|
||||
double deltaZ;
|
||||
|
||||
// Should be one of nsIDOMWheelEvent::DOM_DELTA_*
|
||||
PRUint32 deltaMode;
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
/*
|
||||
* Gesture Notify Event:
|
||||
*
|
||||
|
@ -117,6 +117,29 @@ struct ParamTraits<nsMouseScrollEvent>
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<mozilla::widget::WheelEvent>
|
||||
{
|
||||
typedef mozilla::widget::WheelEvent paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<nsMouseEvent_base>(aParam));
|
||||
WriteParam(aMsg, aParam.deltaX);
|
||||
WriteParam(aMsg, aParam.deltaY);
|
||||
WriteParam(aMsg, aParam.deltaZ);
|
||||
WriteParam(aMsg, aParam.deltaMode);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, static_cast<nsMouseEvent_base*>(aResult)) &&
|
||||
ReadParam(aMsg, aIter, &aResult->deltaX) &&
|
||||
ReadParam(aMsg, aIter, &aResult->deltaY) &&
|
||||
ReadParam(aMsg, aIter, &aResult->deltaZ) &&
|
||||
ReadParam(aMsg, aIter, &aResult->deltaMode);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<nsMouseEvent>
|
||||
|
@ -115,6 +115,7 @@ ModifierKeyState::InitInputEvent(nsInputEvent& aInputEvent) const
|
||||
switch(aInputEvent.eventStructType) {
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_WHEEL_EVENT:
|
||||
case NS_DRAG_EVENT:
|
||||
case NS_SIMPLE_GESTURE_EVENT:
|
||||
case NS_MOZTOUCH_EVENT:
|
||||
|
Loading…
Reference in New Issue
Block a user