Skip to content

Commit d3aa0d6

Browse files
Bug 920377 part.13 Get rid of nsTouchEvent r=roc
1 parent 57399c8 commit d3aa0d6

31 files changed

+102
-96
lines changed

accessible/src/base/nsCoreUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ nsCoreUtils::DispatchTouchEvent(uint32_t aEventType, int32_t aX, int32_t aY,
144144
if (!nsDOMTouchEvent::PrefEnabled())
145145
return;
146146

147-
nsTouchEvent event(true, aEventType, aRootWidget);
147+
WidgetTouchEvent event(true, aEventType, aRootWidget);
148148

149149
event.time = PR_IntervalNow();
150150

content/events/src/nsDOMEvent.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,8 +741,8 @@ nsDOMEvent::DuplicatePrivateData()
741741
}
742742
case NS_TOUCH_EVENT:
743743
{
744-
nsTouchEvent* oldTouchEvent = static_cast<nsTouchEvent*>(mEvent);
745-
nsTouchEvent* touchEvent = new nsTouchEvent(false, oldTouchEvent);
744+
WidgetTouchEvent* oldTouchEvent = static_cast<WidgetTouchEvent*>(mEvent);
745+
WidgetTouchEvent* touchEvent = new WidgetTouchEvent(false, oldTouchEvent);
746746
touchEvent->AssignTouchEventData(*oldTouchEvent, true);
747747
newEvent = touchEvent;
748748
break;

content/events/src/nsDOMTouchEvent.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ nsDOMTouchList::IdentifiedTouch(int32_t aIdentifier) const
5454

5555
nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
5656
nsPresContext* aPresContext,
57-
nsTouchEvent* aEvent)
57+
WidgetTouchEvent* aEvent)
5858
: nsDOMUIEvent(aOwner, aPresContext,
59-
aEvent ? aEvent : new nsTouchEvent(false, 0, nullptr))
59+
aEvent ? aEvent : new WidgetTouchEvent(false, 0, nullptr))
6060
{
6161
if (aEvent) {
6262
mEventIsInternal = false;
@@ -74,7 +74,7 @@ nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
7474
nsDOMTouchEvent::~nsDOMTouchEvent()
7575
{
7676
if (mEventIsInternal && mEvent) {
77-
delete static_cast<nsTouchEvent*>(mEvent);
77+
delete static_cast<WidgetTouchEvent*>(mEvent);
7878
mEvent = nullptr;
7979
}
8080
}
@@ -126,7 +126,7 @@ nsDOMTouchList*
126126
nsDOMTouchEvent::Touches()
127127
{
128128
if (!mTouches) {
129-
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(mEvent);
129+
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(mEvent);
130130
if (mEvent->message == NS_TOUCH_END || mEvent->message == NS_TOUCH_CANCEL) {
131131
// for touchend events, remove any changed touches from the touches array
132132
nsTArray< nsRefPtr<Touch> > unchangedTouches;
@@ -149,7 +149,7 @@ nsDOMTouchEvent::TargetTouches()
149149
{
150150
if (!mTargetTouches) {
151151
nsTArray< nsRefPtr<Touch> > targetTouches;
152-
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(mEvent);
152+
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(mEvent);
153153
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
154154
for (uint32_t i = 0; i < touches.Length(); ++i) {
155155
// for touchend/cancel events, don't append to the target list if this is a
@@ -171,7 +171,7 @@ nsDOMTouchEvent::ChangedTouches()
171171
{
172172
if (!mChangedTouches) {
173173
nsTArray< nsRefPtr<Touch> > changedTouches;
174-
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(mEvent);
174+
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(mEvent);
175175
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
176176
for (uint32_t i = 0; i < touches.Length(); ++i) {
177177
if (touches[i]->mChanged) {
@@ -225,7 +225,7 @@ nsresult
225225
NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult,
226226
mozilla::dom::EventTarget* aOwner,
227227
nsPresContext* aPresContext,
228-
nsTouchEvent *aEvent)
228+
WidgetTouchEvent* aEvent)
229229
{
230230
nsDOMTouchEvent* it = new nsDOMTouchEvent(aOwner, aPresContext, aEvent);
231231
return CallQueryInterface(it, aInstancePtrResult);

content/events/src/nsDOMTouchEvent.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ class nsDOMTouchEvent : public nsDOMUIEvent
8282
{
8383
public:
8484
nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
85-
nsPresContext* aPresContext, nsTouchEvent* aEvent);
85+
nsPresContext* aPresContext,
86+
mozilla::WidgetTouchEvent* aEvent);
8687
virtual ~nsDOMTouchEvent();
8788

8889
NS_DECL_ISUPPORTS_INHERITED

content/events/src/nsEventDispatcher.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
741741
static_cast<nsSimpleGestureEvent*>(aEvent));
742742
case NS_TOUCH_EVENT:
743743
return NS_NewDOMTouchEvent(aDOMEvent, aOwner, aPresContext,
744-
static_cast<nsTouchEvent*>(aEvent));
744+
static_cast<WidgetTouchEvent*>(aEvent));
745745
case NS_TRANSITION_EVENT:
746746
return NS_NewDOMTransitionEvent(aDOMEvent, aOwner, aPresContext,
747747
static_cast<InternalTransitionEvent*>(aEvent));

content/events/src/nsEventStateManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ nsEventStateManager::DispatchCrossProcessEvent(nsEvent* aEvent,
13991399
// Let the child process synthesize a mouse event if needed, and
14001400
// ensure we don't synthesize one in this process.
14011401
*aStatus = nsEventStatus_eConsumeNoDefault;
1402-
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
1402+
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
14031403
return remote->SendRealTouchEvent(*touchEvent);
14041404
}
14051405
default: {
@@ -1516,7 +1516,7 @@ nsEventStateManager::HandleCrossProcessEvent(nsEvent *aEvent,
15161516
//
15171517
// This loop is similar to the one used in
15181518
// PresShell::DispatchTouchEvent().
1519-
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
1519+
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
15201520
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
15211521
for (uint32_t i = 0; i < touches.Length(); ++i) {
15221522
Touch* touch = touches[i];

content/html/content/src/HTMLInputElement.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3709,7 +3709,8 @@ HTMLInputElement::PostHandleEventForRangeThumb(nsEventChainPostVisitor& aVisitor
37093709
CancelRangeThumbDrag();
37103710
}
37113711
} else {
3712-
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aVisitor.mEvent);
3712+
WidgetTouchEvent* touchEvent =
3713+
static_cast<WidgetTouchEvent*>(aVisitor.mEvent);
37133714
if (touchEvent->touches.Length() == 1) {
37143715
StartRangeThumbDrag(inputEvent);
37153716
} else if (mIsDraggingRange) {

dom/base/nsDOMWindowUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ nsDOMWindowUtils::SendTouchEvent(const nsAString& aType,
876876
} else {
877877
return NS_ERROR_UNEXPECTED;
878878
}
879-
nsTouchEvent event(true, msg, widget);
879+
WidgetTouchEvent event(true, msg, widget);
880880
event.modifiers = GetWidgetModifiers(aModifiers);
881881
event.widget = widget;
882882
event.time = PR_Now();

dom/interfaces/events/nsIDOMEvent.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ nsresult
375375
NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult,
376376
mozilla::dom::EventTarget* aOwner,
377377
nsPresContext* aPresContext,
378-
nsTouchEvent* aEvent);
378+
mozilla::WidgetTouchEvent* aEvent);
379379
nsresult
380380
NS_NewDOMMozSettingsEvent(nsIDOMEvent** aInstancePtrResult,
381381
mozilla::dom::EventTarget* aOwner,

dom/ipc/PBrowser.ipdl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ using nsQueryContentEvent;
4949
using nsRect;
5050
using nsSelectionEvent;
5151
using nsTextEvent;
52-
using nsTouchEvent;
52+
using mozilla::WidgetTouchEvent;
5353
using RemoteDOMEvent;
5454
using mozilla::dom::ScreenOrientation;
5555
using mozilla::layers::TextureFactoryIdentifier;
@@ -367,10 +367,10 @@ child:
367367
RealMouseEvent(nsMouseEvent event);
368368
RealKeyEvent(nsKeyEvent event);
369369
MouseWheelEvent(WheelEvent event);
370-
RealTouchEvent(nsTouchEvent event);
370+
RealTouchEvent(WidgetTouchEvent event);
371371
// We use a separate message for touchmove events only to apply
372372
// compression to them.
373-
RealTouchMoveEvent(nsTouchEvent event) compress;
373+
RealTouchMoveEvent(WidgetTouchEvent event) compress;
374374

375375
/**
376376
* @see nsIDOMWindowUtils sendKeyEvent.

dom/ipc/TabChild.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,7 +1702,7 @@ TabChild::DispatchSynthesizedMouseEvent(uint32_t aMsg, uint64_t aTime,
17021702
}
17031703

17041704
static Touch*
1705-
GetTouchForIdentifier(const nsTouchEvent& aEvent, int32_t aId)
1705+
GetTouchForIdentifier(const WidgetTouchEvent& aEvent, int32_t aId)
17061706
{
17071707
for (uint32_t i = 0; i < aEvent.touches.Length(); ++i) {
17081708
Touch* touch = static_cast<Touch*>(aEvent.touches[i].get());
@@ -1714,7 +1714,7 @@ GetTouchForIdentifier(const nsTouchEvent& aEvent, int32_t aId)
17141714
}
17151715

17161716
void
1717-
TabChild::UpdateTapState(const nsTouchEvent& aEvent, nsEventStatus aStatus)
1717+
TabChild::UpdateTapState(const WidgetTouchEvent& aEvent, nsEventStatus aStatus)
17181718
{
17191719
static bool sHavePrefs;
17201720
static bool sClickHoldContextMenusEnabled;
@@ -1833,9 +1833,9 @@ TabChild::CancelTapTracking()
18331833
}
18341834

18351835
bool
1836-
TabChild::RecvRealTouchEvent(const nsTouchEvent& aEvent)
1836+
TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent)
18371837
{
1838-
nsTouchEvent localEvent(aEvent);
1838+
WidgetTouchEvent localEvent(aEvent);
18391839
nsEventStatus status = DispatchWidgetEvent(localEvent);
18401840

18411841
if (IsAsyncPanZoomEnabled()) {
@@ -1853,7 +1853,7 @@ TabChild::RecvRealTouchEvent(const nsTouchEvent& aEvent)
18531853
}
18541854

18551855
bool
1856-
TabChild::RecvRealTouchMoveEvent(const nsTouchEvent& aEvent)
1856+
TabChild::RecvRealTouchMoveEvent(const WidgetTouchEvent& aEvent)
18571857
{
18581858
return RecvRealTouchEvent(aEvent);
18591859
}

dom/ipc/TabChild.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ class TabChild : public PBrowserChild,
218218
virtual bool RecvRealMouseEvent(const nsMouseEvent& event);
219219
virtual bool RecvRealKeyEvent(const nsKeyEvent& event);
220220
virtual bool RecvMouseWheelEvent(const mozilla::WheelEvent& event);
221-
virtual bool RecvRealTouchEvent(const nsTouchEvent& event);
222-
virtual bool RecvRealTouchMoveEvent(const nsTouchEvent& event);
221+
virtual bool RecvRealTouchEvent(const WidgetTouchEvent& event);
222+
virtual bool RecvRealTouchMoveEvent(const WidgetTouchEvent& event);
223223
virtual bool RecvKeyEvent(const nsString& aType,
224224
const int32_t& aKeyCode,
225225
const int32_t& aCharCode,
@@ -442,7 +442,7 @@ class TabChild : public PBrowserChild,
442442
// FireContextMenuEvent().
443443
void FireContextMenuEvent();
444444
void CancelTapTracking();
445-
void UpdateTapState(const nsTouchEvent& aEvent, nsEventStatus aStatus);
445+
void UpdateTapState(const WidgetTouchEvent& aEvent, nsEventStatus aStatus);
446446

447447
nsresult
448448
BrowserFrameProvideWindow(nsIDOMWindow* aOpener,

dom/ipc/TabParent.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ TabParent::MapEventCoordinatesForChildProcess(
621621
aEvent->refPoint = aOffset;
622622
} else {
623623
aEvent->refPoint = LayoutDeviceIntPoint();
624-
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
624+
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
625625
// Then offset all the touch points by that distance, to put them
626626
// in the space where top-left is 0,0.
627627
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
@@ -673,7 +673,7 @@ bool TabParent::SendRealKeyEvent(nsKeyEvent& event)
673673
return PBrowserParent::SendRealKeyEvent(e);
674674
}
675675

676-
bool TabParent::SendRealTouchEvent(nsTouchEvent& event)
676+
bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
677677
{
678678
if (mIsDestroyed) {
679679
return false;
@@ -699,7 +699,7 @@ bool TabParent::SendRealTouchEvent(nsTouchEvent& event)
699699
++mEventCaptureDepth;
700700
}
701701

702-
nsTouchEvent e(event);
702+
WidgetTouchEvent e(event);
703703
// PresShell::HandleEventInternal adds touches on touch end/cancel.
704704
// This confuses remote content into thinking that the added touches
705705
// are part of the touchend/cancel, when actually they're not.
@@ -736,7 +736,7 @@ TabParent::TryCapture(const nsGUIEvent& aEvent)
736736
return false;
737737
}
738738

739-
nsTouchEvent event(static_cast<const nsTouchEvent&>(aEvent));
739+
WidgetTouchEvent event(static_cast<const WidgetTouchEvent&>(aEvent));
740740

741741
bool isTouchPointUp = (event.message == NS_TOUCH_END ||
742742
event.message == NS_TOUCH_CANCEL);

dom/ipc/TabParent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class TabParent : public PBrowserParent
196196
bool SendRealMouseEvent(nsMouseEvent& event);
197197
bool SendMouseWheelEvent(mozilla::WheelEvent& event);
198198
bool SendRealKeyEvent(nsKeyEvent& event);
199-
bool SendRealTouchEvent(nsTouchEvent& event);
199+
bool SendRealTouchEvent(WidgetTouchEvent& event);
200200

201201
virtual PDocumentRendererParent*
202202
AllocPDocumentRendererParent(const nsRect& documentRect, const gfxMatrix& transform,

gfx/layers/composite/APZCTreeManager.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ APZCTreeManager::ReceiveInputEvent(const InputData& aEvent)
297297
}
298298

299299
AsyncPanZoomController*
300-
APZCTreeManager::GetTouchInputBlockAPZC(const nsTouchEvent& aEvent, ScreenPoint aPoint)
300+
APZCTreeManager::GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent,
301+
ScreenPoint aPoint)
301302
{
302303
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aPoint);
303304
gfx3DMatrix transformToApzc, transformToScreen;
@@ -325,8 +326,8 @@ APZCTreeManager::GetTouchInputBlockAPZC(const nsTouchEvent& aEvent, ScreenPoint
325326
}
326327

327328
nsEventStatus
328-
APZCTreeManager::ProcessTouchEvent(const nsTouchEvent& aEvent,
329-
nsTouchEvent* aOutEvent)
329+
APZCTreeManager::ProcessTouchEvent(const WidgetTouchEvent& aEvent,
330+
WidgetTouchEvent* aOutEvent)
330331
{
331332
// For computing the input for the APZC, used the cached transform.
332333
// This ensures that the sequence of touch points an APZC sees in an
@@ -344,7 +345,7 @@ APZCTreeManager::ProcessTouchEvent(const nsTouchEvent& aEvent,
344345
gfx3DMatrix transformToScreen;
345346
GetInputTransforms(mApzcForInputBlock, transformToApzc, transformToScreen);
346347
gfx3DMatrix outTransform = transformToApzc * transformToScreen;
347-
nsTouchEvent* outEvent = static_cast<nsTouchEvent*>(aOutEvent);
348+
WidgetTouchEvent* outEvent = static_cast<WidgetTouchEvent*>(aOutEvent);
348349
for (size_t i = 0; i < outEvent->touches.Length(); i++) {
349350
ApplyTransform(&(outEvent->touches[i]->mRefPoint), outTransform);
350351
}
@@ -402,7 +403,8 @@ APZCTreeManager::ReceiveInputEvent(const nsInputEvent& aEvent,
402403

403404
switch (aEvent.eventStructType) {
404405
case NS_TOUCH_EVENT: {
405-
const nsTouchEvent& touchEvent = static_cast<const nsTouchEvent&>(aEvent);
406+
const WidgetTouchEvent& touchEvent =
407+
static_cast<const WidgetTouchEvent&>(aEvent);
406408
if (!touchEvent.touches.Length()) {
407409
return nsEventStatus_eIgnore;
408410
}
@@ -413,7 +415,7 @@ APZCTreeManager::ReceiveInputEvent(const nsInputEvent& aEvent,
413415
if (!mApzcForInputBlock) {
414416
return nsEventStatus_eIgnore;
415417
}
416-
nsTouchEvent* outEvent = static_cast<nsTouchEvent*>(aOutEvent);
418+
WidgetTouchEvent* outEvent = static_cast<WidgetTouchEvent*>(aOutEvent);
417419
return ProcessTouchEvent(touchEvent, outEvent);
418420
}
419421
case NS_MOUSE_EVENT: {
@@ -435,7 +437,7 @@ APZCTreeManager::ReceiveInputEvent(nsInputEvent& aEvent)
435437

436438
switch (aEvent.eventStructType) {
437439
case NS_TOUCH_EVENT: {
438-
nsTouchEvent& touchEvent = static_cast<nsTouchEvent&>(aEvent);
440+
WidgetTouchEvent& touchEvent = static_cast<WidgetTouchEvent&>(aEvent);
439441
if (!touchEvent.touches.Length()) {
440442
return nsEventStatus_eIgnore;
441443
}

gfx/layers/composite/APZCTreeManager.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class APZCTreeManager {
148148
/**
149149
* nsInputEvent handler. Sets |aOutEvent| (which is assumed to be an
150150
* already-existing instance of an nsInputEvent which may be an
151-
* nsTouchEvent) to have its coordinates in DOM space. This is so that the
151+
* WidgetTouchEvent) to have its coordinates in DOM space. This is so that the
152152
* event can be passed through the DOM and content can handle them.
153153
*
154154
* NOTE: Be careful of invoking the nsInputEvent variant. This can only be
@@ -300,8 +300,8 @@ class APZCTreeManager {
300300
AsyncPanZoomController* GetAPZCAtPoint(AsyncPanZoomController* aApzc, const gfxPoint& aHitTestPoint);
301301
AsyncPanZoomController* CommonAncestor(AsyncPanZoomController* aApzc1, AsyncPanZoomController* aApzc2);
302302
AsyncPanZoomController* RootAPZCForLayersId(AsyncPanZoomController* aApzc);
303-
AsyncPanZoomController* GetTouchInputBlockAPZC(const nsTouchEvent& aEvent, ScreenPoint aPoint);
304-
nsEventStatus ProcessTouchEvent(const nsTouchEvent& touchEvent, nsTouchEvent* aOutEvent);
303+
AsyncPanZoomController* GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent, ScreenPoint aPoint);
304+
nsEventStatus ProcessTouchEvent(const WidgetTouchEvent& touchEvent, WidgetTouchEvent* aOutEvent);
305305
nsEventStatus ProcessMouseEvent(const nsMouseEvent& mouseEvent, nsMouseEvent* aOutEvent);
306306
nsEventStatus ProcessEvent(const nsInputEvent& inputEvent, nsInputEvent* aOutEvent);
307307

0 commit comments

Comments
 (0)