2013-05-21 23:23:53 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
2011-04-26 12:30:17 +00:00
|
|
|
|
2016-07-18 14:26:38 +00:00
|
|
|
#include "mozilla/dom/Navigator.h"
|
2014-02-28 14:58:42 +00:00
|
|
|
#include "mozilla/dom/TouchEvent.h"
|
2013-04-05 08:49:00 +00:00
|
|
|
#include "mozilla/dom/Touch.h"
|
2013-07-10 09:53:53 +00:00
|
|
|
#include "mozilla/dom/TouchListBinding.h"
|
2014-02-28 14:58:42 +00:00
|
|
|
#include "mozilla/Preferences.h"
|
2013-09-25 11:21:16 +00:00
|
|
|
#include "mozilla/TouchEvents.h"
|
2014-02-28 14:58:42 +00:00
|
|
|
#include "nsContentUtils.h"
|
2016-07-18 14:26:38 +00:00
|
|
|
#include "nsIDocShell.h"
|
2015-05-08 01:29:00 +00:00
|
|
|
#include "mozilla/WidgetUtils.h"
|
2011-05-25 06:31:59 +00:00
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
namespace dom {
|
2011-04-26 12:30:17 +00:00
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* TouchList
|
|
|
|
*****************************************************************************/
|
2011-04-26 12:30:17 +00:00
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TouchList)
|
2013-07-10 09:53:53 +00:00
|
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
2011-04-26 12:30:17 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
2014-04-29 08:57:00 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TouchList, mParent, mPoints)
|
2011-04-26 12:30:17 +00:00
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(TouchList)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(TouchList)
|
2011-04-26 12:30:17 +00:00
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
JSObject*
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 14:13:33 +00:00
|
|
|
TouchList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-07-10 09:53:53 +00:00
|
|
|
{
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 14:13:33 +00:00
|
|
|
return TouchListBinding::Wrap(aCx, this, aGivenProto);
|
2013-07-10 09:53:53 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
// static
|
|
|
|
bool
|
|
|
|
TouchList::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
|
2013-07-10 09:53:53 +00:00
|
|
|
{
|
2014-02-28 14:58:42 +00:00
|
|
|
return TouchEvent::PrefEnabled(aCx, aGlobal);
|
2013-07-10 09:53:53 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* TouchEvent
|
|
|
|
*****************************************************************************/
|
2011-04-26 12:30:17 +00:00
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
TouchEvent::TouchEvent(EventTarget* aOwner,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
WidgetTouchEvent* aEvent)
|
2014-02-28 14:58:43 +00:00
|
|
|
: UIEvent(aOwner, aPresContext,
|
2015-08-26 12:56:59 +00:00
|
|
|
aEvent ? aEvent :
|
2015-08-28 23:58:26 +00:00
|
|
|
new WidgetTouchEvent(false, eVoidEvent, nullptr))
|
2011-04-26 12:30:17 +00:00
|
|
|
{
|
|
|
|
if (aEvent) {
|
2011-10-17 14:59:28 +00:00
|
|
|
mEventIsInternal = false;
|
2011-12-17 00:24:11 +00:00
|
|
|
|
2016-03-30 09:44:28 +00:00
|
|
|
for (uint32_t i = 0; i < aEvent->mTouches.Length(); ++i) {
|
|
|
|
Touch* touch = aEvent->mTouches[i];
|
2013-08-02 07:06:35 +00:00
|
|
|
touch->InitializePoints(mPresContext, aEvent);
|
2011-12-17 00:24:11 +00:00
|
|
|
}
|
2011-04-26 12:30:17 +00:00
|
|
|
} else {
|
2011-10-17 14:59:28 +00:00
|
|
|
mEventIsInternal = true;
|
2016-03-28 04:29:42 +00:00
|
|
|
mEvent->mTime = PR_Now();
|
2011-04-26 12:30:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-25 16:49:00 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_INHERITED(TouchEvent, UIEvent,
|
|
|
|
mTouches,
|
|
|
|
mTargetTouches,
|
|
|
|
mChangedTouches)
|
2011-04-26 12:30:17 +00:00
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TouchEvent)
|
2014-02-28 14:58:43 +00:00
|
|
|
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
2011-04-26 12:30:17 +00:00
|
|
|
|
2014-02-28 14:58:43 +00:00
|
|
|
NS_IMPL_ADDREF_INHERITED(TouchEvent, UIEvent)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(TouchEvent, UIEvent)
|
2011-04-26 12:30:17 +00:00
|
|
|
|
2013-08-05 04:51:21 +00:00
|
|
|
void
|
2014-02-28 14:58:42 +00:00
|
|
|
TouchEvent::InitTouchEvent(const nsAString& aType,
|
|
|
|
bool aCanBubble,
|
|
|
|
bool aCancelable,
|
2016-01-30 17:05:36 +00:00
|
|
|
nsGlobalWindow* aView,
|
2014-02-28 14:58:42 +00:00
|
|
|
int32_t aDetail,
|
|
|
|
bool aCtrlKey,
|
|
|
|
bool aAltKey,
|
|
|
|
bool aShiftKey,
|
|
|
|
bool aMetaKey,
|
|
|
|
TouchList* aTouches,
|
|
|
|
TouchList* aTargetTouches,
|
2015-11-13 00:09:42 +00:00
|
|
|
TouchList* aChangedTouches)
|
2013-08-05 04:51:21 +00:00
|
|
|
{
|
2016-10-30 19:30:06 +00:00
|
|
|
NS_ENSURE_TRUE_VOID(!mEvent->mFlags.mIsBeingDispatched);
|
|
|
|
|
2015-11-13 00:09:42 +00:00
|
|
|
UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
|
2013-10-18 06:10:26 +00:00
|
|
|
mEvent->AsInputEvent()->InitBasicModifiers(aCtrlKey, aAltKey,
|
|
|
|
aShiftKey, aMetaKey);
|
2013-08-05 04:51:21 +00:00
|
|
|
mTouches = aTouches;
|
|
|
|
mTargetTouches = aTargetTouches;
|
|
|
|
mChangedTouches = aChangedTouches;
|
2013-04-26 06:48:00 +00:00
|
|
|
}
|
2011-12-17 00:24:11 +00:00
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
TouchList*
|
|
|
|
TouchEvent::Touches()
|
2013-04-26 06:48:00 +00:00
|
|
|
{
|
|
|
|
if (!mTouches) {
|
2013-10-18 06:10:23 +00:00
|
|
|
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
|
2015-09-14 15:14:35 +00:00
|
|
|
if (mEvent->mMessage == eTouchEnd || mEvent->mMessage == eTouchCancel) {
|
2016-03-30 09:44:28 +00:00
|
|
|
// for touchend events, remove any changed touches from mTouches
|
2014-07-09 16:17:05 +00:00
|
|
|
WidgetTouchEvent::AutoTouchArray unchangedTouches;
|
2016-03-30 09:44:28 +00:00
|
|
|
const WidgetTouchEvent::TouchArray& touches = touchEvent->mTouches;
|
2013-04-26 06:48:00 +00:00
|
|
|
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
|
|
|
if (!touches[i]->mChanged) {
|
|
|
|
unchangedTouches.AppendElement(touches[i]);
|
|
|
|
}
|
2011-12-17 00:24:11 +00:00
|
|
|
}
|
2014-02-28 14:58:42 +00:00
|
|
|
mTouches = new TouchList(ToSupports(this), unchangedTouches);
|
2013-04-26 06:48:00 +00:00
|
|
|
} else {
|
2016-03-30 09:44:28 +00:00
|
|
|
mTouches = new TouchList(ToSupports(this), touchEvent->mTouches);
|
2011-12-17 00:24:11 +00:00
|
|
|
}
|
|
|
|
}
|
2013-04-26 06:48:00 +00:00
|
|
|
return mTouches;
|
2011-04-26 12:30:17 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
TouchList*
|
|
|
|
TouchEvent::TargetTouches()
|
2013-04-26 06:48:00 +00:00
|
|
|
{
|
|
|
|
if (!mTargetTouches) {
|
2014-07-09 16:17:05 +00:00
|
|
|
WidgetTouchEvent::AutoTouchArray targetTouches;
|
2013-10-18 06:10:23 +00:00
|
|
|
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
|
2016-03-30 09:44:28 +00:00
|
|
|
const WidgetTouchEvent::TouchArray& touches = touchEvent->mTouches;
|
2013-04-26 06:48:00 +00:00
|
|
|
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
|
|
|
// for touchend/cancel events, don't append to the target list if this is a
|
|
|
|
// touch that is ending
|
2015-09-14 15:14:35 +00:00
|
|
|
if ((mEvent->mMessage != eTouchEnd && mEvent->mMessage != eTouchCancel) ||
|
|
|
|
!touches[i]->mChanged) {
|
2016-04-18 16:33:23 +00:00
|
|
|
if (touches[i]->mTarget == mEvent->mOriginalTarget) {
|
2013-04-26 06:48:00 +00:00
|
|
|
targetTouches.AppendElement(touches[i]);
|
|
|
|
}
|
2011-12-17 00:24:11 +00:00
|
|
|
}
|
|
|
|
}
|
2014-02-28 14:58:42 +00:00
|
|
|
mTargetTouches = new TouchList(ToSupports(this), targetTouches);
|
2011-12-17 00:24:11 +00:00
|
|
|
}
|
2013-04-26 06:48:00 +00:00
|
|
|
return mTargetTouches;
|
2011-04-26 12:30:17 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
TouchList*
|
|
|
|
TouchEvent::ChangedTouches()
|
2013-04-26 06:48:00 +00:00
|
|
|
{
|
|
|
|
if (!mChangedTouches) {
|
2014-07-09 16:17:05 +00:00
|
|
|
WidgetTouchEvent::AutoTouchArray changedTouches;
|
2013-10-18 06:10:23 +00:00
|
|
|
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
|
2016-03-30 09:44:28 +00:00
|
|
|
const WidgetTouchEvent::TouchArray& touches = touchEvent->mTouches;
|
2013-04-26 06:48:00 +00:00
|
|
|
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
|
|
|
if (touches[i]->mChanged) {
|
|
|
|
changedTouches.AppendElement(touches[i]);
|
|
|
|
}
|
2011-12-17 00:24:11 +00:00
|
|
|
}
|
2014-02-28 14:58:42 +00:00
|
|
|
mChangedTouches = new TouchList(ToSupports(this), changedTouches);
|
2011-12-17 00:24:11 +00:00
|
|
|
}
|
2013-04-26 06:48:00 +00:00
|
|
|
return mChangedTouches;
|
2011-04-26 12:30:17 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
// static
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2014-02-28 14:58:42 +00:00
|
|
|
TouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
|
2016-07-18 14:26:38 +00:00
|
|
|
{
|
|
|
|
nsIDocShell* docShell = nullptr;
|
|
|
|
if (aGlobal) {
|
|
|
|
nsGlobalWindow* win = xpc::WindowOrNull(aGlobal);
|
|
|
|
if (win) {
|
|
|
|
docShell = win->GetDocShell();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return PrefEnabled(docShell);
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
bool
|
|
|
|
TouchEvent::PrefEnabled(nsIDocShell* aDocShell)
|
2011-04-26 12:30:17 +00:00
|
|
|
{
|
2016-05-24 15:24:30 +00:00
|
|
|
static bool sPrefCached = false;
|
|
|
|
static int32_t sPrefCacheValue = 0;
|
|
|
|
|
2016-07-18 14:26:38 +00:00
|
|
|
uint32_t touchEventsOverride = nsIDocShell::TOUCHEVENTS_OVERRIDE_NONE;
|
|
|
|
if (aDocShell) {
|
|
|
|
aDocShell->GetTouchEventsOverride(&touchEventsOverride);
|
|
|
|
}
|
|
|
|
|
2016-05-24 15:24:30 +00:00
|
|
|
if (!sPrefCached) {
|
|
|
|
sPrefCached = true;
|
|
|
|
Preferences::AddIntVarCache(&sPrefCacheValue, "dom.w3c_touch_events.enabled");
|
|
|
|
}
|
|
|
|
|
2016-07-18 14:26:38 +00:00
|
|
|
bool enabled = false;
|
|
|
|
if (touchEventsOverride == nsIDocShell::TOUCHEVENTS_OVERRIDE_ENABLED) {
|
|
|
|
enabled = true;
|
|
|
|
} else if (touchEventsOverride == nsIDocShell::TOUCHEVENTS_OVERRIDE_DISABLED) {
|
|
|
|
enabled = false;
|
|
|
|
} else {
|
|
|
|
if (sPrefCacheValue == 2) {
|
2015-10-26 20:06:27 +00:00
|
|
|
#if defined(MOZ_B2G) || defined(MOZ_WIDGET_ANDROID)
|
2016-07-18 14:26:38 +00:00
|
|
|
// Touch support is always enabled on B2G and android.
|
|
|
|
enabled = true;
|
2015-10-26 20:06:27 +00:00
|
|
|
#elif defined(XP_WIN) || MOZ_WIDGET_GTK == 3
|
2016-07-18 14:26:38 +00:00
|
|
|
static bool sDidCheckTouchDeviceSupport = false;
|
|
|
|
static bool sIsTouchDeviceSupportPresent = false;
|
|
|
|
// On Windows and GTK3 we auto-detect based on device support.
|
|
|
|
if (!sDidCheckTouchDeviceSupport) {
|
|
|
|
sDidCheckTouchDeviceSupport = true;
|
|
|
|
sIsTouchDeviceSupportPresent = WidgetUtils::IsTouchDeviceSupportPresent();
|
|
|
|
}
|
|
|
|
enabled = sIsTouchDeviceSupportPresent;
|
2012-10-25 14:57:51 +00:00
|
|
|
#else
|
2016-07-18 14:26:38 +00:00
|
|
|
enabled = false;
|
2012-10-25 14:57:51 +00:00
|
|
|
#endif
|
2016-07-18 14:26:38 +00:00
|
|
|
} else {
|
|
|
|
enabled = !!sPrefCacheValue;
|
|
|
|
}
|
2011-04-26 12:30:17 +00:00
|
|
|
}
|
2016-07-18 14:26:38 +00:00
|
|
|
|
|
|
|
if (enabled) {
|
2013-09-03 07:15:51 +00:00
|
|
|
nsContentUtils::InitializeTouchEventTable();
|
|
|
|
}
|
2016-07-18 14:26:38 +00:00
|
|
|
return enabled;
|
2011-04-26 12:30:17 +00:00
|
|
|
}
|
|
|
|
|
2015-12-29 13:46:18 +00:00
|
|
|
// static
|
|
|
|
already_AddRefed<Event>
|
|
|
|
TouchEvent::Constructor(const GlobalObject& aGlobal,
|
|
|
|
const nsAString& aType,
|
|
|
|
const TouchEventInit& aParam,
|
|
|
|
ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
|
|
|
|
RefPtr<TouchEvent> e = new TouchEvent(t, nullptr, nullptr);
|
|
|
|
bool trusted = e->Init(t);
|
|
|
|
RefPtr<TouchList> touches = e->CopyTouches(aParam.mTouches);
|
|
|
|
RefPtr<TouchList> targetTouches = e->CopyTouches(aParam.mTargetTouches);
|
|
|
|
RefPtr<TouchList> changedTouches = e->CopyTouches(aParam.mChangedTouches);
|
|
|
|
e->InitTouchEvent(aType, aParam.mBubbles, aParam.mCancelable, aParam.mView,
|
|
|
|
aParam.mDetail, aParam.mCtrlKey, aParam.mAltKey,
|
|
|
|
aParam.mShiftKey, aParam.mMetaKey, touches, targetTouches,
|
|
|
|
changedTouches);
|
|
|
|
e->SetTrusted(trusted);
|
2016-08-31 03:16:11 +00:00
|
|
|
e->SetComposed(aParam.mComposed);
|
2015-12-29 13:46:18 +00:00
|
|
|
return e.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
already_AddRefed<TouchList>
|
|
|
|
TouchEvent::CopyTouches(const Sequence<OwningNonNull<Touch>>& aTouches)
|
|
|
|
{
|
|
|
|
RefPtr<TouchList> list = new TouchList(GetParentObject());
|
|
|
|
size_t len = aTouches.Length();
|
|
|
|
for (size_t i = 0; i < len; ++i) {
|
|
|
|
list->Append(aTouches[i]);
|
|
|
|
}
|
|
|
|
return list.forget();
|
|
|
|
}
|
|
|
|
|
2013-10-18 06:10:26 +00:00
|
|
|
bool
|
2014-02-28 14:58:42 +00:00
|
|
|
TouchEvent::AltKey()
|
2013-10-18 06:10:26 +00:00
|
|
|
{
|
|
|
|
return mEvent->AsTouchEvent()->IsAlt();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2014-02-28 14:58:42 +00:00
|
|
|
TouchEvent::MetaKey()
|
2013-10-18 06:10:26 +00:00
|
|
|
{
|
|
|
|
return mEvent->AsTouchEvent()->IsMeta();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2014-02-28 14:58:42 +00:00
|
|
|
TouchEvent::CtrlKey()
|
2013-10-18 06:10:26 +00:00
|
|
|
{
|
|
|
|
return mEvent->AsTouchEvent()->IsControl();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2014-02-28 14:58:42 +00:00
|
|
|
TouchEvent::ShiftKey()
|
2013-10-18 06:10:26 +00:00
|
|
|
{
|
|
|
|
return mEvent->AsTouchEvent()->IsShift();
|
|
|
|
}
|
|
|
|
|
2014-02-28 14:58:42 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
using namespace mozilla;
|
|
|
|
using namespace mozilla::dom;
|
|
|
|
|
2015-08-12 11:39:31 +00:00
|
|
|
already_AddRefed<TouchEvent>
|
|
|
|
NS_NewDOMTouchEvent(EventTarget* aOwner,
|
2011-04-26 12:30:17 +00:00
|
|
|
nsPresContext* aPresContext,
|
2013-09-27 06:20:57 +00:00
|
|
|
WidgetTouchEvent* aEvent)
|
2011-04-26 12:30:17 +00:00
|
|
|
{
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<TouchEvent> it = new TouchEvent(aOwner, aPresContext, aEvent);
|
2015-08-12 11:39:31 +00:00
|
|
|
return it.forget();
|
2011-04-26 12:30:17 +00:00
|
|
|
}
|