mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 856962: Move Touch to its own file r=Ms2ger
--HG-- rename : content/events/src/nsDOMTouchEvent.cpp => content/events/src/Touch.cpp rename : content/events/src/nsDOMTouchEvent.h => content/events/src/Touch.h
This commit is contained in:
parent
a3325c50ec
commit
76ad7e5429
@ -180,6 +180,7 @@
|
||||
#include "mozilla/dom/HTMLElementBinding.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
#include "GeneratedEvents.h"
|
||||
|
||||
@ -9272,14 +9273,14 @@ nsIDocument::CreateTouch(nsIDOMWindow* aView,
|
||||
float aForce)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(aTarget);
|
||||
nsCOMPtr<nsIDOMTouch> touch = new nsDOMTouch(target,
|
||||
aIdentifier,
|
||||
aPageX, aPageY,
|
||||
aScreenX, aScreenY,
|
||||
aClientX, aClientY,
|
||||
aRadiusX, aRadiusY,
|
||||
aRotationAngle,
|
||||
aForce);
|
||||
nsCOMPtr<nsIDOMTouch> touch = new Touch(target,
|
||||
aIdentifier,
|
||||
aPageX, aPageY,
|
||||
aScreenX, aScreenY,
|
||||
aClientX, aClientY,
|
||||
aRadiusX, aRadiusY,
|
||||
aRotationAngle,
|
||||
aForce);
|
||||
return touch.forget();
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,12 @@ ifndef _MSC_VER
|
||||
FAIL_ON_WARNINGS = 1
|
||||
endif # !_MSC_VER
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla/dom
|
||||
|
||||
EXPORTS_mozilla/dom = \
|
||||
Touch.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nsEventStateManager.h \
|
||||
nsEventListenerManager.h \
|
||||
@ -63,6 +69,7 @@ CPPSRCS = \
|
||||
nsDOMClipboardEvent.cpp \
|
||||
DOMWheelEvent.cpp \
|
||||
TextComposition.cpp \
|
||||
Touch.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_GAMEPAD
|
||||
|
139
content/events/src/Touch.cpp
Normal file
139
content/events/src/Touch.cpp
Normal file
@ -0,0 +1,139 @@
|
||||
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
|
||||
/* 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/Touch.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsIClassInfo.h"
|
||||
#include "nsIXPCScriptable.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsPresContext.h"
|
||||
|
||||
DOMCI_DATA(Touch, mozilla::dom::Touch)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_1(Touch, mTarget)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Touch)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMTouch)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMTouch)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Touch)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Touch)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(Touch)
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetIdentifier(int32_t* aIdentifier)
|
||||
{
|
||||
*aIdentifier = mIdentifier;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetTarget(nsIDOMEventTarget** aTarget)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mTarget);
|
||||
if (content && content->ChromeOnlyAccess() &&
|
||||
!nsContentUtils::CanAccessNativeAnon()) {
|
||||
content = content->FindFirstNonChromeOnlyAccessContent();
|
||||
*aTarget = content.forget().get();
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IF_ADDREF(*aTarget = mTarget);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetScreenX(int32_t* aScreenX)
|
||||
{
|
||||
*aScreenX = mScreenPoint.x;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetScreenY(int32_t* aScreenY)
|
||||
{
|
||||
*aScreenY = mScreenPoint.y;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetClientX(int32_t* aClientX)
|
||||
{
|
||||
*aClientX = mClientPoint.x;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetClientY(int32_t* aClientY)
|
||||
{
|
||||
*aClientY = mClientPoint.y;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetPageX(int32_t* aPageX)
|
||||
{
|
||||
*aPageX = mPagePoint.x;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetPageY(int32_t* aPageY)
|
||||
{
|
||||
*aPageY = mPagePoint.y;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetRadiusX(int32_t* aRadiusX)
|
||||
{
|
||||
*aRadiusX = mRadius.x;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetRadiusY(int32_t* aRadiusY)
|
||||
{
|
||||
*aRadiusY = mRadius.y;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetRotationAngle(float* aRotationAngle)
|
||||
{
|
||||
*aRotationAngle = mRotationAngle;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetForce(float* aForce)
|
||||
{
|
||||
*aForce = mForce;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
Touch::Equals(nsIDOMTouch* aTouch)
|
||||
{
|
||||
float force;
|
||||
float orientation;
|
||||
int32_t radiusX, radiusY;
|
||||
aTouch->GetForce(&force);
|
||||
aTouch->GetRotationAngle(&orientation);
|
||||
aTouch->GetRadiusX(&radiusX);
|
||||
aTouch->GetRadiusY(&radiusY);
|
||||
return mRefPoint != aTouch->mRefPoint ||
|
||||
(mForce != force) ||
|
||||
(mRotationAngle != orientation) ||
|
||||
(mRadius.x != radiusX) || (mRadius.y != radiusY);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
110
content/events/src/Touch.h
Normal file
110
content/events/src/Touch.h
Normal file
@ -0,0 +1,110 @@
|
||||
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
|
||||
/* 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_Touch_h
|
||||
#define mozilla_dom_Touch_h
|
||||
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIDOMTouchEvent.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class Touch MOZ_FINAL : public nsIDOMTouch
|
||||
{
|
||||
public:
|
||||
Touch(nsIDOMEventTarget* aTarget,
|
||||
int32_t aIdentifier,
|
||||
int32_t aPageX,
|
||||
int32_t aPageY,
|
||||
int32_t aScreenX,
|
||||
int32_t aScreenY,
|
||||
int32_t aClientX,
|
||||
int32_t aClientY,
|
||||
int32_t aRadiusX,
|
||||
int32_t aRadiusY,
|
||||
float aRotationAngle,
|
||||
float aForce)
|
||||
{
|
||||
mTarget = aTarget;
|
||||
mIdentifier = aIdentifier;
|
||||
mPagePoint = nsIntPoint(aPageX, aPageY);
|
||||
mScreenPoint = nsIntPoint(aScreenX, aScreenY);
|
||||
mClientPoint = nsIntPoint(aClientX, aClientY);
|
||||
mRefPoint = nsIntPoint(0, 0);
|
||||
mPointsInitialized = true;
|
||||
mRadius.x = aRadiusX;
|
||||
mRadius.y = aRadiusY;
|
||||
mRotationAngle = aRotationAngle;
|
||||
mForce = aForce;
|
||||
|
||||
mChanged = false;
|
||||
mMessage = 0;
|
||||
nsJSContext::LikelyShortLivingObjectCreated();
|
||||
}
|
||||
Touch(int32_t aIdentifier,
|
||||
nsIntPoint aPoint,
|
||||
nsIntPoint aRadius,
|
||||
float aRotationAngle,
|
||||
float aForce)
|
||||
{
|
||||
mIdentifier = aIdentifier;
|
||||
mPagePoint = nsIntPoint(0, 0);
|
||||
mScreenPoint = nsIntPoint(0, 0);
|
||||
mClientPoint = nsIntPoint(0, 0);
|
||||
mRefPoint = aPoint;
|
||||
mPointsInitialized = false;
|
||||
mRadius = aRadius;
|
||||
mRotationAngle = aRotationAngle;
|
||||
mForce = aForce;
|
||||
|
||||
mChanged = false;
|
||||
mMessage = 0;
|
||||
nsJSContext::LikelyShortLivingObjectCreated();
|
||||
}
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(Touch)
|
||||
NS_DECL_NSIDOMTOUCH
|
||||
void InitializePoints(nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
{
|
||||
if (mPointsInitialized) {
|
||||
return;
|
||||
}
|
||||
mClientPoint = nsDOMEvent::GetClientCoords(aPresContext,
|
||||
aEvent,
|
||||
mRefPoint,
|
||||
mClientPoint);
|
||||
mPagePoint = nsDOMEvent::GetPageCoords(aPresContext,
|
||||
aEvent,
|
||||
mRefPoint,
|
||||
mClientPoint);
|
||||
mScreenPoint = nsDOMEvent::GetScreenCoords(aPresContext, aEvent, mRefPoint);
|
||||
mPointsInitialized = true;
|
||||
}
|
||||
void SetTarget(nsIDOMEventTarget *aTarget)
|
||||
{
|
||||
mTarget = aTarget;
|
||||
}
|
||||
bool Equals(nsIDOMTouch* aTouch);
|
||||
|
||||
int32_t mIdentifier;
|
||||
nsIntPoint mPagePoint;
|
||||
nsIntPoint mClientPoint;
|
||||
nsIntPoint mScreenPoint;
|
||||
nsIntPoint mRadius;
|
||||
float mRotationAngle;
|
||||
float mForce;
|
||||
protected:
|
||||
bool mPointsInitialized;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_Touch_h
|
@ -11,129 +11,10 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
DOMCI_DATA(Touch, nsDOMTouch)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_1(nsDOMTouch, mTarget)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMTouch)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMTouch)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMTouch)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Touch)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMTouch)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMTouch)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTouch::GetIdentifier(int32_t* aIdentifier)
|
||||
{
|
||||
*aIdentifier = mIdentifier;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTouch::GetTarget(nsIDOMEventTarget** aTarget)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mTarget);
|
||||
if (content && content->ChromeOnlyAccess() &&
|
||||
!nsContentUtils::CanAccessNativeAnon()) {
|
||||
content = content->FindFirstNonChromeOnlyAccessContent();
|
||||
*aTarget = content.forget().get();
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IF_ADDREF(*aTarget = mTarget);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTouch::GetScreenX(int32_t* aScreenX)
|
||||
{
|
||||
*aScreenX = mScreenPoint.x;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTouch::GetScreenY(int32_t* aScreenY)
|
||||
{
|
||||
*aScreenY = mScreenPoint.y;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTouch::GetClientX(int32_t* aClientX)
|
||||
{
|
||||
*aClientX = mClientPoint.x;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTouch::GetClientY(int32_t* aClientY)
|
||||
{
|
||||
*aClientY = mClientPoint.y;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTouch::GetPageX(int32_t* aPageX)
|
||||
{
|
||||
*aPageX = mPagePoint.x;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTouch::GetPageY(int32_t* aPageY)
|
||||
{
|
||||
*aPageY = mPagePoint.y;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTouch::GetRadiusX(int32_t* aRadiusX)
|
||||
{
|
||||
*aRadiusX = mRadius.x;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTouch::GetRadiusY(int32_t* aRadiusY)
|
||||
{
|
||||
*aRadiusY = mRadius.y;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTouch::GetRotationAngle(float* aRotationAngle)
|
||||
{
|
||||
*aRotationAngle = mRotationAngle;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMTouch::GetForce(float* aForce)
|
||||
{
|
||||
*aForce = mForce;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDOMTouch::Equals(nsIDOMTouch* aTouch)
|
||||
{
|
||||
float force;
|
||||
float orientation;
|
||||
int32_t radiusX, radiusY;
|
||||
aTouch->GetForce(&force);
|
||||
aTouch->GetRotationAngle(&orientation);
|
||||
aTouch->GetRadiusX(&radiusX);
|
||||
aTouch->GetRadiusY(&radiusY);
|
||||
return mRefPoint != aTouch->mRefPoint ||
|
||||
(mForce != force) ||
|
||||
(mRotationAngle != orientation) ||
|
||||
(mRadius.x != radiusX) || (mRadius.y != radiusY);
|
||||
}
|
||||
|
||||
// TouchList
|
||||
nsDOMTouchList::nsDOMTouchList(nsTArray<nsCOMPtr<nsIDOMTouch> > &aTouches)
|
||||
{
|
||||
@ -197,7 +78,7 @@ nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
|
||||
|
||||
for (uint32_t i = 0; i < aEvent->touches.Length(); ++i) {
|
||||
nsIDOMTouch *touch = aEvent->touches[i];
|
||||
nsDOMTouch *domtouch = static_cast<nsDOMTouch*>(touch);
|
||||
dom::Touch *domtouch = static_cast<dom::Touch*>(touch);
|
||||
domtouch->InitializePoints(mPresContext, aEvent);
|
||||
}
|
||||
} else {
|
||||
|
@ -12,94 +12,6 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
|
||||
class nsDOMTouch MOZ_FINAL : public nsIDOMTouch
|
||||
{
|
||||
public:
|
||||
nsDOMTouch(nsIDOMEventTarget* aTarget,
|
||||
int32_t aIdentifier,
|
||||
int32_t aPageX,
|
||||
int32_t aPageY,
|
||||
int32_t aScreenX,
|
||||
int32_t aScreenY,
|
||||
int32_t aClientX,
|
||||
int32_t aClientY,
|
||||
int32_t aRadiusX,
|
||||
int32_t aRadiusY,
|
||||
float aRotationAngle,
|
||||
float aForce)
|
||||
{
|
||||
mTarget = aTarget;
|
||||
mIdentifier = aIdentifier;
|
||||
mPagePoint = nsIntPoint(aPageX, aPageY);
|
||||
mScreenPoint = nsIntPoint(aScreenX, aScreenY);
|
||||
mClientPoint = nsIntPoint(aClientX, aClientY);
|
||||
mRefPoint = nsIntPoint(0, 0);
|
||||
mPointsInitialized = true;
|
||||
mRadius.x = aRadiusX;
|
||||
mRadius.y = aRadiusY;
|
||||
mRotationAngle = aRotationAngle;
|
||||
mForce = aForce;
|
||||
|
||||
mChanged = false;
|
||||
mMessage = 0;
|
||||
nsJSContext::LikelyShortLivingObjectCreated();
|
||||
}
|
||||
nsDOMTouch(int32_t aIdentifier,
|
||||
nsIntPoint aPoint,
|
||||
nsIntPoint aRadius,
|
||||
float aRotationAngle,
|
||||
float aForce)
|
||||
{
|
||||
mIdentifier = aIdentifier;
|
||||
mPagePoint = nsIntPoint(0, 0);
|
||||
mScreenPoint = nsIntPoint(0, 0);
|
||||
mClientPoint = nsIntPoint(0, 0);
|
||||
mRefPoint = aPoint;
|
||||
mPointsInitialized = false;
|
||||
mRadius = aRadius;
|
||||
mRotationAngle = aRotationAngle;
|
||||
mForce = aForce;
|
||||
|
||||
mChanged = false;
|
||||
mMessage = 0;
|
||||
nsJSContext::LikelyShortLivingObjectCreated();
|
||||
}
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsDOMTouch)
|
||||
NS_DECL_NSIDOMTOUCH
|
||||
void InitializePoints(nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
{
|
||||
if (mPointsInitialized) {
|
||||
return;
|
||||
}
|
||||
mClientPoint = nsDOMEvent::GetClientCoords(aPresContext,
|
||||
aEvent,
|
||||
mRefPoint,
|
||||
mClientPoint);
|
||||
mPagePoint = nsDOMEvent::GetPageCoords(aPresContext,
|
||||
aEvent,
|
||||
mRefPoint,
|
||||
mClientPoint);
|
||||
mScreenPoint = nsDOMEvent::GetScreenCoords(aPresContext, aEvent, mRefPoint);
|
||||
mPointsInitialized = true;
|
||||
}
|
||||
void SetTarget(nsIDOMEventTarget *aTarget)
|
||||
{
|
||||
mTarget = aTarget;
|
||||
}
|
||||
bool Equals(nsIDOMTouch* aTouch);
|
||||
|
||||
int32_t mIdentifier;
|
||||
nsIntPoint mPagePoint;
|
||||
nsIntPoint mClientPoint;
|
||||
nsIntPoint mScreenPoint;
|
||||
nsIntPoint mRadius;
|
||||
float mRotationAngle;
|
||||
float mForce;
|
||||
protected:
|
||||
bool mPointsInitialized;
|
||||
};
|
||||
|
||||
class nsDOMTouchList MOZ_FINAL : public nsIDOMTouchList
|
||||
{
|
||||
public:
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "nsFrameManager.h"
|
||||
#include "nsRefreshDriver.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
#include "nsIDOMTouchEvent.h"
|
||||
#include "nsObjectLoadingContent.h"
|
||||
#include "nsFrame.h"
|
||||
@ -849,11 +850,11 @@ nsDOMWindowUtils::SendTouchEvent(const nsAString& aType,
|
||||
event.touches.SetCapacity(aCount);
|
||||
for (uint32_t i = 0; i < aCount; ++i) {
|
||||
nsIntPoint pt = ToWidgetPoint(aXs[i], aYs[i], offset, presContext);
|
||||
nsCOMPtr<nsIDOMTouch> t(new nsDOMTouch(aIdentifiers[i],
|
||||
pt,
|
||||
nsIntPoint(aRxs[i], aRys[i]),
|
||||
aRotationAngles[i],
|
||||
aForces[i]));
|
||||
nsCOMPtr<nsIDOMTouch> t(new Touch(aIdentifiers[i],
|
||||
pt,
|
||||
nsIntPoint(aRxs[i], aRys[i]),
|
||||
aRotationAngles[i],
|
||||
aForces[i]));
|
||||
event.touches.AppendElement(t);
|
||||
}
|
||||
|
||||
@ -1608,7 +1609,7 @@ nsDOMWindowUtils::FindElementWithViewId(nsViewID aID,
|
||||
}
|
||||
|
||||
nsIDocument* document = presContext->Document();
|
||||
mozilla::dom::Element* rootElement = document->GetRootElement();
|
||||
Element* rootElement = document->GetRootElement();
|
||||
if (!rootElement) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
@ -1620,11 +1620,11 @@ TabChild::DispatchSynthesizedMouseEvent(uint32_t aMsg, uint64_t aTime,
|
||||
DispatchWidgetEvent(event);
|
||||
}
|
||||
|
||||
static nsDOMTouch*
|
||||
static Touch*
|
||||
GetTouchForIdentifier(const nsTouchEvent& aEvent, int32_t aId)
|
||||
{
|
||||
for (uint32_t i = 0; i < aEvent.touches.Length(); ++i) {
|
||||
nsDOMTouch* touch = static_cast<nsDOMTouch*>(aEvent.touches[i].get());
|
||||
Touch* touch = static_cast<Touch*>(aEvent.touches[i].get());
|
||||
if (touch->mIdentifier == aId) {
|
||||
return touch;
|
||||
}
|
||||
@ -1664,7 +1664,7 @@ TabChild::UpdateTapState(const nsTouchEvent& aEvent, nsEventStatus aStatus)
|
||||
return;
|
||||
}
|
||||
|
||||
nsDOMTouch* touch = static_cast<nsDOMTouch*>(aEvent.touches[0].get());
|
||||
Touch* touch = static_cast<Touch*>(aEvent.touches[0].get());
|
||||
mGestureDownPoint = touch->mRefPoint;
|
||||
mActivePointerId = touch->mIdentifier;
|
||||
if (sClickHoldContextMenusEnabled) {
|
||||
@ -1682,7 +1682,7 @@ TabChild::UpdateTapState(const nsTouchEvent& aEvent, nsEventStatus aStatus)
|
||||
if (!currentlyTrackingTouch) {
|
||||
return;
|
||||
}
|
||||
nsDOMTouch* trackedTouch = GetTouchForIdentifier(aEvent, mActivePointerId);
|
||||
Touch* trackedTouch = GetTouchForIdentifier(aEvent, mActivePointerId);
|
||||
if (!trackedTouch) {
|
||||
return;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@
|
||||
#include "nsILineIterator.h" // for ScrollContentIntoView
|
||||
#include "nsWeakPtr.h"
|
||||
#include "pldhash.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIDocShell.h" // for reflow observation
|
||||
#include "nsIBaseWindow.h"
|
||||
@ -6176,7 +6176,7 @@ PresShell::HandleEvent(nsIFrame *aFrame,
|
||||
for (int32_t i = touchEvent->touches.Length(); i; ) {
|
||||
--i;
|
||||
nsIDOMTouch *touch = touchEvent->touches[i];
|
||||
nsDOMTouch *domtouch = static_cast<nsDOMTouch*>(touch);
|
||||
Touch *domtouch = static_cast<Touch*>(touch);
|
||||
touch->mMessage = aEvent->message;
|
||||
|
||||
int32_t id = 0;
|
||||
@ -6708,7 +6708,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
|
||||
nsTArray<nsCOMPtr<nsIDOMTouch> > &touches = touchEvent->touches;
|
||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||
nsIDOMTouch *touch = touches[i];
|
||||
nsDOMTouch *domtouch = static_cast<nsDOMTouch*>(touch);
|
||||
Touch *domtouch = static_cast<Touch*>(touch);
|
||||
if (!touch) {
|
||||
continue;
|
||||
}
|
||||
@ -6742,7 +6742,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
|
||||
for (int32_t i = touches.Length(); i; ) {
|
||||
--i;
|
||||
nsIDOMTouch *touch = touches[i];
|
||||
nsDOMTouch *domtouch = static_cast<nsDOMTouch*>(touch);
|
||||
Touch *domtouch = static_cast<Touch*>(touch);
|
||||
if (!touch) {
|
||||
continue;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#include "nsBoxLayoutState.h"
|
||||
#include "nsBoxFrame.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -66,6 +66,7 @@
|
||||
#include "nsIURI.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
//define DEBUG_REDRAW
|
||||
|
||||
@ -2071,12 +2072,12 @@ nsBoxFrame::GetEventPoint(nsGUIEvent* aEvent, nsIntPoint &aPoint) {
|
||||
if (touchEvent->touches.Length() != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
nsIDOMTouch *touch = touchEvent->touches.SafeElementAt(0);
|
||||
if (!touch) {
|
||||
return false;
|
||||
}
|
||||
nsDOMTouch* domtouch = static_cast<nsDOMTouch*>(touch);
|
||||
Touch* domtouch = static_cast<Touch*>(touch);
|
||||
aPoint = domtouch->mRefPoint;
|
||||
} else {
|
||||
aPoint = aEvent->refPoint;
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
|
@ -67,19 +67,19 @@ protected:
|
||||
};
|
||||
|
||||
/**
|
||||
* Data container for a single touch input. Similar to nsDOMTouch, but used in
|
||||
* Data container for a single touch input. Similar to dom::Touch, but used in
|
||||
* off-main-thread situations. This is more for just storing touch data, whereas
|
||||
* nsDOMTouch derives from nsIDOMTouch so it is more useful for dispatching
|
||||
* through the DOM (which can only happen on the main thread). nsDOMTouch also
|
||||
* dom::Touch derives from nsIDOMTouch so it is more useful for dispatching
|
||||
* through the DOM (which can only happen on the main thread). dom::Touch also
|
||||
* bears the problem of storing pointers to nsIWidget instances which can only
|
||||
* be used on the main thread, so if instead we used nsDOMTouch and ever set
|
||||
* be used on the main thread, so if instead we used dom::Touch and ever set
|
||||
* these pointers off-main-thread, Bad Things Can Happen(tm).
|
||||
*
|
||||
* Note that this doesn't inherit from InputData because this itself is not an
|
||||
* event. It is only a container/struct that should have any number of instances
|
||||
* within a MultiTouchInput.
|
||||
*
|
||||
* fixme/bug 775746: Make nsDOMTouch inherit from this class.
|
||||
* fixme/bug 775746: Make dom::Touch inherit from this class.
|
||||
*/
|
||||
class SingleTouchData
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ using mozilla::unused;
|
||||
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsIDOMSimpleGestureEvent.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
@ -53,6 +53,7 @@ using mozilla::unused;
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::widget;
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsWindow, nsBaseWidget)
|
||||
@ -1271,21 +1272,21 @@ nsWindow::DispatchMultitouchEvent(nsTouchEvent &event, AndroidGeckoEvent *ae)
|
||||
action == AndroidMotionEvent::ACTION_POINTER_UP) {
|
||||
event.touches.SetCapacity(1);
|
||||
int pointerIndex = ae->PointerIndex();
|
||||
nsCOMPtr<nsIDOMTouch> t(new nsDOMTouch(ae->PointIndicies()[pointerIndex],
|
||||
ae->Points()[pointerIndex] - offset,
|
||||
ae->PointRadii()[pointerIndex],
|
||||
ae->Orientations()[pointerIndex],
|
||||
ae->Pressures()[pointerIndex]));
|
||||
nsCOMPtr<nsIDOMTouch> t(new Touch(ae->PointIndicies()[pointerIndex],
|
||||
ae->Points()[pointerIndex] - offset,
|
||||
ae->PointRadii()[pointerIndex],
|
||||
ae->Orientations()[pointerIndex],
|
||||
ae->Pressures()[pointerIndex]));
|
||||
event.touches.AppendElement(t);
|
||||
} else {
|
||||
int count = ae->Count();
|
||||
event.touches.SetCapacity(count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
nsCOMPtr<nsIDOMTouch> t(new nsDOMTouch(ae->PointIndicies()[i],
|
||||
ae->Points()[i] - offset,
|
||||
ae->PointRadii()[i],
|
||||
ae->Orientations()[i],
|
||||
ae->Pressures()[i]));
|
||||
nsCOMPtr<nsIDOMTouch> t(new Touch(ae->PointIndicies()[i],
|
||||
ae->Points()[i] - offset,
|
||||
ae->PointRadii()[i],
|
||||
ae->Orientations()[i],
|
||||
ae->Pressures()[i]));
|
||||
event.touches.AppendElement(t);
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsAppShell.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIObserverService.h"
|
||||
@ -87,7 +87,7 @@ void NotifyEvent()
|
||||
gAppShell->NotifyNativeEvent();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace mozilla
|
||||
|
||||
static void
|
||||
pipeHandler(int fd, FdHandler *data)
|
||||
@ -120,7 +120,7 @@ struct UserInputData {
|
||||
} key;
|
||||
struct {
|
||||
int32_t touchCount;
|
||||
Touch touches[MAX_POINTERS];
|
||||
::Touch touches[MAX_POINTERS];
|
||||
} motion;
|
||||
};
|
||||
};
|
||||
@ -147,9 +147,9 @@ sendMouseEvent(uint32_t msg, uint64_t timeMs, int x, int y, bool forwardToChildr
|
||||
static void
|
||||
addDOMTouch(UserInputData& data, nsTouchEvent& event, int i)
|
||||
{
|
||||
const Touch& touch = data.motion.touches[i];
|
||||
const ::Touch& touch = data.motion.touches[i];
|
||||
event.touches.AppendElement(
|
||||
new nsDOMTouch(touch.id,
|
||||
new dom::Touch(touch.id,
|
||||
nsIntPoint(touch.coords.getX(), touch.coords.getY()),
|
||||
nsIntPoint(touch.coords.getAxisValue(AMOTION_EVENT_AXIS_SIZE),
|
||||
touch.coords.getAxisValue(AMOTION_EVENT_AXIS_SIZE)),
|
||||
@ -524,7 +524,7 @@ GeckoInputDispatcher::notifyMotion(const NotifyMotionArgs* args)
|
||||
MOZ_ASSERT(args->pointerCount <= MAX_POINTERS);
|
||||
data.motion.touchCount = args->pointerCount;
|
||||
for (uint32_t i = 0; i < args->pointerCount; ++i) {
|
||||
Touch& touch = data.motion.touches[i];
|
||||
::Touch& touch = data.motion.touches[i];
|
||||
touch.id = args->pointerProperties[i].id;
|
||||
memcpy(&touch.coords, &args->pointerCoords[i], sizeof(*args->pointerCoords));
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
#define nsGUIEventIPC_h__
|
||||
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
namespace IPC
|
||||
@ -204,12 +204,12 @@ struct ParamTraits<nsTouchEvent>
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<const nsInputEvent&>(aParam));
|
||||
// Sigh, nsDOMTouch bites us again! We want to be able to do
|
||||
// Sigh, Touch bites us again! We want to be able to do
|
||||
// WriteParam(aMsg, aParam.touches);
|
||||
const nsTArray<nsCOMPtr<nsIDOMTouch> >& touches = aParam.touches;
|
||||
WriteParam(aMsg, touches.Length());
|
||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||
nsDOMTouch* touch = static_cast<nsDOMTouch*>(touches[i].get());
|
||||
mozilla::dom::Touch* touch = static_cast<mozilla::dom::Touch*>(touches[i].get());
|
||||
WriteParam(aMsg, touch->mIdentifier);
|
||||
WriteParam(aMsg, touch->mRefPoint);
|
||||
WriteParam(aMsg, touch->mRadius);
|
||||
@ -239,7 +239,7 @@ struct ParamTraits<nsTouchEvent>
|
||||
return false;
|
||||
}
|
||||
aResult->touches.AppendElement(
|
||||
new nsDOMTouch(identifier, refPoint, radius, rotationAngle, force));
|
||||
new mozilla::dom::Touch(identifier, refPoint, radius, rotationAngle, force));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@
|
||||
#include "WinUtils.h"
|
||||
#include "WidgetUtils.h"
|
||||
#include "nsIWidgetListener.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
|
||||
#ifdef MOZ_ENABLE_D3D9_LAYER
|
||||
#include "LayerManagerD3D9.h"
|
||||
@ -164,9 +164,10 @@
|
||||
#include "mozilla/HangMonitor.h"
|
||||
#include "WinIMEHandler.h"
|
||||
|
||||
using namespace mozilla::widget;
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla::widget;
|
||||
|
||||
/**************************************************************
|
||||
**************************************************************
|
||||
@ -6332,16 +6333,16 @@ bool nsWindow::OnTouch(WPARAM wParam, LPARAM lParam)
|
||||
touchPoint.y = TOUCH_COORD_TO_PIXEL(pInputs[i].y);
|
||||
touchPoint.ScreenToClient(mWnd);
|
||||
nsCOMPtr<nsIDOMTouch> touch =
|
||||
new nsDOMTouch(pInputs[i].dwID,
|
||||
touchPoint,
|
||||
/* radius, if known */
|
||||
pInputs[i].dwFlags & TOUCHINPUTMASKF_CONTACTAREA ?
|
||||
nsIntPoint(
|
||||
TOUCH_COORD_TO_PIXEL(pInputs[i].cxContact) / 2,
|
||||
TOUCH_COORD_TO_PIXEL(pInputs[i].cyContact) / 2) :
|
||||
nsIntPoint(1,1),
|
||||
/* rotation angle and force */
|
||||
0.0f, 0.0f);
|
||||
new Touch(pInputs[i].dwID,
|
||||
touchPoint,
|
||||
/* radius, if known */
|
||||
pInputs[i].dwFlags & TOUCHINPUTMASKF_CONTACTAREA ?
|
||||
nsIntPoint(
|
||||
TOUCH_COORD_TO_PIXEL(pInputs[i].cxContact) / 2,
|
||||
TOUCH_COORD_TO_PIXEL(pInputs[i].cyContact) / 2) :
|
||||
nsIntPoint(1,1),
|
||||
/* rotation angle and force */
|
||||
0.0f, 0.0f);
|
||||
|
||||
// Append to the appropriate event
|
||||
if (msg == NS_TOUCH_START || msg == NS_TOUCH_MOVE) {
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "MetroUtils.h" // Logging, POINT_CEIL_*, ActivateGenericInstance, etc
|
||||
#include "MetroWidget.h" // MetroInput::mWidget
|
||||
#include "npapi.h" // NPEvent
|
||||
#include "nsDOMTouchEvent.h" // nsDOMTouch
|
||||
#include "mozilla/dom/Touch.h" // Touch
|
||||
#include "nsTArray.h" // Touch lists
|
||||
#include "nsIDOMSimpleGestureEvent.h" // Constants for gesture events
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
using namespace ABI::Windows; // UI, System, Foundation namespaces
|
||||
using namespace Microsoft; // WRL namespace (ComPtr, possibly others)
|
||||
using namespace mozilla::widget::winrt;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
// File-scoped statics (unnamed namespace)
|
||||
namespace {
|
||||
@ -46,17 +47,17 @@ namespace {
|
||||
typedef ABI::Windows::UI::Core::ICoreAcceleratorKeys ICoreAcceleratorKeys;
|
||||
|
||||
/**
|
||||
* Creates and returns a new {@link nsDOMTouch} from the given
|
||||
* Creates and returns a new {@link Touch} from the given
|
||||
* ABI::Windows::UI::Input::IPointerPoint. Note that the caller is
|
||||
* responsible for freeing the memory for the nsDOMTouch returned from
|
||||
* responsible for freeing the memory for the Touch returned from
|
||||
* this function.
|
||||
*
|
||||
* @param aPoint the ABI::Windows::UI::Input::IPointerPoint containing the
|
||||
* metadata from which to create our new {@link nsDOMTouch}
|
||||
* @return a new {@link nsDOMTouch} representing the touch point. The caller
|
||||
* metadata from which to create our new {@link Touch}
|
||||
* @return a new {@link Touch} representing the touch point. The caller
|
||||
* is responsible for freeing the memory for this touch point.
|
||||
*/
|
||||
nsDOMTouch*
|
||||
Touch*
|
||||
CreateDOMTouch(UI::Input::IPointerPoint* aPoint) {
|
||||
WRL::ComPtr<UI::Input::IPointerPointProperties> props;
|
||||
Foundation::Point position;
|
||||
@ -74,28 +75,28 @@ namespace {
|
||||
nsIntPoint touchRadius;
|
||||
touchRadius.x = MetroUtils::LogToPhys(contactRect.Width) / 2;
|
||||
touchRadius.y = MetroUtils::LogToPhys(contactRect.Height) / 2;
|
||||
return new nsDOMTouch(pointerId,
|
||||
touchPoint,
|
||||
// Rotation radius and angle.
|
||||
// W3C touch events v1 do not use these.
|
||||
// The draft for W3C touch events v2 explains that
|
||||
// radius and angle should describe the ellipse that
|
||||
// most closely circumscribes the touching area. Since
|
||||
// Windows gives us a bounding rectangle rather than an
|
||||
// ellipse, we provide the ellipse that is most closely
|
||||
// circumscribed by the bounding rectangle that Windows
|
||||
// gave us.
|
||||
touchRadius,
|
||||
0.0f,
|
||||
// Pressure
|
||||
// W3C touch events v1 do not use this.
|
||||
// The current draft for W3C touch events v2 says that
|
||||
// this should be a value between 0.0 and 1.0, which is
|
||||
// consistent with what Windows provides us here.
|
||||
// XXX: Windows defaults to 0.5, but the current W3C
|
||||
// draft says that the value should be 0.0 if no value
|
||||
// known.
|
||||
pressure);
|
||||
return new Touch(pointerId,
|
||||
touchPoint,
|
||||
// Rotation radius and angle.
|
||||
// W3C touch events v1 do not use these.
|
||||
// The draft for W3C touch events v2 explains that
|
||||
// radius and angle should describe the ellipse that
|
||||
// most closely circumscribes the touching area. Since
|
||||
// Windows gives us a bounding rectangle rather than an
|
||||
// ellipse, we provide the ellipse that is most closely
|
||||
// circumscribed by the bounding rectangle that Windows
|
||||
// gave us.
|
||||
touchRadius,
|
||||
0.0f,
|
||||
// Pressure
|
||||
// W3C touch events v1 do not use this.
|
||||
// The current draft for W3C touch events v2 says that
|
||||
// this should be a value between 0.0 and 1.0, which is
|
||||
// consistent with what Windows provides us here.
|
||||
// XXX: Windows defaults to 0.5, but the current W3C
|
||||
// draft says that the value should be 0.0 if no value
|
||||
// known.
|
||||
pressure);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -6,11 +6,13 @@
|
||||
#include "InputData.h"
|
||||
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
#include "nsDebug.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
using namespace dom;
|
||||
|
||||
MultiTouchInput::MultiTouchInput(const nsTouchEvent& aTouchEvent)
|
||||
: InputData(MULTITOUCH_INPUT, aTouchEvent.time)
|
||||
{
|
||||
@ -42,7 +44,7 @@ MultiTouchInput::MultiTouchInput(const nsTouchEvent& aTouchEvent)
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < aTouchEvent.touches.Length(); i++) {
|
||||
nsDOMTouch* domTouch = (nsDOMTouch*)(aTouchEvent.touches[i].get());
|
||||
Touch* domTouch = static_cast<Touch*>(aTouchEvent.touches[i].get());
|
||||
|
||||
// Extract data from weird interfaces.
|
||||
int32_t identifier, radiusX, radiusY;
|
||||
|
Loading…
Reference in New Issue
Block a user