mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 05:37:11 +00:00
8650496cf3
- Bug 1267186 - Split lookup of WebIDL DOM class names from lookup of DOMCI DOM class names. r=bz. (1cb4c3698e) - Bug 1206637: P1. Add MediaPrefs convenience class. r=cpearce (d352b9ca0b) - Bug 1254378 - Make new 'speech-synth-started' component service category. r=smaug (ece851540b) - Bug 1206637: P2. Replace all cached preferences with MediaPrefs ones. r=cpearce (1492083f62) - Bug 1216407 - Use mozilla/Endian.h for NfcService. r=yoshi (b2a508186d) - Bug 1237493 - [NFC] Separate Gecko and Gonk layers for accessing Androids properties. r=yoshi (062e468bed) - Bug 1272135, part 1 - Fix leading tab usage in ipc/chromium. r=billm (cf29df6977) - Bug 1272135, part 2 - Delete two weird modelines in ipc/chromium. r=billm (da4cdafc7c) - Bug 1272135, part 3 - Fix mode lines in ipc/chromium/. r=billm (040b11738e) - Bug 1273307 - Remove copy constructor/assignment operator for Message/Pickle (r=froydnj) (b53e6d3470) - Bug 1262671 - Remove unused TrimWriteData (r=froydnj) (8fbcefde63) - Bug 1267438 - Group ScrollMetadata's optional clip rect and mask layer index into a LayerClip structure. r=mstange (dcd01e3bce) - Bug 1267438 - Use IntersectMaybeRects() in Layer::GetCombinedClipRect(). r=mstange (5ec2d68aac) - Bug 1262937 - part 1 - don't include the protocol name in Clone error messages; r=jld (3e23610fb1) - Bug 1191452 - Limit IPDL-generated Move()s to Recv methods. r=billm (991cc733b6) - Bug 1262937 - part 2 - don't include the message name when complaining about handler failure; r=jld (b8abbc5c8b) - Bug 1262937 - part 3 - move quoting out of checkedRead; r=jld (16d36ae02a) - Bug 1262937 - part 4 - publically inherit from MessageListener in IProtocol; r=jld (b89aaa7347) - Bug 1262937 - part 5 - factor out actor reading code to a common base class; r=jld (702388bce7) - Bug 1262937 - part 7 - factor out union type deserialization errors; r=jld (dcdf428efc) - Bug 1262937 - part 6 - enable custom error message for ipdl.py's checkedRead; r=jld (5cf11d5d24) - Bug 1262937 - part 8 - factor out array length deserialization errors; r=jld (d1149cc120) - Bug 1271601: If a child process fails to duplicate a TransportDescriptor pipe handle then send it anyway and get the target to duplicate. r=gabor (d578cd0c85) - Bug 1270247 - Crash in ParamTraits<mozilla::net::NetAddr>::Write if the family is unknown. r=hurley (3ed49495c0) - Bug 1267474 - cache-control: immutable tests 3/3 r=mayhemer (ba0bc6e71a) - bug 1188100 - fold PSM's test_client_cert.js into necko's test_tls_server.js r=mcmanus (a2b93abbbb) - Bug 669259 - Expose original header received from a peer. r=mcmanus (cf53cad7ac) - Bug 386743 - Set default event bubbling/cancelable flags in the WidgetEvent constructor. r=smaug (1c68cfffd2) - Bug 1259661 part.1 Rename WidgetMouseEvent::reasonType to WidgetMouseEvent::Reason r=smaug (0edd107b56) - Bug 1259661 part.2 Rename WidgetMouseEvent::context to WidgetMouseEvent::ContextMenuTrigger r=smaug (0049757099) - Bug 1259661 part.3 Rename WidgetMouseEvent::exitType to WidgetMouseEvent::ExitFrom r=smaug (5ffd3f41b1) - Bug 1259661 part.4 Rename WidgetMouseEvent::reason to WidgetMouseEvent::mReason r=smaug (5605ce8fd0) - Bug 1259661 part.5 Rename WidgetMouseEvent::context to WidgetMouseEvent::mContextMenuTrigger r=smaug (4dd92f0066) - Bug 1259661 part.6 Rename WidgetMouseEvent::exit to WidgetMouseEvent::mExitFrom r=smaug (c46f5fe1bc) - Bug 1259661 part.7 Get rid of WidgetMouseEvent::acceptActivation because of unused r=smaug (4867aaf1a7) - Bug 1259661 part.8 Rename WidgetMouseEvent::ignoreRootScrollFrame to WidgetMouseEvent::mIgnoreRootScrollFrame r=smaug (c829c446fd) - Bug 1259661 part.9 Rename WidgetMouseEvent::clickCount to WidgetMouseEvent::mClickCount r=smaug (2fa015c006) - Bug 1259661 part.10 Clean up some nits of WidgetMouseEvent definition r=smaug (58d3a0cb2c) - Bug 1179346 - Add strings and accesskeys for Microsoft Edge. r=mak (b97f5e7ab4) - Bug 931445 part 1 - Remove unused code from pointerlock_utils.js. r=smaug (e1b9c15569) - Bug 931445 part 2 - Use util code from fullscreen tests to improve robustness of pointerlock tests. r=smaug (3c7b47751e) - Bug 931445 part 3 - Reset synth centering pointer when unlocking pointer. r=smaug (e272fec9c7) - Bug 1263389 NativeKey should initialize WidgetKeyboardEvent::mKeyValue of WM_KEYDOWN of VK_PACKET with following char message r=m_kato (e56a31bd4b) - Bug 1261880 NativeKey should decide printable KeyboardEvent.key value of keydown and keypress events with following WM_CHAR message of WM_KEYDOWN r=m_kato (7208001852) - Bug 1254755 part.1 Rename WidgetKeyboardEvent::keyCode to WidgetKeyboardEvent::mKeyCode r=smaug (97ebefa314) - put back some XP/2003 code, as well as crash/debug (73b3147e58) - Bug 1259679 - Space key shouldn't work as a space key if it's assigned to a function key. r=masayuki (db422c248b) - Bug 1101975, handle access keys in content process before menus, r=masayuki (760213b62e) - Bug 1254755 part.2 Rename WidgetKeyboardEvent::charCode to WidgetKeyboardEvent::mCharCode r=smaug (6cef6114a5) - Bug 1254755 part.3 Rename WidgetKeyboardEvent::alternativeCharCodes to WidgetKeyboardEvent::mAlternativeCharCodes r=smaug (9d23a113fd) - Bug 1254755 part.4 Rename WidgetKeyboardEvent::location to WidgetKeyboardEvent::mLocation r=smaug (f44e0212a6) - Bug 1254755 part.5 Rename WidgetKeyboardEvent::isChar to WidgetKeyboardEvent::mIsChar r=smaug (a713d9903c) - Bug 1254755 part.6 Reorder the members of WidgetKeyboardEvent for reducing its instance size r=smaug (39a14a7d4f) - Bug 1262671 - void** -> PickleIterator (r=froydnj) (716a88b499)
537 lines
14 KiB
C++
537 lines
14 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=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 "mozilla/dom/MouseEvent.h"
|
|
#include "mozilla/MouseEvents.h"
|
|
#include "nsContentUtils.h"
|
|
#include "nsIContent.h"
|
|
#include "prtime.h"
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
|
|
MouseEvent::MouseEvent(EventTarget* aOwner,
|
|
nsPresContext* aPresContext,
|
|
WidgetMouseEventBase* aEvent)
|
|
: UIEvent(aOwner, aPresContext,
|
|
aEvent ? aEvent :
|
|
new WidgetMouseEvent(false, eVoidEvent, nullptr,
|
|
WidgetMouseEvent::eReal))
|
|
{
|
|
// There's no way to make this class' ctor allocate an WidgetMouseScrollEvent.
|
|
// It's not that important, though, since a scroll event is not a real
|
|
// DOM event.
|
|
|
|
WidgetMouseEvent* mouseEvent = mEvent->AsMouseEvent();
|
|
if (aEvent) {
|
|
mEventIsInternal = false;
|
|
}
|
|
else {
|
|
mEventIsInternal = true;
|
|
mEvent->mTime = PR_Now();
|
|
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
|
|
mouseEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
|
|
}
|
|
|
|
if (mouseEvent) {
|
|
MOZ_ASSERT(mouseEvent->mReason != WidgetMouseEvent::eSynthesized,
|
|
"Don't dispatch DOM events from synthesized mouse events");
|
|
mDetail = mouseEvent->mClickCount;
|
|
}
|
|
}
|
|
|
|
NS_IMPL_ADDREF_INHERITED(MouseEvent, UIEvent)
|
|
NS_IMPL_RELEASE_INHERITED(MouseEvent, UIEvent)
|
|
|
|
NS_INTERFACE_MAP_BEGIN(MouseEvent)
|
|
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
|
|
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
|
|
|
void
|
|
MouseEvent::InitMouseEvent(const nsAString& aType,
|
|
bool aCanBubble,
|
|
bool aCancelable,
|
|
nsGlobalWindow* aView,
|
|
int32_t aDetail,
|
|
int32_t aScreenX,
|
|
int32_t aScreenY,
|
|
int32_t aClientX,
|
|
int32_t aClientY,
|
|
bool aCtrlKey,
|
|
bool aAltKey,
|
|
bool aShiftKey,
|
|
bool aMetaKey,
|
|
uint16_t aButton,
|
|
EventTarget* aRelatedTarget)
|
|
{
|
|
UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
|
|
|
|
switch(mEvent->mClass) {
|
|
case eMouseEventClass:
|
|
case eMouseScrollEventClass:
|
|
case eWheelEventClass:
|
|
case eDragEventClass:
|
|
case ePointerEventClass:
|
|
case eSimpleGestureEventClass: {
|
|
WidgetMouseEventBase* mouseEventBase = mEvent->AsMouseEventBase();
|
|
mouseEventBase->relatedTarget = aRelatedTarget;
|
|
mouseEventBase->button = aButton;
|
|
mouseEventBase->InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey, aMetaKey);
|
|
mClientPoint.x = aClientX;
|
|
mClientPoint.y = aClientY;
|
|
mouseEventBase->mRefPoint.x = aScreenX;
|
|
mouseEventBase->mRefPoint.y = aScreenY;
|
|
|
|
WidgetMouseEvent* mouseEvent = mEvent->AsMouseEvent();
|
|
if (mouseEvent) {
|
|
mouseEvent->mClickCount = aDetail;
|
|
}
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::InitMouseEvent(const nsAString& aType,
|
|
bool aCanBubble,
|
|
bool aCancelable,
|
|
mozIDOMWindow* aView,
|
|
int32_t aDetail,
|
|
int32_t aScreenX,
|
|
int32_t aScreenY,
|
|
int32_t aClientX,
|
|
int32_t aClientY,
|
|
bool aCtrlKey,
|
|
bool aAltKey,
|
|
bool aShiftKey,
|
|
bool aMetaKey,
|
|
uint16_t aButton,
|
|
nsIDOMEventTarget* aRelatedTarget)
|
|
{
|
|
MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
|
|
nsGlobalWindow::Cast(aView), aDetail,
|
|
aScreenX, aScreenY,
|
|
aClientX, aClientY,
|
|
aCtrlKey, aAltKey, aShiftKey,
|
|
aMetaKey, aButton,
|
|
static_cast<EventTarget *>(aRelatedTarget));
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
void
|
|
MouseEvent::InitMouseEvent(const nsAString& aType,
|
|
bool aCanBubble,
|
|
bool aCancelable,
|
|
nsGlobalWindow* aView,
|
|
int32_t aDetail,
|
|
int32_t aScreenX,
|
|
int32_t aScreenY,
|
|
int32_t aClientX,
|
|
int32_t aClientY,
|
|
int16_t aButton,
|
|
EventTarget* aRelatedTarget,
|
|
const nsAString& aModifiersList)
|
|
{
|
|
Modifiers modifiers = ComputeModifierState(aModifiersList);
|
|
|
|
InitMouseEvent(aType, aCanBubble, aCancelable, aView, aDetail,
|
|
aScreenX, aScreenY, aClientX, aClientY,
|
|
(modifiers & MODIFIER_CONTROL) != 0,
|
|
(modifiers & MODIFIER_ALT) != 0,
|
|
(modifiers & MODIFIER_SHIFT) != 0,
|
|
(modifiers & MODIFIER_META) != 0,
|
|
aButton, aRelatedTarget);
|
|
|
|
switch(mEvent->mClass) {
|
|
case eMouseEventClass:
|
|
case eMouseScrollEventClass:
|
|
case eWheelEventClass:
|
|
case eDragEventClass:
|
|
case ePointerEventClass:
|
|
case eSimpleGestureEventClass:
|
|
mEvent->AsInputEvent()->mModifiers = modifiers;
|
|
return;
|
|
default:
|
|
MOZ_CRASH("There is no space to store the modifiers");
|
|
}
|
|
}
|
|
|
|
void
|
|
MouseEvent::InitializeExtraMouseEventDictionaryMembers(const MouseEventInit& aParam)
|
|
{
|
|
InitModifiers(aParam);
|
|
mEvent->AsMouseEventBase()->buttons = aParam.mButtons;
|
|
mMovementPoint.x = aParam.mMovementX;
|
|
mMovementPoint.y = aParam.mMovementY;
|
|
}
|
|
|
|
already_AddRefed<MouseEvent>
|
|
MouseEvent::Constructor(const GlobalObject& aGlobal,
|
|
const nsAString& aType,
|
|
const MouseEventInit& aParam,
|
|
ErrorResult& aRv)
|
|
{
|
|
nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
|
|
RefPtr<MouseEvent> e = new MouseEvent(t, nullptr, nullptr);
|
|
bool trusted = e->Init(t);
|
|
e->InitMouseEvent(aType, aParam.mBubbles, aParam.mCancelable,
|
|
aParam.mView, aParam.mDetail, aParam.mScreenX,
|
|
aParam.mScreenY, aParam.mClientX, aParam.mClientY,
|
|
aParam.mCtrlKey, aParam.mAltKey, aParam.mShiftKey,
|
|
aParam.mMetaKey, aParam.mButton, aParam.mRelatedTarget);
|
|
e->InitializeExtraMouseEventDictionaryMembers(aParam);
|
|
e->SetTrusted(trusted);
|
|
|
|
return e.forget();
|
|
}
|
|
|
|
void
|
|
MouseEvent::InitNSMouseEvent(const nsAString& aType,
|
|
bool aCanBubble,
|
|
bool aCancelable,
|
|
nsGlobalWindow* aView,
|
|
int32_t aDetail,
|
|
int32_t aScreenX,
|
|
int32_t aScreenY,
|
|
int32_t aClientX,
|
|
int32_t aClientY,
|
|
bool aCtrlKey,
|
|
bool aAltKey,
|
|
bool aShiftKey,
|
|
bool aMetaKey,
|
|
uint16_t aButton,
|
|
EventTarget* aRelatedTarget,
|
|
float aPressure,
|
|
uint16_t aInputSource)
|
|
{
|
|
MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
|
|
aView, aDetail, aScreenX, aScreenY,
|
|
aClientX, aClientY,
|
|
aCtrlKey, aAltKey, aShiftKey,
|
|
aMetaKey, aButton, aRelatedTarget);
|
|
|
|
WidgetMouseEventBase* mouseEventBase = mEvent->AsMouseEventBase();
|
|
mouseEventBase->pressure = aPressure;
|
|
mouseEventBase->inputSource = aInputSource;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetButton(int16_t* aButton)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aButton);
|
|
*aButton = Button();
|
|
return NS_OK;
|
|
}
|
|
|
|
int16_t
|
|
MouseEvent::Button()
|
|
{
|
|
switch(mEvent->mClass) {
|
|
case eMouseEventClass:
|
|
case eMouseScrollEventClass:
|
|
case eWheelEventClass:
|
|
case eDragEventClass:
|
|
case ePointerEventClass:
|
|
case eSimpleGestureEventClass:
|
|
return mEvent->AsMouseEventBase()->button;
|
|
default:
|
|
NS_WARNING("Tried to get mouse button for non-mouse event!");
|
|
return WidgetMouseEvent::eLeftButton;
|
|
}
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetButtons(uint16_t* aButtons)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aButtons);
|
|
*aButtons = Buttons();
|
|
return NS_OK;
|
|
}
|
|
|
|
uint16_t
|
|
MouseEvent::Buttons()
|
|
{
|
|
switch(mEvent->mClass) {
|
|
case eMouseEventClass:
|
|
case eMouseScrollEventClass:
|
|
case eWheelEventClass:
|
|
case eDragEventClass:
|
|
case ePointerEventClass:
|
|
case eSimpleGestureEventClass:
|
|
return mEvent->AsMouseEventBase()->buttons;
|
|
default:
|
|
MOZ_CRASH("Tried to get mouse buttons for non-mouse event!");
|
|
}
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aRelatedTarget);
|
|
*aRelatedTarget = GetRelatedTarget().take();
|
|
return NS_OK;
|
|
}
|
|
|
|
already_AddRefed<EventTarget>
|
|
MouseEvent::GetRelatedTarget()
|
|
{
|
|
nsCOMPtr<EventTarget> relatedTarget;
|
|
switch(mEvent->mClass) {
|
|
case eMouseEventClass:
|
|
case eMouseScrollEventClass:
|
|
case eWheelEventClass:
|
|
case eDragEventClass:
|
|
case ePointerEventClass:
|
|
case eSimpleGestureEventClass:
|
|
relatedTarget =
|
|
do_QueryInterface(mEvent->AsMouseEventBase()->relatedTarget);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
if (relatedTarget) {
|
|
nsCOMPtr<nsIContent> content = do_QueryInterface(relatedTarget);
|
|
nsCOMPtr<nsIContent> currentTarget =
|
|
do_QueryInterface(mEvent->mCurrentTarget);
|
|
|
|
nsIContent* shadowRelatedTarget = GetShadowRelatedTarget(currentTarget, content);
|
|
if (shadowRelatedTarget) {
|
|
relatedTarget = shadowRelatedTarget;
|
|
}
|
|
|
|
if (content && content->ChromeOnlyAccess() &&
|
|
!nsContentUtils::CanAccessNativeAnon()) {
|
|
relatedTarget = do_QueryInterface(content->FindFirstNonChromeOnlyAccessContent());
|
|
}
|
|
|
|
if (relatedTarget) {
|
|
relatedTarget = relatedTarget->GetTargetForDOMEvent();
|
|
}
|
|
return relatedTarget.forget();
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
void
|
|
MouseEvent::GetRegion(nsAString& aRegion)
|
|
{
|
|
SetDOMStringToNull(aRegion);
|
|
WidgetMouseEventBase* mouseEventBase = mEvent->AsMouseEventBase();
|
|
if (mouseEventBase) {
|
|
aRegion = mouseEventBase->region;
|
|
}
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetMozMovementX(int32_t* aMovementX)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aMovementX);
|
|
*aMovementX = MovementX();
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetMozMovementY(int32_t* aMovementY)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aMovementY);
|
|
*aMovementY = MovementY();
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetScreenX(int32_t* aScreenX)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aScreenX);
|
|
*aScreenX = ScreenX();
|
|
return NS_OK;
|
|
}
|
|
|
|
int32_t
|
|
MouseEvent::ScreenX()
|
|
{
|
|
return Event::GetScreenCoords(mPresContext, mEvent, mEvent->mRefPoint).x;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetScreenY(int32_t* aScreenY)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aScreenY);
|
|
*aScreenY = ScreenY();
|
|
return NS_OK;
|
|
}
|
|
|
|
int32_t
|
|
MouseEvent::ScreenY()
|
|
{
|
|
return Event::GetScreenCoords(mPresContext, mEvent, mEvent->mRefPoint).y;
|
|
}
|
|
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetClientX(int32_t* aClientX)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aClientX);
|
|
*aClientX = ClientX();
|
|
return NS_OK;
|
|
}
|
|
|
|
int32_t
|
|
MouseEvent::ClientX()
|
|
{
|
|
return Event::GetClientCoords(mPresContext, mEvent, mEvent->mRefPoint,
|
|
mClientPoint).x;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetClientY(int32_t* aClientY)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aClientY);
|
|
*aClientY = ClientY();
|
|
return NS_OK;
|
|
}
|
|
|
|
int32_t
|
|
MouseEvent::ClientY()
|
|
{
|
|
return Event::GetClientCoords(mPresContext, mEvent, mEvent->mRefPoint,
|
|
mClientPoint).y;
|
|
}
|
|
|
|
int32_t
|
|
MouseEvent::OffsetX()
|
|
{
|
|
return Event::GetOffsetCoords(mPresContext, mEvent, mEvent->mRefPoint,
|
|
mClientPoint).x;
|
|
}
|
|
|
|
int32_t
|
|
MouseEvent::OffsetY()
|
|
{
|
|
return Event::GetOffsetCoords(mPresContext, mEvent, mEvent->mRefPoint,
|
|
mClientPoint).y;
|
|
}
|
|
|
|
bool
|
|
MouseEvent::AltKey()
|
|
{
|
|
return mEvent->AsInputEvent()->IsAlt();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetAltKey(bool* aIsDown)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aIsDown);
|
|
*aIsDown = AltKey();
|
|
return NS_OK;
|
|
}
|
|
|
|
bool
|
|
MouseEvent::CtrlKey()
|
|
{
|
|
return mEvent->AsInputEvent()->IsControl();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetCtrlKey(bool* aIsDown)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aIsDown);
|
|
*aIsDown = CtrlKey();
|
|
return NS_OK;
|
|
}
|
|
|
|
bool
|
|
MouseEvent::ShiftKey()
|
|
{
|
|
return mEvent->AsInputEvent()->IsShift();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetShiftKey(bool* aIsDown)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aIsDown);
|
|
*aIsDown = ShiftKey();
|
|
return NS_OK;
|
|
}
|
|
|
|
bool
|
|
MouseEvent::MetaKey()
|
|
{
|
|
return mEvent->AsInputEvent()->IsMeta();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetMetaKey(bool* aIsDown)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aIsDown);
|
|
*aIsDown = MetaKey();
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetModifierState(const nsAString& aKey,
|
|
bool* aState)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aState);
|
|
|
|
*aState = GetModifierState(aKey);
|
|
return NS_OK;
|
|
}
|
|
|
|
float
|
|
MouseEvent::MozPressure() const
|
|
{
|
|
return mEvent->AsMouseEventBase()->pressure;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetMozPressure(float* aPressure)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aPressure);
|
|
*aPressure = MozPressure();
|
|
return NS_OK;
|
|
}
|
|
|
|
bool
|
|
MouseEvent::HitCluster() const
|
|
{
|
|
return mEvent->AsMouseEventBase()->hitCluster;
|
|
}
|
|
|
|
uint16_t
|
|
MouseEvent::MozInputSource() const
|
|
{
|
|
return mEvent->AsMouseEventBase()->inputSource;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
MouseEvent::GetMozInputSource(uint16_t* aInputSource)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(aInputSource);
|
|
*aInputSource = MozInputSource();
|
|
return NS_OK;
|
|
}
|
|
|
|
} // namespace dom
|
|
} // namespace mozilla
|
|
|
|
using namespace mozilla;
|
|
using namespace mozilla::dom;
|
|
|
|
already_AddRefed<MouseEvent>
|
|
NS_NewDOMMouseEvent(EventTarget* aOwner,
|
|
nsPresContext* aPresContext,
|
|
WidgetMouseEvent* aEvent)
|
|
{
|
|
RefPtr<MouseEvent> it = new MouseEvent(aOwner, aPresContext, aEvent);
|
|
return it.forget();
|
|
}
|