diff --git a/dom/events/Touch.cpp b/dom/events/Touch.cpp index c8314742d4b3..b447aefc6aad 100644 --- a/dom/events/Touch.cpp +++ b/dom/events/Touch.cpp @@ -160,6 +160,46 @@ Touch::ScreenY(CallerType aCallerType) const return mScreenPoint.y; } +int32_t +Touch::RadiusX(CallerType aCallerType) const +{ + if (nsContentUtils::ResistFingerprinting(aCallerType)) { + return 0; + } + + return mRadius.x; +} + +int32_t +Touch::RadiusY(CallerType aCallerType) const +{ + if (nsContentUtils::ResistFingerprinting(aCallerType)) { + return 0; + } + + return mRadius.y; +} + +float +Touch::RotationAngle(CallerType aCallerType) const +{ + if (nsContentUtils::ResistFingerprinting(aCallerType)) { + return 0.0f; + } + + return mRotationAngle; +} + +float +Touch::Force(CallerType aCallerType) const +{ + if (nsContentUtils::ResistFingerprinting(aCallerType)) { + return 0.0f; + } + + return mForce; +} + void Touch::InitializePoints(nsPresContext* aPresContext, WidgetEvent* aEvent) { @@ -184,10 +224,10 @@ bool Touch::Equals(Touch* aTouch) { return mRefPoint == aTouch->mRefPoint && - mForce == aTouch->Force() && - mRotationAngle == aTouch->RotationAngle() && - mRadius.x == aTouch->RadiusX() && - mRadius.y == aTouch->RadiusY(); + mForce == aTouch->mForce && + mRotationAngle == aTouch->mRotationAngle && + mRadius.x == aTouch->mRadius.x && + mRadius.y == aTouch->mRadius.y; } JSObject* diff --git a/dom/events/Touch.h b/dom/events/Touch.h index 7393446985be..1af76a74d58c 100644 --- a/dom/events/Touch.h +++ b/dom/events/Touch.h @@ -74,10 +74,10 @@ public: int32_t ClientY() const { return mClientPoint.y; } int32_t PageX() const { return mPagePoint.x; } int32_t PageY() const { return mPagePoint.y; } - int32_t RadiusX() const { return mRadius.x; } - int32_t RadiusY() const { return mRadius.y; } - float RotationAngle() const { return mRotationAngle; } - float Force() const { return mForce; } + int32_t RadiusX(CallerType aCallerType) const; + int32_t RadiusY(CallerType aCallerType) const; + float RotationAngle(CallerType aCallerType) const; + float Force(CallerType aCallerType) const; nsCOMPtr mTarget; LayoutDeviceIntPoint mRefPoint; diff --git a/dom/webidl/Touch.webidl b/dom/webidl/Touch.webidl index 7edc5df646ba..d00e46654520 100644 --- a/dom/webidl/Touch.webidl +++ b/dom/webidl/Touch.webidl @@ -38,8 +38,12 @@ interface Touch { readonly attribute long clientY; readonly attribute long pageX; readonly attribute long pageY; + [NeedsCallerType] readonly attribute long radiusX; + [NeedsCallerType] readonly attribute long radiusY; + [NeedsCallerType] readonly attribute float rotationAngle; + [NeedsCallerType] readonly attribute float force; }; diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index e92f4beaa2da..fe8f423412cb 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -7107,8 +7107,8 @@ DispatchPointerFromMouseOrTouch(PresShell* aShell, event.pointerId = touch->Identifier(); event.mRefPoint = touch->mRefPoint; event.mModifiers = touchEvent->mModifiers; - event.mWidth = touch->RadiusX(); - event.mHeight = touch->RadiusY(); + event.mWidth = touch->RadiusX(CallerType::System); + event.mHeight = touch->RadiusY(CallerType::System); event.tiltX = touch->tiltX; event.tiltY = touch->tiltY; event.mTime = touchEvent->mTime; diff --git a/widget/InputData.cpp b/widget/InputData.cpp index f23a6fe87896..7a2f94421d71 100644 --- a/widget/InputData.cpp +++ b/widget/InputData.cpp @@ -6,6 +6,7 @@ #include "InputData.h" #include "mozilla/dom/Touch.h" +#include "nsContentUtils.h" #include "nsDebug.h" #include "nsThreadUtils.h" #include "mozilla/MouseEvents.h" @@ -130,10 +131,10 @@ MultiTouchInput::MultiTouchInput(const WidgetTouchEvent& aTouchEvent) // Extract data from weird interfaces. int32_t identifier = domTouch->Identifier(); - int32_t radiusX = domTouch->RadiusX(); - int32_t radiusY = domTouch->RadiusY(); - float rotationAngle = domTouch->RotationAngle(); - float force = domTouch->Force(); + int32_t radiusX = domTouch->RadiusX(CallerType::System); + int32_t radiusY = domTouch->RadiusY(CallerType::System); + float rotationAngle = domTouch->RotationAngle(CallerType::System); + float force = domTouch->Force(CallerType::System); SingleTouchData data(identifier, ViewAs(domTouch->mRefPoint,