Bug 1458063 - Support constructing a PinchGestureInput with a focus point in Screen coordinates. r=kats

MozReview-Commit-ID: 9umkUEEWyBQ

--HG--
extra : rebase_source : 7d2d5498464c1460c1192976b84d28170b3cd98c
This commit is contained in:
Botond Ballo 2018-05-02 16:41:47 -04:00
Родитель 5db812fe01
Коммит 5b8cc7e2fa
2 изменённых файлов: 32 добавлений и 1 удалений

Просмотреть файл

@ -594,6 +594,20 @@ PinchGestureInput::PinchGestureInput()
{
}
PinchGestureInput::PinchGestureInput(PinchGestureType aType, uint32_t aTime,
TimeStamp aTimeStamp,
const ScreenPoint& aFocusPoint,
ParentLayerCoord aCurrentSpan,
ParentLayerCoord aPreviousSpan,
Modifiers aModifiers)
: InputData(PINCHGESTURE_INPUT, aTime, aTimeStamp, aModifiers)
, mType(aType)
, mFocusPoint(aFocusPoint)
, mCurrentSpan(aCurrentSpan)
, mPreviousSpan(aPreviousSpan)
{
}
PinchGestureInput::PinchGestureInput(PinchGestureType aType, uint32_t aTime,
TimeStamp aTimeStamp,
const ParentLayerPoint& aLocalFocusPoint,
@ -610,7 +624,12 @@ PinchGestureInput::PinchGestureInput(PinchGestureType aType, uint32_t aTime,
bool
PinchGestureInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
{
{
if (mFocusPoint == BothFingersLifted<ScreenPixel>()) {
// Special value, no transform required.
mLocalFocusPoint = BothFingersLifted();
return true;
}
Maybe<ParentLayerPoint> point = UntransformBy(aTransform, mFocusPoint);
if (!point) {
return false;

Просмотреть файл

@ -418,6 +418,18 @@ public:
PINCHGESTURE_END
));
// Construct a pinch gesture from a Screen point.
// (Technically, we should take the span values in Screen pixels as well,
// but that would require also storing them in Screen pixels and then
// converting them in TransformToLocal() like the focus point. Since pinch
// gesture events are processed by the root content APZC, the only transform
// between Screen and ParentLayer pixels should be a translation, which is
// irrelevant to span values, so we don't bother.)
PinchGestureInput(PinchGestureType aType, uint32_t aTime, TimeStamp aTimeStamp,
const ScreenPoint& aFocusPoint,
ParentLayerCoord aCurrentSpan,
ParentLayerCoord aPreviousSpan, Modifiers aModifiers);
// Construct a pinch gesture from a ParentLayer point.
// mFocusPoint remains (0,0) unless it's set later.
PinchGestureInput(PinchGestureType aType, uint32_t aTime, TimeStamp aTimeStamp,