Bug 1299209 - Part 1: Passing PointerId when a new WidgetMouseEvent is created. h=sshih, r=smaug

--HG--
extra : rebase_source : b123e74425e56c09ab38f5916589abb84c3d5996
This commit is contained in:
Ho-Pang 2016-12-20 22:53:00 -05:00
parent e819c6a3d3
commit 41adef3ae2
6 changed files with 14 additions and 5 deletions

View File

@ -2146,17 +2146,20 @@ Element::DispatchClickEvent(nsPresContext* aPresContext,
event.mRefPoint = aSourceEvent->mRefPoint;
uint32_t clickCount = 1;
float pressure = 0;
uint32_t pointerId = 0; // Use the default value here.
uint16_t inputSource = 0;
WidgetMouseEvent* sourceMouseEvent = aSourceEvent->AsMouseEvent();
if (sourceMouseEvent) {
clickCount = sourceMouseEvent->mClickCount;
pressure = sourceMouseEvent->pressure;
pointerId = sourceMouseEvent->pointerId;
inputSource = sourceMouseEvent->inputSource;
} else if (aSourceEvent->mClass == eKeyboardEventClass) {
inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
}
event.pressure = pressure;
event.mClickCount = clickCount;
event.pointerId = pointerId;
event.inputSource = inputSource;
event.mModifiers = aSourceEvent->mModifiers;
if (aExtraEventFlags) {

View File

@ -4497,6 +4497,7 @@ EventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
event.mModifiers = aDragEvent->mModifiers;
event.buttons = aDragEvent->buttons;
event.relatedTarget = aRelatedTarget;
event.pointerId = aDragEvent->pointerId;
event.inputSource = aDragEvent->inputSource;
mCurrentTargetContent = aTargetContent;
@ -4648,6 +4649,7 @@ EventStateManager::InitAndDispatchClickEvent(WidgetMouseEvent* aEvent,
event.mTimeStamp = aEvent->mTimeStamp;
event.mFlags.mNoContentDispatch = aNoContentDispatch;
event.button = aEvent->button;
event.pointerId = aEvent->pointerId;
event.inputSource = aEvent->inputSource;
return aPresShell->HandleEventWithTarget(&event, aCurrentTarget,

View File

@ -1558,7 +1558,8 @@ TabChild::RecvMouseEvent(const nsString& aType,
const bool& aIgnoreRootScrollFrame)
{
APZCCallbackHelper::DispatchMouseEvent(GetPresShell(), aType, CSSPoint(aX, aY),
aButton, aClickCount, aModifiers, aIgnoreRootScrollFrame, nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN);
aButton, aClickCount, aModifiers, aIgnoreRootScrollFrame,
nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN, 0 /* Use the default value here. */);
return IPC_OK();
}

View File

@ -513,14 +513,15 @@ APZCCallbackHelper::DispatchMouseEvent(const nsCOMPtr<nsIPresShell>& aPresShell,
int32_t aClickCount,
int32_t aModifiers,
bool aIgnoreRootScrollFrame,
unsigned short aInputSourceArg)
unsigned short aInputSourceArg,
uint32_t aPointerId)
{
NS_ENSURE_TRUE(aPresShell, true);
bool defaultPrevented = false;
nsContentUtils::SendMouseEvent(aPresShell, aType, aPoint.x, aPoint.y,
aButton, nsIDOMWindowUtils::MOUSE_BUTTONS_NOT_SPECIFIED, aClickCount,
aModifiers, aIgnoreRootScrollFrame, 0, aInputSourceArg, false,
aModifiers, aIgnoreRootScrollFrame, 0, aInputSourceArg, aPointerId, false,
&defaultPrevented, false, /* aIsWidgetEventSynthesized = */ false);
return defaultPrevented;
}

View File

@ -121,7 +121,8 @@ public:
int32_t aClickCount,
int32_t aModifiers,
bool aIgnoreRootScrollFrame,
unsigned short aInputSourceArg);
unsigned short aInputSourceArg,
uint32_t aPointerId);
/* Fire a single-tap event at the given point. The event is dispatched
* via the given widget. */

View File

@ -222,7 +222,8 @@ APZEventState::FireContextmenuEvents(const nsCOMPtr<nsIPresShell>& aPresShell,
bool eventHandled =
APZCCallbackHelper::DispatchMouseEvent(aPresShell, NS_LITERAL_STRING("contextmenu"),
aPoint, 2, 1, WidgetModifiersToDOMModifiers(aModifiers), true,
nsIDOMMouseEvent::MOZ_SOURCE_TOUCH);
nsIDOMMouseEvent::MOZ_SOURCE_TOUCH,
0 /* Use the default value here. */);
APZES_LOG("Contextmenu event handled: %d\n", eventHandled);
if (eventHandled) {