mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backout 40683014a638 for causing mochitest orange
This commit is contained in:
parent
53f3f3f4df
commit
10f3eae40e
@ -25,12 +25,27 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(Touch, mTarget)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Touch)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMTouch)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Touch)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(Touch)
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetIdentifier(int32_t* aIdentifier)
|
||||
{
|
||||
*aIdentifier = Identifier();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetTarget(nsIDOMEventTarget** aTarget)
|
||||
{
|
||||
NS_ADDREF(*aTarget = Target());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
EventTarget*
|
||||
Touch::Target() const
|
||||
{
|
||||
@ -43,6 +58,76 @@ Touch::Target() const
|
||||
return mTarget;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetScreenX(int32_t* aScreenX)
|
||||
{
|
||||
*aScreenX = ScreenX();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetScreenY(int32_t* aScreenY)
|
||||
{
|
||||
*aScreenY = ScreenY();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetClientX(int32_t* aClientX)
|
||||
{
|
||||
*aClientX = ClientX();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetClientY(int32_t* aClientY)
|
||||
{
|
||||
*aClientY = ClientY();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetPageX(int32_t* aPageX)
|
||||
{
|
||||
*aPageX = PageX();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetPageY(int32_t* aPageY)
|
||||
{
|
||||
*aPageY = PageY();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetRadiusX(int32_t* aRadiusX)
|
||||
{
|
||||
*aRadiusX = RadiusX();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetRadiusY(int32_t* aRadiusY)
|
||||
{
|
||||
*aRadiusY = RadiusY();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetRotationAngle(float* aRotationAngle)
|
||||
{
|
||||
*aRotationAngle = RotationAngle();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Touch::GetForce(float* aForce)
|
||||
{
|
||||
*aForce = Force();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
Touch::InitializePoints(nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
{
|
||||
@ -62,12 +147,19 @@ Touch::InitializePoints(nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
}
|
||||
|
||||
bool
|
||||
Touch::Equals(Touch* aTouch)
|
||||
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 != aTouch->Force()) ||
|
||||
(mRotationAngle != aTouch->RotationAngle()) ||
|
||||
(mRadius.x != aTouch->RadiusX()) || (mRadius.y != aTouch->RadiusY());
|
||||
(mForce != force) ||
|
||||
(mRotationAngle != orientation) ||
|
||||
(mRadius.x != radiusX) || (mRadius.y != radiusY);
|
||||
}
|
||||
|
||||
/* virtual */ JSObject*
|
||||
|
@ -6,6 +6,7 @@
|
||||
#ifndef mozilla_dom_Touch_h
|
||||
#define mozilla_dom_Touch_h
|
||||
|
||||
#include "nsIDOMTouchEvent.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
@ -17,7 +18,7 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class Touch MOZ_FINAL : public nsISupports
|
||||
class Touch MOZ_FINAL : public nsIDOMTouch
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
@ -76,6 +77,7 @@ public:
|
||||
}
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Touch)
|
||||
NS_DECL_NSIDOMTOUCH
|
||||
|
||||
void InitializePoints(nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
|
||||
@ -83,7 +85,7 @@ public:
|
||||
{
|
||||
mTarget = aTarget;
|
||||
}
|
||||
bool Equals(Touch* aTouch);
|
||||
bool Equals(nsIDOMTouch* aTouch);
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
@ -110,12 +112,6 @@ public:
|
||||
nsIntPoint mRadius;
|
||||
float mRotationAngle;
|
||||
float mForce;
|
||||
nsCOMPtr<mozilla::dom::EventTarget> mTarget;
|
||||
mozilla::dom::EventTarget *GetTarget() { return mTarget; }
|
||||
nsIntPoint mRefPoint;
|
||||
bool mChanged;
|
||||
uint32_t mMessage;
|
||||
|
||||
protected:
|
||||
bool mPointsInitialized;
|
||||
};
|
||||
|
@ -63,7 +63,9 @@ nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
|
||||
mEventIsInternal = false;
|
||||
|
||||
for (uint32_t i = 0; i < aEvent->touches.Length(); ++i) {
|
||||
aEvent->touches[i]->InitializePoints(mPresContext, aEvent);
|
||||
nsIDOMTouch *touch = aEvent->touches[i];
|
||||
dom::Touch *domtouch = static_cast<dom::Touch*>(touch);
|
||||
domtouch->InitializePoints(mPresContext, aEvent);
|
||||
}
|
||||
} else {
|
||||
mEventIsInternal = true;
|
||||
|
@ -1557,7 +1557,7 @@ nsEventStateManager::MapEventCoordinatesForChildProcess(
|
||||
// in the space where top-left is 0,0.
|
||||
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
|
||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||
Touch* touch = touches[i];
|
||||
nsIDOMTouch* touch = touches[i];
|
||||
if (touch) {
|
||||
touch->mRefPoint += aOffsetIntPoint;
|
||||
}
|
||||
@ -1641,7 +1641,7 @@ nsEventStateManager::HandleCrossProcessEvent(nsEvent *aEvent,
|
||||
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
|
||||
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
|
||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||
Touch* touch = touches[i];
|
||||
nsIDOMTouch* touch = touches[i];
|
||||
// NB: the |mChanged| check is an optimization, subprocesses can
|
||||
// compute this for themselves. If the touch hasn't changed, we
|
||||
// may be able to avoid forwarding the event entirely (which is
|
||||
|
@ -62,7 +62,6 @@
|
||||
#include "mozilla/dom/Gamepad.h"
|
||||
#endif
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMTouchEvent.h"
|
||||
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
#include "Units.h"
|
||||
|
@ -4,6 +4,39 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIDOMUIEvent.idl"
|
||||
%{C++
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsPoint.h"
|
||||
%}
|
||||
interface nsIVariant;
|
||||
|
||||
/**
|
||||
* @see http://dvcs.w3.org/hg/webevents/raw-file/tip/touchevents.html
|
||||
*/
|
||||
|
||||
[scriptable, builtinclass, uuid(98bc0f7d-5bff-4387-9c42-58af54b48dd5)]
|
||||
interface nsIDOMTouch : nsISupports {
|
||||
readonly attribute long identifier;
|
||||
readonly attribute nsIDOMEventTarget target;
|
||||
readonly attribute long pageX;
|
||||
readonly attribute long pageY;
|
||||
readonly attribute long screenX;
|
||||
readonly attribute long screenY;
|
||||
readonly attribute long clientX;
|
||||
readonly attribute long clientY;
|
||||
readonly attribute long radiusX;
|
||||
readonly attribute long radiusY;
|
||||
readonly attribute float rotationAngle;
|
||||
readonly attribute float force;
|
||||
%{C++
|
||||
nsCOMPtr<mozilla::dom::EventTarget> mTarget;
|
||||
mozilla::dom::EventTarget *GetTarget() { return mTarget; }
|
||||
void SetTarget(mozilla::dom::EventTarget *target) { mTarget = target; }
|
||||
nsIntPoint mRefPoint;
|
||||
bool mChanged;
|
||||
uint32_t mMessage;
|
||||
%}
|
||||
};
|
||||
|
||||
[scriptable, uuid(6d5484f7-92ac-45f8-9388-39b5bad055ce)]
|
||||
interface nsITouchEventReceiver : nsISupports {
|
||||
|
@ -270,7 +270,7 @@ AsyncPanZoomController::ReceiveInputEvent(const nsInputEvent& aEvent,
|
||||
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aOutEvent);
|
||||
const nsTArray< nsRefPtr<dom::Touch> >& touches = touchEvent->touches;
|
||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||
dom::Touch* touch = touches[i];
|
||||
nsIDOMTouch* touch = touches[i];
|
||||
if (touch) {
|
||||
CSSPoint refCSSPoint = WidgetSpaceToCompensatedViewportSpace(
|
||||
ScreenPoint::FromUnknownPoint(gfx::Point(
|
||||
|
@ -6886,7 +6886,7 @@ PresShell::DispatchTouchEvent(nsEvent *aEvent,
|
||||
|
||||
// loop over all touches and dispatch events on any that have changed
|
||||
for (uint32_t i = 0; i < touchEvent->touches.Length(); ++i) {
|
||||
Touch *touch = touchEvent->touches[i];
|
||||
nsIDOMTouch *touch = touchEvent->touches[i];
|
||||
if (!touch || !touch->mChanged) {
|
||||
continue;
|
||||
}
|
||||
|
@ -2077,7 +2077,7 @@ nsBoxFrame::GetEventPoint(nsGUIEvent* aEvent, nsIntPoint &aPoint) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Touch *touch = touchEvent->touches.SafeElementAt(0);
|
||||
nsIDOMTouch *touch = touchEvent->touches.SafeElementAt(0);
|
||||
if (!touch) {
|
||||
return false;
|
||||
}
|
||||
|
@ -70,11 +70,11 @@ protected:
|
||||
/**
|
||||
* 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
|
||||
* dom::Touch 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 dom::Touch and ever set these pointers
|
||||
* off-main-thread, Bad Things Can Happen(tm).
|
||||
* 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 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
|
||||
|
@ -47,14 +47,22 @@ MultiTouchInput::MultiTouchInput(const nsTouchEvent& aTouchEvent)
|
||||
for (size_t i = 0; i < aTouchEvent.touches.Length(); i++) {
|
||||
Touch* domTouch = static_cast<Touch*>(aTouchEvent.touches[i].get());
|
||||
|
||||
SingleTouchData data(domTouch->Identifier(),
|
||||
// Extract data from weird interfaces.
|
||||
int32_t identifier, radiusX, radiusY;
|
||||
float rotationAngle, force;
|
||||
domTouch->GetIdentifier(&identifier);
|
||||
domTouch->GetRadiusX(&radiusX);
|
||||
domTouch->GetRadiusY(&radiusY);
|
||||
domTouch->GetRotationAngle(&rotationAngle);
|
||||
domTouch->GetForce(&force);
|
||||
|
||||
SingleTouchData data(identifier,
|
||||
ScreenIntPoint::FromUnknownPoint(
|
||||
gfx::IntPoint(domTouch->mRefPoint.x,
|
||||
domTouch->mRefPoint.y)),
|
||||
ScreenSize(domTouch->RadiusX(),
|
||||
domTouch->RadiusY()),
|
||||
domTouch->RotationAngle(),
|
||||
domTouch->Force());
|
||||
ScreenSize(radiusX, radiusY),
|
||||
rotationAngle,
|
||||
force);
|
||||
|
||||
mTouches.AppendElement(data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user