--- a/accessible/base/nsCoreUtils.cpp
+++ b/accessible/base/nsCoreUtils.cpp
@@ -160,17 +160,17 @@ nsCoreUtils::DispatchTouchEvent(EventMes
WidgetTouchEvent event(true, aMessage, aRootWidget);
event.mTime = PR_IntervalNow();
// XXX: Touch has an identifier of -1 to hint that it is synthesized.
RefPtr<dom::Touch> t = new dom::Touch(-1, LayoutDeviceIntPoint(aX, aY),
LayoutDeviceIntPoint(1, 1), 0.0f, 1.0f);
t->SetTarget(aContent);
- event.touches.AppendElement(t);
+ event.mTouches.AppendElement(t);
nsEventStatus status = nsEventStatus_eIgnore;
aPresShell->HandleEventWithTarget(&event, aFrame, aContent, &status);
}
uint32_t
nsCoreUtils::GetAccessKeyFor(nsIContent* aContent)
{
// Accesskeys are registered by @accesskey attribute only. At first check
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -940,29 +940,29 @@ nsDOMWindowUtils::SendTouchEventCommon(c
event.modifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
event.widget = widget;
event.mTime = PR_Now();
nsPresContext* presContext = GetPresContext();
if (!presContext) {
return NS_ERROR_FAILURE;
}
- event.touches.SetCapacity(aCount);
+ event.mTouches.SetCapacity(aCount);
for (uint32_t i = 0; i < aCount; ++i) {
LayoutDeviceIntPoint pt =
nsContentUtils::ToWidgetPoint(CSSPoint(aXs[i], aYs[i]), offset, presContext);
LayoutDeviceIntPoint radius =
LayoutDeviceIntPoint::FromAppUnitsRounded(
CSSPoint::ToAppUnits(CSSPoint(aRxs[i], aRys[i])),
presContext->AppUnitsPerDevPixel());
RefPtr<Touch> t =
new Touch(aIdentifiers[i], pt, radius, aRotationAngles[i], aForces[i]);
- event.touches.AppendElement(t);
+ event.mTouches.AppendElement(t);
}
nsEventStatus status;
if (aToWindow) {
nsCOMPtr<nsIPresShell> presShell;
nsView* view = nsContentUtils::GetViewToDispatchEvent(presContext, getter_AddRefs(presShell));
if (!presShell || !view) {
return NS_ERROR_FAILURE;
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -1309,17 +1309,17 @@ EventStateManager::HandleCrossProcessEve
// This is a touch event with possibly multiple touch points.
// Each touch point may have its own target. So iterate through
// all of them and collect the unique set of targets for event
// forwarding.
//
// This loop is similar to the one used in
// PresShell::DispatchTouchEvent().
const WidgetTouchEvent::TouchArray& touches =
- aEvent->AsTouchEvent()->touches;
+ aEvent->AsTouchEvent()->mTouches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
Touch* 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
// not free).
if (!touch || !touch->mChanged) {
continue;
--- a/dom/events/TouchEvent.cpp
+++ b/dom/events/TouchEvent.cpp
@@ -64,18 +64,18 @@ TouchEvent::TouchEvent(EventTarget* aOwn
WidgetTouchEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetTouchEvent(false, eVoidEvent, nullptr))
{
if (aEvent) {
mEventIsInternal = false;
- for (uint32_t i = 0; i < aEvent->touches.Length(); ++i) {
- Touch* touch = aEvent->touches[i];
+ for (uint32_t i = 0; i < aEvent->mTouches.Length(); ++i) {
+ Touch* touch = aEvent->mTouches[i];
touch->InitializePoints(mPresContext, aEvent);
}
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
}
}
@@ -113,39 +113,39 @@ TouchEvent::InitTouchEvent(const nsAStri
}
TouchList*
TouchEvent::Touches()
{
if (!mTouches) {
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
if (mEvent->mMessage == eTouchEnd || mEvent->mMessage == eTouchCancel) {
- // for touchend events, remove any changed touches from the touches array
+ // for touchend events, remove any changed touches from mTouches
WidgetTouchEvent::AutoTouchArray unchangedTouches;
- const WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
+ const WidgetTouchEvent::TouchArray& touches = touchEvent->mTouches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
if (!touches[i]->mChanged) {
unchangedTouches.AppendElement(touches[i]);
}
}
mTouches = new TouchList(ToSupports(this), unchangedTouches);
} else {
- mTouches = new TouchList(ToSupports(this), touchEvent->touches);
+ mTouches = new TouchList(ToSupports(this), touchEvent->mTouches);
}
}
return mTouches;
}
TouchList*
TouchEvent::TargetTouches()
{
if (!mTargetTouches) {
WidgetTouchEvent::AutoTouchArray targetTouches;
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
- const WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
+ const WidgetTouchEvent::TouchArray& touches = touchEvent->mTouches;
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
if ((mEvent->mMessage != eTouchEnd && mEvent->mMessage != eTouchCancel) ||
!touches[i]->mChanged) {
if (touches[i]->mTarget == mEvent->originalTarget) {
targetTouches.AppendElement(touches[i]);
}
@@ -157,17 +157,17 @@ TouchEvent::TargetTouches()
}
TouchList*
TouchEvent::ChangedTouches()
{
if (!mChangedTouches) {
WidgetTouchEvent::AutoTouchArray changedTouches;
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
- const WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
+ const WidgetTouchEvent::TouchArray& touches = touchEvent->mTouches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
if (touches[i]->mChanged) {
changedTouches.AppendElement(touches[i]);
}
}
mChangedTouches = new TouchList(ToSupports(this), changedTouches);
}
return mChangedTouches;
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -4237,17 +4237,17 @@ HTMLInputElement::PostHandleEventForRang
if (aVisitor.mEvent->mMessage == eMouseDown) {
if (aVisitor.mEvent->AsMouseEvent()->buttons ==
WidgetMouseEvent::eLeftButtonFlag) {
StartRangeThumbDrag(inputEvent);
} else if (mIsDraggingRange) {
CancelRangeThumbDrag();
}
} else {
- if (aVisitor.mEvent->AsTouchEvent()->touches.Length() == 1) {
+ if (aVisitor.mEvent->AsTouchEvent()->mTouches.Length() == 1) {
StartRangeThumbDrag(inputEvent);
} else if (mIsDraggingRange) {
CancelRangeThumbDrag();
}
}
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
} break;
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1653,35 +1653,35 @@ bool TabParent::SendRealTouchEvent(Widge
return false;
}
// PresShell::HandleEventInternal adds touches on touch end/cancel. This
// confuses remote content and the panning and zooming logic into thinking
// that the added touches are part of the touchend/cancel, when actually
// they're not.
if (event.mMessage == eTouchEnd || event.mMessage == eTouchCancel) {
- for (int i = event.touches.Length() - 1; i >= 0; i--) {
- if (!event.touches[i]->mChanged) {
- event.touches.RemoveElementAt(i);
+ for (int i = event.mTouches.Length() - 1; i >= 0; i--) {
+ if (!event.mTouches[i]->mChanged) {
+ event.mTouches.RemoveElementAt(i);
}
}
}
ScrollableLayerGuid guid;
uint64_t blockId;
nsEventStatus apzResponse;
ApzAwareEventRoutingToChild(&guid, &blockId, &apzResponse);
if (mIsDestroyed) {
return false;
}
LayoutDeviceIntPoint offset = GetChildProcessOffset();
- for (uint32_t i = 0; i < event.touches.Length(); i++) {
- event.touches[i]->mRefPoint += offset;
+ for (uint32_t i = 0; i < event.mTouches.Length(); i++) {
+ event.mTouches[i]->mRefPoint += offset;
}
return (event.mMessage == eTouchMove) ?
PBrowserParent::SendRealTouchMoveEvent(event, guid, blockId, apzResponse) :
PBrowserParent::SendRealTouchEvent(event, guid, blockId, apzResponse);
}
bool
@@ -2773,17 +2773,17 @@ TabParent::InjectTouchEvent(const nsAStr
}
nsIDocument* doc = content->OwnerDoc();
if (!doc || !doc->GetShell()) {
return NS_ERROR_FAILURE;
}
nsPresContext* presContext = doc->GetShell()->GetPresContext();
- event.touches.SetCapacity(aCount);
+ event.mTouches.SetCapacity(aCount);
for (uint32_t i = 0; i < aCount; ++i) {
LayoutDeviceIntPoint pt =
LayoutDeviceIntPoint::FromAppUnitsRounded(
CSSPoint::ToAppUnits(CSSPoint(aXs[i], aYs[i])),
presContext->AppUnitsPerDevPixel());
LayoutDeviceIntPoint radius =
LayoutDeviceIntPoint::FromAppUnitsRounded(
@@ -2792,17 +2792,17 @@ TabParent::InjectTouchEvent(const nsAStr
RefPtr<Touch> t =
new Touch(aIdentifiers[i], pt, radius, aRotationAngles[i], aForces[i]);
// Consider all injected touch events as changedTouches. For more details
// about the meaning of changedTouches for each event, see
// https://developer.mozilla.org/docs/Web/API/TouchEvent.changedTouches
t->mChanged = true;
- event.touches.AppendElement(t);
+ event.mTouches.AppendElement(t);
}
SendRealTouchEvent(event);
return NS_OK;
}
NS_IMETHODIMP
TabParent::GetUseAsyncPanZoom(bool* useAsyncPanZoom)
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -1146,20 +1146,21 @@ APZCTreeManager::ReceiveInputEvent(Widge
case eTouchEventClass: {
WidgetTouchEvent& touchEvent = *aEvent.AsTouchEvent();
MultiTouchInput touchInput(touchEvent);
nsEventStatus result = ProcessTouchInput(touchInput, aOutTargetGuid, aOutInputBlockId);
// touchInput was modified in-place to possibly remove some
// touch points (if we are overscrolled), and the coordinates were
// modified using the APZ untransform. We need to copy these changes
// back into the WidgetInputEvent.
- touchEvent.touches.Clear();
- touchEvent.touches.SetCapacity(touchInput.mTouches.Length());
+ touchEvent.mTouches.Clear();
+ touchEvent.mTouches.SetCapacity(touchInput.mTouches.Length());
for (size_t i = 0; i < touchInput.mTouches.Length(); i++) {
- *touchEvent.touches.AppendElement() = touchInput.mTouches[i].ToNewDOMTouch();
+ *touchEvent.mTouches.AppendElement() =
+ touchInput.mTouches[i].ToNewDOMTouch();
}
touchEvent.mFlags.mHandledByAPZ = touchInput.mHandledByAPZ;
return result;
}
case eWheelEventClass: {
WidgetWheelEvent& wheelEvent = *aEvent.AsWheelEvent();
if (WillHandleWheelEvent(&wheelEvent)) {
return ProcessWheelEvent(wheelEvent, aOutTargetGuid, aOutInputBlockId);
--- a/gfx/layers/apz/util/APZCCallbackHelper.cpp
+++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp
@@ -536,19 +536,19 @@ APZCCallbackHelper::ApplyCallbackTransfo
void
APZCCallbackHelper::ApplyCallbackTransform(WidgetEvent& aEvent,
const ScrollableLayerGuid& aGuid,
const CSSToLayoutDeviceScale& aScale)
{
if (aEvent.AsTouchEvent()) {
WidgetTouchEvent& event = *(aEvent.AsTouchEvent());
- for (size_t i = 0; i < event.touches.Length(); i++) {
- event.touches[i]->mRefPoint = ApplyCallbackTransform(
- event.touches[i]->mRefPoint, aGuid, aScale);
+ for (size_t i = 0; i < event.mTouches.Length(); i++) {
+ event.mTouches[i]->mRefPoint = ApplyCallbackTransform(
+ event.mTouches[i]->mRefPoint, aGuid, aScale);
}
} else {
aEvent.refPoint = ApplyCallbackTransform(
aEvent.refPoint, aGuid, aScale);
}
}
nsEventStatus
@@ -841,19 +841,19 @@ APZCCallbackHelper::SendSetTargetAPZCNot
}
sLastTargetAPZCNotificationInputBlock = aInputBlockId;
if (nsIPresShell* shell = aDocument->GetShell()) {
if (nsIFrame* rootFrame = shell->GetRootFrame()) {
bool waitForRefresh = false;
nsTArray<ScrollableLayerGuid> targets;
if (const WidgetTouchEvent* touchEvent = aEvent.AsTouchEvent()) {
- for (size_t i = 0; i < touchEvent->touches.Length(); i++) {
+ for (size_t i = 0; i < touchEvent->mTouches.Length(); i++) {
waitForRefresh |= PrepareForSetTargetAPZCNotification(aWidget, aGuid,
- rootFrame, touchEvent->touches[i]->mRefPoint, &targets);
+ rootFrame, touchEvent->mTouches[i]->mRefPoint, &targets);
}
} else if (const WidgetWheelEvent* wheelEvent = aEvent.AsWheelEvent()) {
waitForRefresh = PrepareForSetTargetAPZCNotification(aWidget, aGuid,
rootFrame, wheelEvent->refPoint, &targets);
}
// TODO: Do other types of events need to be handled?
if (!targets.IsEmpty()) {
@@ -871,18 +871,20 @@ APZCCallbackHelper::SendSetTargetAPZCNot
void
APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification(
nsIWidget* aWidget,
const WidgetTouchEvent& aEvent,
uint64_t aInputBlockId,
const SetAllowedTouchBehaviorCallback& aCallback)
{
nsTArray<TouchBehaviorFlags> flags;
- for (uint32_t i = 0; i < aEvent.touches.Length(); i++) {
- flags.AppendElement(widget::ContentHelper::GetAllowedTouchBehavior(aWidget, aEvent.touches[i]->mRefPoint));
+ for (uint32_t i = 0; i < aEvent.mTouches.Length(); i++) {
+ flags.AppendElement(
+ widget::ContentHelper::GetAllowedTouchBehavior(
+ aWidget, aEvent.mTouches[i]->mRefPoint));
}
aCallback(aInputBlockId, flags);
}
void
APZCCallbackHelper::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent)
{
nsCOMPtr<nsIContent> targetContent = nsLayoutUtils::FindContentFor(aScrollId);
--- a/gfx/layers/apz/util/APZEventState.cpp
+++ b/gfx/layers/apz/util/APZEventState.cpp
@@ -255,18 +255,18 @@ APZEventState::ProcessLongTap(const nsCO
void
APZEventState::ProcessTouchEvent(const WidgetTouchEvent& aEvent,
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId,
nsEventStatus aApzResponse,
nsEventStatus aContentResponse)
{
- if (aEvent.mMessage == eTouchStart && aEvent.touches.Length() > 0) {
- mActiveElementManager->SetTargetElement(aEvent.touches[0]->GetTarget());
+ if (aEvent.mMessage == eTouchStart && aEvent.mTouches.Length() > 0) {
+ mActiveElementManager->SetTargetElement(aEvent.mTouches[0]->GetTarget());
}
bool isTouchPrevented = aContentResponse == nsEventStatus_eConsumeNoDefault;
bool sentContentResponse = false;
APZES_LOG("Handling event type %d\n", aEvent.mMessage);
switch (aEvent.mMessage) {
case eTouchStart: {
mTouchEndCancelled = false;
@@ -317,18 +317,18 @@ APZEventState::ProcessTouchEvent(const W
}
if (sentContentResponse &&
aApzResponse == nsEventStatus_eConsumeDoDefault &&
gfxPrefs::PointerEventsEnabled()) {
WidgetTouchEvent cancelEvent(aEvent);
cancelEvent.mMessage = eTouchCancel;
cancelEvent.mFlags.mCancelable = false; // mMessage != eTouchCancel;
- for (uint32_t i = 0; i < cancelEvent.touches.Length(); ++i) {
- if (mozilla::dom::Touch* touch = cancelEvent.touches[i]) {
+ for (uint32_t i = 0; i < cancelEvent.mTouches.Length(); ++i) {
+ if (mozilla::dom::Touch* touch = cancelEvent.mTouches[i]) {
touch->convertToPointer = true;
}
}
nsEventStatus status;
cancelEvent.widget->DispatchEvent(&cancelEvent, status);
}
}
--- a/layout/base/AccessibleCaretEventHub.cpp
+++ b/layout/base/AccessibleCaretEventHub.cpp
@@ -540,25 +540,25 @@ AccessibleCaretEventHub::HandleMouseEven
}
return rv;
}
nsEventStatus
AccessibleCaretEventHub::HandleTouchEvent(WidgetTouchEvent* aEvent)
{
- if (aEvent->touches.IsEmpty()) {
+ if (aEvent->mTouches.IsEmpty()) {
AC_LOG("%s: Receive a touch event without any touch data!", __FUNCTION__);
return nsEventStatus_eIgnore;
}
nsEventStatus rv = nsEventStatus_eIgnore;
int32_t id =
- (mActiveTouchId == kInvalidTouchId ? aEvent->touches[0]->Identifier()
+ (mActiveTouchId == kInvalidTouchId ? aEvent->mTouches[0]->Identifier()
: mActiveTouchId);
nsPoint point = GetTouchEventPosition(aEvent, id);
switch (aEvent->mMessage) {
case eTouchStart:
AC_LOGV("Before eTouchStart, state: %s", mState->Name());
rv = mState->OnPress(this, point, id);
AC_LOGV("After eTouchStart, state: %s, consume: %d", mState->Name(), rv);
@@ -776,17 +776,17 @@ AccessibleCaretEventHub::NotifyBlur(bool
AC_LOG("%s, state: %s", __FUNCTION__, mState->Name());
mState->OnBlur(this, aIsLeavingDocument);
}
nsPoint
AccessibleCaretEventHub::GetTouchEventPosition(WidgetTouchEvent* aEvent,
int32_t aIdentifier) const
{
- for (dom::Touch* touch : aEvent->touches) {
+ for (dom::Touch* touch : aEvent->mTouches) {
if (touch->Identifier() == aIdentifier) {
LayoutDeviceIntPoint touchIntPoint = touch->mRefPoint;
// Get event coordinate relative to root frame.
nsIFrame* rootFrame = mPresShell->GetRootFrame();
return nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, touchIntPoint,
rootFrame);
}
--- a/layout/base/TouchManager.cpp
+++ b/layout/base/TouchManager.cpp
@@ -62,17 +62,17 @@ EvictTouchPoint(RefPtr<dom::Touch>& aTou
nsIFrame* frame = presShell->GetRootFrame();
if (frame) {
nsPoint pt(aTouch->mRefPoint.x, aTouch->mRefPoint.y);
nsCOMPtr<nsIWidget> widget = frame->GetView()->GetNearestWidget(&pt);
if (widget) {
WidgetTouchEvent event(true, eTouchEnd, widget);
event.widget = widget;
event.mTime = PR_IntervalNow();
- event.touches.AppendElement(aTouch);
+ event.mTouches.AppendElement(aTouch);
nsEventStatus status;
widget->DispatchEvent(&event, status);
return;
}
}
}
}
}
@@ -113,40 +113,40 @@ TouchManager::PreHandleEvent(WidgetEvent
{
switch (aEvent->mMessage) {
case eTouchStart: {
aIsHandlingUserInput = true;
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
// if there is only one touch in this touchstart event, assume that it is
// the start of a new touch session and evict any old touches in the
// queue
- if (touchEvent->touches.Length() == 1) {
+ if (touchEvent->mTouches.Length() == 1) {
WidgetTouchEvent::AutoTouchArray touches;
AppendToTouchList(&touches);
for (uint32_t i = 0; i < touches.Length(); ++i) {
EvictTouchPoint(touches[i]);
}
}
// Add any new touches to the queue
- for (uint32_t i = 0; i < touchEvent->touches.Length(); ++i) {
- dom::Touch* touch = touchEvent->touches[i];
+ for (uint32_t i = 0; i < touchEvent->mTouches.Length(); ++i) {
+ dom::Touch* touch = touchEvent->mTouches[i];
int32_t id = touch->Identifier();
if (!gCaptureTouchList->Get(id, nullptr)) {
// If it is not already in the queue, it is a new touch
touch->mChanged = true;
}
touch->mMessage = aEvent->mMessage;
gCaptureTouchList->Put(id, touch);
}
break;
}
case eTouchMove: {
// Check for touches that changed. Mark them add to queue
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
- WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
+ WidgetTouchEvent::TouchArray& touches = touchEvent->mTouches;
bool haveChanged = false;
for (int32_t i = touches.Length(); i; ) {
--i;
dom::Touch* touch = touches[i];
if (!touch) {
continue;
}
int32_t id = touch->Identifier();
@@ -180,19 +180,19 @@ TouchManager::PreHandleEvent(WidgetEvent
if (!haveChanged) {
if (aTouchIsNew) {
// however, if this is the first touchmove after a touchstart,
// it is special in that preventDefault is allowed on it, so
// we must dispatch it to content even if nothing changed. we
// arbitrarily pick the first touch point to be the "changed"
// touch because firing an event with no changed events doesn't
// work.
- for (uint32_t i = 0; i < touchEvent->touches.Length(); ++i) {
- if (touchEvent->touches[i]) {
- touchEvent->touches[i]->mChanged = true;
+ for (uint32_t i = 0; i < touchEvent->mTouches.Length(); ++i) {
+ if (touchEvent->mTouches[i]) {
+ touchEvent->mTouches[i]->mChanged = true;
break;
}
}
} else {
return false;
}
}
break;
@@ -200,17 +200,17 @@ TouchManager::PreHandleEvent(WidgetEvent
case eTouchEnd:
aIsHandlingUserInput = true;
// Fall through to touchcancel code
MOZ_FALLTHROUGH;
case eTouchCancel: {
// Remove the changed touches
// need to make sure we only remove touches that are ending here
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
- WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
+ WidgetTouchEvent::TouchArray& touches = touchEvent->mTouches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
dom::Touch* touch = touches[i];
if (!touch) {
continue;
}
touch->mMessage = aEvent->mMessage;
touch->mChanged = true;
--- a/layout/base/gtest/TestAccessibleCaretEventHub.cpp
+++ b/layout/base/gtest/TestAccessibleCaretEventHub.cpp
@@ -69,17 +69,17 @@ public:
mManager = MakeUnique<MockAccessibleCaretManager>();
mInitialized = true;
}
virtual nsPoint GetTouchEventPosition(WidgetTouchEvent* aEvent,
int32_t aIdentifier) const override
{
// Return the device point directly.
- LayoutDeviceIntPoint touchIntPoint = aEvent->touches[0]->mRefPoint;
+ LayoutDeviceIntPoint touchIntPoint = aEvent->mTouches[0]->mRefPoint;
return nsPoint(touchIntPoint.x, touchIntPoint.y);
}
virtual nsPoint GetMouseEventPosition(WidgetMouseEvent* aEvent) const override
{
// Return the device point directly.
LayoutDeviceIntPoint mouseIntPoint = aEvent->AsGUIEvent()->refPoint;
return nsPoint(mouseIntPoint.x, mouseIntPoint.y);
@@ -158,17 +158,17 @@ public:
int32_t identifier = 0;
LayoutDeviceIntPoint point(aX, aY);
LayoutDeviceIntPoint radius(19, 19);
float rotationAngle = 0;
float force = 1;
RefPtr<dom::Touch> touch(
new dom::Touch(identifier, point, radius, rotationAngle, force));
- event->touches.AppendElement(touch);
+ event->mTouches.AppendElement(touch);
return Move(event);
}
static UniquePtr<WidgetEvent> CreateTouchStartEvent(nscoord aX, nscoord aY)
{
return CreateTouchEvent(eTouchStart, aX, aY);
}
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -6865,18 +6865,18 @@ DispatchPointerFromMouseOrTouch(PresShel
break;
case eTouchCancel:
pointerMessage = ePointerCancel;
break;
default:
return NS_OK;
}
- for (uint32_t i = 0; i < touchEvent->touches.Length(); ++i) {
- mozilla::dom::Touch* touch = touchEvent->touches[i];
+ for (uint32_t i = 0; i < touchEvent->mTouches.Length(); ++i) {
+ mozilla::dom::Touch* touch = touchEvent->mTouches[i];
if (!touch || !touch->convertToPointer) {
continue;
}
WidgetPointerEvent event(touchEvent->IsTrusted(), pointerMessage,
touchEvent->widget);
event.isPrimary = i == 0;
event.pointerId = touch->Identifier();
@@ -7439,34 +7439,35 @@ PresShell::HandleEvent(nsIFrame* aFrame,
uint32_t flags = 0;
if (aEvent->mMessage == eTouchStart) {
flags |= INPUT_IGNORE_ROOT_SCROLL_FRAME;
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
// if this is a continuing session, ensure that all these events are
// in the same document by taking the target of the events already in
// the capture list
nsCOMPtr<nsIContent> anyTarget;
- if (TouchManager::gCaptureTouchList->Count() > 0 && touchEvent->touches.Length() > 1) {
+ if (TouchManager::gCaptureTouchList->Count() > 0 &&
+ touchEvent->mTouches.Length() > 1) {
for (auto iter = TouchManager::gCaptureTouchList->Iter();
!iter.Done();
iter.Next()) {
RefPtr<dom::Touch>& touch = iter.Data();
if (touch) {
dom::EventTarget* target = touch->GetTarget();
if (target) {
anyTarget = do_QueryInterface(target);
break;
}
}
}
}
- for (int32_t i = touchEvent->touches.Length(); i; ) {
+ for (int32_t i = touchEvent->mTouches.Length(); i; ) {
--i;
- dom::Touch* touch = touchEvent->touches[i];
+ dom::Touch* touch = touchEvent->mTouches[i];
int32_t id = touch->Identifier();
if (!TouchManager::gCaptureTouchList->Get(id, nullptr)) {
// find the target for this touch
eventPoint = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent,
touch->mRefPoint,
frame);
nsIFrame* target = FindFrameTargetedByInputEvent(aEvent,
@@ -7490,20 +7491,20 @@ PresShell::HandleEvent(nsIFrame* aFrame,
// We must be in a subdocument so jump directly to the root frame.
// GetParentOrPlaceholderForCrossDoc gets called immediately to
// jump up to the containing document.
f = f->PresContext()->GetPresShell()->GetRootFrame();
}
// if we couldn't find a target frame in the same document as
// anyTarget, remove the touch from the capture touch list, as
- // well as the event->touches array. touchmove events that aren't
+ // well as the event->mTouches array. touchmove events that aren't
// in the captured touch list will be discarded
if (!newTargetFrame) {
- touchEvent->touches.RemoveElementAt(i);
+ touchEvent->mTouches.RemoveElementAt(i);
} else {
target = newTargetFrame;
nsCOMPtr<nsIContent> targetContent;
target->GetContentForEvent(aEvent, getter_AddRefs(targetContent));
while (targetContent && !targetContent->IsElement()) {
targetContent = targetContent->GetParent();
}
touch->SetTarget(targetContent);
@@ -7623,17 +7624,17 @@ PresShell::HandleEvent(nsIFrame* aFrame,
PresShell* shell =
static_cast<PresShell*>(frame->PresContext()->PresShell());
switch (aEvent->mMessage) {
case eTouchMove:
case eTouchCancel:
case eTouchEnd: {
// get the correct shell to dispatch to
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
- for (dom::Touch* touch : touchEvent->touches) {
+ for (dom::Touch* touch : touchEvent->mTouches) {
if (!touch) {
break;
}
RefPtr<dom::Touch> oldTouch =
TouchManager::gCaptureTouchList->GetWeak(touch->Identifier());
if (!oldTouch) {
break;
@@ -8236,17 +8237,17 @@ PresShell::DispatchTouchEventToDOM(Widge
bool canPrevent = (aEvent->mMessage == eTouchStart) ||
(aEvent->mMessage == eTouchMove && aTouchIsNew) ||
(aEvent->mMessage == eTouchEnd);
bool preventDefault = false;
nsEventStatus tmpStatus = nsEventStatus_eIgnore;
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
// loop over all touches and dispatch events on any that have changed
- for (dom::Touch* touch : touchEvent->touches) {
+ for (dom::Touch* touch : touchEvent->mTouches) {
if (!touch || !touch->mChanged) {
continue;
}
nsCOMPtr<EventTarget> targetPtr = touch->mTarget;
nsCOMPtr<nsIContent> content = do_QueryInterface(targetPtr);
if (!content) {
continue;
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -530,19 +530,19 @@ nsRangeFrame::GetValueAtEventPoint(Widge
"type=range should have a default maximum/minimum");
if (maximum <= minimum) {
return minimum;
}
Decimal range = maximum - minimum;
LayoutDeviceIntPoint absPoint;
if (aEvent->mClass == eTouchEventClass) {
- MOZ_ASSERT(aEvent->AsTouchEvent()->touches.Length() == 1,
- "Unexpected number of touches");
- absPoint = aEvent->AsTouchEvent()->touches[0]->mRefPoint;
+ MOZ_ASSERT(aEvent->AsTouchEvent()->mTouches.Length() == 1,
+ "Unexpected number of mTouches");
+ absPoint = aEvent->AsTouchEvent()->mTouches[0]->mRefPoint;
} else {
absPoint = aEvent->refPoint;
}
nsPoint point =
nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, absPoint, this);
if (point == nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE)) {
// We don't want to change the current value for this error state.
--- a/layout/xul/nsBoxFrame.cpp
+++ b/layout/xul/nsBoxFrame.cpp
@@ -2088,21 +2088,21 @@ nsBoxFrame::GetEventPoint(WidgetGUIEvent
bool
nsBoxFrame::GetEventPoint(WidgetGUIEvent* aEvent, LayoutDeviceIntPoint& aPoint) {
NS_ENSURE_TRUE(aEvent, false);
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
if (touchEvent) {
// return false if there is more than one touch on the page, or if
// we can't find a touch point
- if (touchEvent->touches.Length() != 1) {
+ if (touchEvent->mTouches.Length() != 1) {
return false;
}
- dom::Touch* touch = touchEvent->touches.SafeElementAt(0);
+ dom::Touch* touch = touchEvent->mTouches.SafeElementAt(0);
if (!touch) {
return false;
}
aPoint = touch->mRefPoint;
} else {
aPoint = aEvent->refPoint;
}
return true;
--- a/widget/InputData.cpp
+++ b/widget/InputData.cpp
@@ -189,18 +189,18 @@ MultiTouchInput::MultiTouchInput(const W
case eTouchCancel:
mType = MULTITOUCH_CANCEL;
break;
default:
MOZ_ASSERT_UNREACHABLE("Did not assign a type to a MultiTouchInput");
break;
}
- for (size_t i = 0; i < aTouchEvent.touches.Length(); i++) {
- const Touch* domTouch = aTouchEvent.touches[i];
+ for (size_t i = 0; i < aTouchEvent.mTouches.Length(); i++) {
+ const Touch* domTouch = aTouchEvent.mTouches[i];
// 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();
@@ -246,17 +246,17 @@ MultiTouchInput::ToWidgetTouchEvent(nsIW
}
event.modifiers = this->modifiers;
event.mTime = this->mTime;
event.mTimeStamp = this->mTimeStamp;
event.mFlags.mHandledByAPZ = mHandledByAPZ;
for (size_t i = 0; i < mTouches.Length(); i++) {
- *event.touches.AppendElement() = mTouches[i].ToNewDOMTouch();
+ *event.mTouches.AppendElement() = mTouches[i].ToNewDOMTouch();
}
return event;
}
WidgetMouseEvent
MultiTouchInput::ToWidgetMouseEvent(nsIWidget* aWidget) const
{
--- a/widget/TouchEvents.h
+++ b/widget/TouchEvents.h
@@ -169,17 +169,17 @@ public:
WidgetTouchEvent(const WidgetTouchEvent& aOther)
: WidgetInputEvent(aOther.IsTrusted(), aOther.mMessage, aOther.widget,
eTouchEventClass)
{
MOZ_COUNT_CTOR(WidgetTouchEvent);
modifiers = aOther.modifiers;
mTime = aOther.mTime;
mTimeStamp = aOther.mTimeStamp;
- touches.AppendElements(aOther.touches);
+ mTouches.AppendElements(aOther.mTouches);
mFlags.mCancelable = mMessage != eTouchCancel;
mFlags.mHandledByAPZ = aOther.mFlags.mHandledByAPZ;
}
WidgetTouchEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget)
: WidgetInputEvent(aIsTrusted, aMessage, aWidget, eTouchEventClass)
{
MOZ_COUNT_CTOR(WidgetTouchEvent);
@@ -197,23 +197,23 @@ public:
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetTouchEvent* result = new WidgetTouchEvent(false, mMessage, nullptr);
result->AssignTouchEventData(*this, true);
result->mFlags = mFlags;
return result;
}
- TouchArray touches;
+ TouchArray mTouches;
void AssignTouchEventData(const WidgetTouchEvent& aEvent, bool aCopyTargets)
{
AssignInputEventData(aEvent, aCopyTargets);
// Assign*EventData() assume that they're called only new instance.
- MOZ_ASSERT(touches.IsEmpty());
- touches.AppendElements(aEvent.touches);
+ MOZ_ASSERT(mTouches.IsEmpty());
+ mTouches.AppendElements(aEvent.mTouches);
}
};
} // namespace mozilla
#endif // mozilla_TouchEvents_h__
--- a/widget/android/AndroidJavaWrappers.cpp
+++ b/widget/android/AndroidJavaWrappers.cpp
@@ -606,17 +606,17 @@ AndroidGeckoEvent::MakeTouchEvent(nsIWid
// An event we don't know about
return event;
}
event.modifiers = DOMModifiers();
event.mTime = Time();
const LayoutDeviceIntPoint& offset = widget->WidgetToScreenOffset();
- event.touches.SetCapacity(endIndex - startIndex);
+ event.mTouches.SetCapacity(endIndex - startIndex);
for (int i = startIndex; i < endIndex; i++) {
// In this code branch, we are dispatching this event directly
// into Gecko (as opposed to going through the AsyncPanZoomController),
// and the Points() array has points in CSS pixels, which we need
// to convert.
CSSToLayoutDeviceScale scale = widget->GetDefaultScale();
LayoutDeviceIntPoint pt(
(Points()[i].x * scale.scale) - offset.x,
@@ -624,17 +624,17 @@ AndroidGeckoEvent::MakeTouchEvent(nsIWid
LayoutDeviceIntPoint radius(
PointRadii()[i].x * scale.scale,
PointRadii()[i].y * scale.scale);
RefPtr<Touch> t = new Touch(PointIndicies()[i],
pt,
radius,
Orientations()[i],
Pressures()[i]);
- event.touches.AppendElement(t);
+ event.mTouches.AppendElement(t);
}
return event;
}
MultiTouchInput
AndroidGeckoEvent::MakeMultiTouchInput(nsIWidget* widget)
{
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1986,24 +1986,24 @@ nsWindow::OnLongTapEvent(AndroidGeckoEve
event.ignoreRootScrollFrame = true;
DispatchEvent(&event);
}
void
nsWindow::DispatchHitTest(const WidgetTouchEvent& aEvent)
{
- if (aEvent.mMessage == eTouchStart && aEvent.touches.Length() == 1) {
+ if (aEvent.mMessage == eTouchStart && aEvent.mTouches.Length() == 1) {
// Since touch events don't get retargeted by PositionedEventTargeting.cpp
// code on Fennec, we dispatch a dummy mouse event that *does* get
// retargeted. The Fennec browser.js code can use this to activate the
// highlight element in case the this touchstart is the start of a tap.
WidgetMouseEvent hittest(true, eMouseHitTest, this,
WidgetMouseEvent::eReal);
- hittest.refPoint = aEvent.touches[0]->mRefPoint;
+ hittest.refPoint = aEvent.mTouches[0]->mRefPoint;
hittest.ignoreRootScrollFrame = true;
hittest.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
nsEventStatus status;
DispatchEvent(&hittest, status);
if (mAPZEventState && hittest.hitCluster) {
mAPZEventState->ProcessClusterHit();
}
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3441,21 +3441,21 @@ nsWindow::OnTouchEvent(GdkEventTouch* aE
WidgetTouchEvent event(true, msg, this);
KeymapWrapper::InitInputEvent(event, aEvent->state);
event.mTime = aEvent->time;
if (aEvent->type == GDK_TOUCH_BEGIN || aEvent->type == GDK_TOUCH_UPDATE) {
mTouches.Put(aEvent->sequence, touch.forget());
// add all touch points to event object
for (auto iter = mTouches.Iter(); !iter.Done(); iter.Next()) {
- event.touches.AppendElement(new dom::Touch(*iter.UserData()));
+ event.mTouches.AppendElement(new dom::Touch(*iter.UserData()));
}
} else if (aEvent->type == GDK_TOUCH_END ||
aEvent->type == GDK_TOUCH_CANCEL) {
- *event.touches.AppendElement() = touch.forget();
+ *event.mTouches.AppendElement() = touch.forget();
}
DispatchInputEvent(&event);
return TRUE;
}
#endif
static void
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -298,18 +298,18 @@ template<>
struct ParamTraits<mozilla::WidgetTouchEvent>
{
typedef mozilla::WidgetTouchEvent paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, static_cast<const mozilla::WidgetInputEvent&>(aParam));
// Sigh, Touch bites us again! We want to be able to do
- // WriteParam(aMsg, aParam.touches);
- const paramType::TouchArray& touches = aParam.touches;
+ // WriteParam(aMsg, aParam.mTouches);
+ const paramType::TouchArray& touches = aParam.mTouches;
WriteParam(aMsg, touches.Length());
for (uint32_t i = 0; i < touches.Length(); ++i) {
mozilla::dom::Touch* touch = touches[i];
WriteParam(aMsg, touch->mIdentifier);
WriteParam(aMsg, touch->mRefPoint);
WriteParam(aMsg, touch->mRadius);
WriteParam(aMsg, touch->mRotationAngle);
WriteParam(aMsg, touch->mForce);
@@ -332,17 +332,17 @@ struct ParamTraits<mozilla::WidgetTouchE
float force;
if (!ReadParam(aMsg, aIter, &identifier) ||
!ReadParam(aMsg, aIter, &refPoint) ||
!ReadParam(aMsg, aIter, &radius) ||
!ReadParam(aMsg, aIter, &rotationAngle) ||
!ReadParam(aMsg, aIter, &force)) {
return false;
}
- aResult->touches.AppendElement(
+ aResult->mTouches.AppendElement(
new mozilla::dom::Touch(
identifier, refPoint, radius, rotationAngle, force));
}
return true;
}
};
template<>
--- a/widget/uikit/nsWindow.mm
+++ b/widget/uikit/nsWindow.mm
@@ -165,30 +165,30 @@ private:
}
- (void)sendTouchEvent:(EventMessage) aType touches:(NSSet*)aTouches widget:(nsWindow*)aWindow
{
WidgetTouchEvent event(true, aType, aWindow);
//XXX: I think nativeEvent.timestamp * 1000 is probably usable here but
// I don't care that much right now.
event.mTime = PR_IntervalNow();
- event.touches.SetCapacity(aTouches.count);
+ event.mTouches.SetCapacity(aTouches.count);
for (UITouch* touch in aTouches) {
LayoutDeviceIntPoint loc = UIKitPointsToDevPixels([touch locationInView:self], [self contentScaleFactor]);
LayoutDeviceIntPoint radius = UIKitPointsToDevPixels([touch majorRadius], [touch majorRadius]);
void* value;
if (!CFDictionaryGetValueIfPresent(mTouches, touch, (const void**)&value)) {
// This shouldn't happen.
NS_ASSERTION(false, "Got a touch that we didn't know about");
continue;
}
int id = reinterpret_cast<int>(value);
RefPtr<Touch> t = new Touch(id, loc, radius, 0.0f, 1.0f);
event.refPoint = loc;
- event.touches.AppendElement(t);
+ event.mTouches.AppendElement(t);
}
aWindow->DispatchInputEvent(&event);
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
ALOG("[ChildView[%p] touchesBegan", self);
if (!mGeckoChild)