mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 920425 part.15 Use mozilla::WidgetEvent::AsTouchEvent() r=smaug
This commit is contained in:
parent
daf85a040a
commit
0260e27697
@ -732,7 +732,7 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
}
|
||||
case NS_TOUCH_EVENT:
|
||||
{
|
||||
WidgetTouchEvent* oldTouchEvent = static_cast<WidgetTouchEvent*>(mEvent);
|
||||
WidgetTouchEvent* oldTouchEvent = mEvent->AsTouchEvent();
|
||||
WidgetTouchEvent* touchEvent = new WidgetTouchEvent(false, oldTouchEvent);
|
||||
touchEvent->AssignTouchEventData(*oldTouchEvent, true);
|
||||
newEvent = touchEvent;
|
||||
|
@ -118,7 +118,7 @@ nsDOMTouchList*
|
||||
nsDOMTouchEvent::Touches()
|
||||
{
|
||||
if (!mTouches) {
|
||||
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(mEvent);
|
||||
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
|
||||
if (mEvent->message == NS_TOUCH_END || mEvent->message == NS_TOUCH_CANCEL) {
|
||||
// for touchend events, remove any changed touches from the touches array
|
||||
nsTArray< nsRefPtr<Touch> > unchangedTouches;
|
||||
@ -141,7 +141,7 @@ nsDOMTouchEvent::TargetTouches()
|
||||
{
|
||||
if (!mTargetTouches) {
|
||||
nsTArray< nsRefPtr<Touch> > targetTouches;
|
||||
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(mEvent);
|
||||
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
|
||||
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
|
||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||
// for touchend/cancel events, don't append to the target list if this is a
|
||||
@ -163,7 +163,7 @@ nsDOMTouchEvent::ChangedTouches()
|
||||
{
|
||||
if (!mChangedTouches) {
|
||||
nsTArray< nsRefPtr<Touch> > changedTouches;
|
||||
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(mEvent);
|
||||
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
|
||||
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
|
||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||
if (touches[i]->mChanged) {
|
||||
|
@ -743,7 +743,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
|
||||
static_cast<WidgetSimpleGestureEvent*>(aEvent));
|
||||
case NS_TOUCH_EVENT:
|
||||
return NS_NewDOMTouchEvent(aDOMEvent, aOwner, aPresContext,
|
||||
static_cast<WidgetTouchEvent*>(aEvent));
|
||||
aEvent->AsTouchEvent());
|
||||
case NS_TRANSITION_EVENT:
|
||||
return NS_NewDOMTransitionEvent(aDOMEvent, aOwner, aPresContext,
|
||||
aEvent->AsTransitionEvent());
|
||||
|
@ -1619,8 +1619,7 @@ nsEventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
|
||||
// Let the child process synthesize a mouse event if needed, and
|
||||
// ensure we don't synthesize one in this process.
|
||||
*aStatus = nsEventStatus_eConsumeNoDefault;
|
||||
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
|
||||
return remote->SendRealTouchEvent(*touchEvent);
|
||||
return remote->SendRealTouchEvent(*aEvent->AsTouchEvent());
|
||||
}
|
||||
default: {
|
||||
MOZ_CRASH("Attempt to send non-whitelisted event?");
|
||||
@ -1736,8 +1735,8 @@ nsEventStateManager::HandleCrossProcessEvent(WidgetEvent* aEvent,
|
||||
//
|
||||
// This loop is similar to the one used in
|
||||
// PresShell::DispatchTouchEvent().
|
||||
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
|
||||
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
|
||||
const nsTArray< nsRefPtr<Touch> >& touches =
|
||||
aEvent->AsTouchEvent()->touches;
|
||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||
Touch* touch = touches[i];
|
||||
// NB: the |mChanged| check is an optimization, subprocesses can
|
||||
|
@ -3808,9 +3808,7 @@ HTMLInputElement::PostHandleEventForRangeThumb(nsEventChainPostVisitor& aVisitor
|
||||
CancelRangeThumbDrag();
|
||||
}
|
||||
} else {
|
||||
WidgetTouchEvent* touchEvent =
|
||||
static_cast<WidgetTouchEvent*>(aVisitor.mEvent);
|
||||
if (touchEvent->touches.Length() == 1) {
|
||||
if (aVisitor.mEvent->AsTouchEvent()->touches.Length() == 1) {
|
||||
StartRangeThumbDrag(inputEvent);
|
||||
} else if (mIsDraggingRange) {
|
||||
CancelRangeThumbDrag();
|
||||
|
@ -626,10 +626,10 @@ TabParent::MapEventCoordinatesForChildProcess(
|
||||
aEvent->refPoint = aOffset;
|
||||
} else {
|
||||
aEvent->refPoint = LayoutDeviceIntPoint();
|
||||
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
|
||||
// Then offset all the touch points by that distance, to put them
|
||||
// in the space where top-left is 0,0.
|
||||
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
|
||||
const nsTArray< nsRefPtr<Touch> >& touches =
|
||||
aEvent->AsTouchEvent()->touches;
|
||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||
Touch* touch = touches[i];
|
||||
if (touch) {
|
||||
@ -741,7 +741,7 @@ TabParent::TryCapture(const WidgetGUIEvent& aEvent)
|
||||
return false;
|
||||
}
|
||||
|
||||
WidgetTouchEvent event(static_cast<const WidgetTouchEvent&>(aEvent));
|
||||
WidgetTouchEvent event(*aEvent.AsTouchEvent());
|
||||
|
||||
bool isTouchPointUp = (event.message == NS_TOUCH_END ||
|
||||
event.message == NS_TOUCH_CANCEL);
|
||||
|
@ -345,9 +345,8 @@ APZCTreeManager::ProcessTouchEvent(const WidgetTouchEvent& aEvent,
|
||||
gfx3DMatrix transformToScreen;
|
||||
GetInputTransforms(mApzcForInputBlock, transformToApzc, transformToScreen);
|
||||
gfx3DMatrix outTransform = transformToApzc * transformToScreen;
|
||||
WidgetTouchEvent* outEvent = static_cast<WidgetTouchEvent*>(aOutEvent);
|
||||
for (size_t i = 0; i < outEvent->touches.Length(); i++) {
|
||||
ApplyTransform(&(outEvent->touches[i]->mRefPoint), outTransform);
|
||||
for (size_t i = 0; i < aOutEvent->touches.Length(); i++) {
|
||||
ApplyTransform(&(aOutEvent->touches[i]->mRefPoint), outTransform);
|
||||
}
|
||||
|
||||
// If we have an mApzcForInputBlock and it's the end of the touch sequence
|
||||
@ -404,8 +403,7 @@ APZCTreeManager::ReceiveInputEvent(const WidgetInputEvent& aEvent,
|
||||
|
||||
switch (aEvent.eventStructType) {
|
||||
case NS_TOUCH_EVENT: {
|
||||
const WidgetTouchEvent& touchEvent =
|
||||
static_cast<const WidgetTouchEvent&>(aEvent);
|
||||
const WidgetTouchEvent& touchEvent = *aEvent.AsTouchEvent();
|
||||
if (!touchEvent.touches.Length()) {
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
@ -416,8 +414,7 @@ APZCTreeManager::ReceiveInputEvent(const WidgetInputEvent& aEvent,
|
||||
if (!mApzcForInputBlock) {
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
WidgetTouchEvent* outEvent = static_cast<WidgetTouchEvent*>(aOutEvent);
|
||||
return ProcessTouchEvent(touchEvent, outEvent);
|
||||
return ProcessTouchEvent(touchEvent, aOutEvent->AsTouchEvent());
|
||||
}
|
||||
case NS_MOUSE_EVENT: {
|
||||
// For b2g emulation
|
||||
@ -439,7 +436,7 @@ APZCTreeManager::ReceiveInputEvent(WidgetInputEvent& aEvent)
|
||||
|
||||
switch (aEvent.eventStructType) {
|
||||
case NS_TOUCH_EVENT: {
|
||||
WidgetTouchEvent& touchEvent = static_cast<WidgetTouchEvent&>(aEvent);
|
||||
WidgetTouchEvent& touchEvent = *aEvent.AsTouchEvent();
|
||||
if (!touchEvent.touches.Length()) {
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
@ -6199,7 +6199,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
|
||||
uint32_t flags = 0;
|
||||
if (aEvent->message == NS_TOUCH_START) {
|
||||
flags |= INPUT_IGNORE_ROOT_SCROLL_FRAME;
|
||||
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
|
||||
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
|
||||
@ -6331,7 +6331,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
|
||||
case NS_TOUCH_CANCEL:
|
||||
case NS_TOUCH_END: {
|
||||
// get the correct shell to dispatch to
|
||||
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
|
||||
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
|
||||
nsTArray< nsRefPtr<dom::Touch> >& touches = touchEvent->touches;
|
||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||
dom::Touch* touch = touches[i];
|
||||
@ -6721,7 +6721,7 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, nsEventStatus* aStatus)
|
||||
isHandlingUserInput = true;
|
||||
break;
|
||||
case NS_TOUCH_START: {
|
||||
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
|
||||
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
|
||||
@ -6749,7 +6749,7 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, nsEventStatus* aStatus)
|
||||
case NS_TOUCH_END: {
|
||||
// Remove the changed touches
|
||||
// need to make sure we only remove touches that are ending here
|
||||
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
|
||||
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
|
||||
nsTArray< nsRefPtr<dom::Touch> >& touches = touchEvent->touches;
|
||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||
dom::Touch* touch = touches[i];
|
||||
@ -6776,7 +6776,7 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, nsEventStatus* aStatus)
|
||||
}
|
||||
case NS_TOUCH_MOVE: {
|
||||
// Check for touches that changed. Mark them add to queue
|
||||
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
|
||||
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
|
||||
nsTArray< nsRefPtr<dom::Touch> >& touches = touchEvent->touches;
|
||||
bool haveChanged = false;
|
||||
for (int32_t i = touches.Length(); i; ) {
|
||||
@ -6941,7 +6941,7 @@ PresShell::DispatchTouchEvent(WidgetEvent* aEvent,
|
||||
(aEvent->message == NS_TOUCH_MOVE && aTouchIsNew);
|
||||
bool preventDefault = false;
|
||||
nsEventStatus tmpStatus = nsEventStatus_eIgnore;
|
||||
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
|
||||
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
|
||||
|
||||
// loop over all touches and dispatch events on any that have changed
|
||||
for (uint32_t i = 0; i < touchEvent->touches.Length(); ++i) {
|
||||
|
@ -477,10 +477,10 @@ nsRangeFrame::GetValueAtEventPoint(WidgetGUIEvent* aEvent)
|
||||
|
||||
LayoutDeviceIntPoint absPoint;
|
||||
if (aEvent->eventStructType == NS_TOUCH_EVENT) {
|
||||
MOZ_ASSERT(static_cast<WidgetTouchEvent*>(aEvent)->touches.Length() == 1,
|
||||
MOZ_ASSERT(aEvent->AsTouchEvent()->touches.Length() == 1,
|
||||
"Unexpected number of touches");
|
||||
absPoint = LayoutDeviceIntPoint::FromUntyped(
|
||||
static_cast<WidgetTouchEvent*>(aEvent)->touches[0]->mRefPoint);
|
||||
aEvent->AsTouchEvent()->touches[0]->mRefPoint);
|
||||
} else {
|
||||
absPoint = aEvent->refPoint;
|
||||
}
|
||||
|
@ -2080,8 +2080,8 @@ bool
|
||||
nsBoxFrame::GetEventPoint(WidgetGUIEvent* aEvent, nsIntPoint &aPoint) {
|
||||
NS_ENSURE_TRUE(aEvent, false);
|
||||
|
||||
if (aEvent->eventStructType == NS_TOUCH_EVENT) {
|
||||
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user