diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-02-04 23:15:50 +0100 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-02-04 23:15:50 +0100 |
commit | 80f9b75efa08ea449937298b791ff278cbf5fa22 (patch) | |
tree | 24175cc50098581dd604d32d84fe27249931792f /dom/events/EventStateManager.cpp | |
parent | 3ef4f63ec257cf90ad4bf8695a1e4e291f811af2 (diff) | |
download | UXP-80f9b75efa08ea449937298b791ff278cbf5fa22.tar UXP-80f9b75efa08ea449937298b791ff278cbf5fa22.tar.gz UXP-80f9b75efa08ea449937298b791ff278cbf5fa22.tar.lz UXP-80f9b75efa08ea449937298b791ff278cbf5fa22.tar.xz UXP-80f9b75efa08ea449937298b791ff278cbf5fa22.zip |
Implement auxclick
Bug(s):
https://bugzilla.mozilla.org/show_bug.cgi?id=1304044
(native in moebius)
Diffstat (limited to 'dom/events/EventStateManager.cpp')
-rw-r--r-- | dom/events/EventStateManager.cpp | 66 |
1 files changed, 41 insertions, 25 deletions
diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp index 659629066..25bf96078 100644 --- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -492,6 +492,7 @@ IsMessageMouseUserActivity(EventMessage aMessage) return aMessage == eMouseMove || aMessage == eMouseUp || aMessage == eMouseDown || + aMessage == eMouseAuxClick || aMessage == eMouseDoubleClick || aMessage == eMouseClick || aMessage == eMouseActivate || @@ -4646,6 +4647,32 @@ EventStateManager::SetClickCount(WidgetMouseEvent* aEvent, } nsresult +EventStateManager::InitAndDispatchClickEvent(WidgetMouseEvent* aEvent, + nsEventStatus* aStatus, + EventMessage aMessage, + nsIPresShell* aPresShell, + nsIContent* aMouseTarget, + nsWeakFrame aCurrentTarget, + bool aNoContentDispatch) +{ + WidgetMouseEvent event(aEvent->IsTrusted(), aMessage, + aEvent->mWidget, WidgetMouseEvent::eReal); + + event.mRefPoint = aEvent->mRefPoint; + event.mClickCount = aEvent->mClickCount; + event.mModifiers = aEvent->mModifiers; + event.buttons = aEvent->buttons; + event.mTime = aEvent->mTime; + event.mTimeStamp = aEvent->mTimeStamp; + event.mFlags.mNoContentDispatch = aNoContentDispatch; + event.button = aEvent->button; + event.inputSource = aEvent->inputSource; + + return aPresShell->HandleEventWithTarget(&event, aCurrentTarget, + aMouseTarget, aStatus); +} + +nsresult EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent, nsEventStatus* aStatus) { @@ -4664,17 +4691,7 @@ EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent, (aEvent->button == WidgetMouseEvent::eMiddleButton || aEvent->button == WidgetMouseEvent::eRightButton); - WidgetMouseEvent event(aEvent->IsTrusted(), eMouseClick, - aEvent->mWidget, WidgetMouseEvent::eReal); - event.mRefPoint = aEvent->mRefPoint; - event.mClickCount = aEvent->mClickCount; - event.mModifiers = aEvent->mModifiers; - event.buttons = aEvent->buttons; - event.mTime = aEvent->mTime; - event.mTimeStamp = aEvent->mTimeStamp; - event.mFlags.mNoContentDispatch = notDispatchToContents; - event.button = aEvent->button; - event.inputSource = aEvent->inputSource; + bool fireAuxClick = notDispatchToContents; nsCOMPtr<nsIPresShell> presShell = mPresContext->GetPresShell(); if (presShell) { @@ -4693,23 +4710,22 @@ EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent, // HandleEvent clears out mCurrentTarget which we might need again nsWeakFrame currentTarget = mCurrentTarget; - ret = presShell->HandleEventWithTarget(&event, currentTarget, - mouseContent, aStatus); + ret = InitAndDispatchClickEvent(aEvent, aStatus, eMouseClick, + presShell, mouseContent, currentTarget, + notDispatchToContents); + if (NS_SUCCEEDED(ret) && aEvent->mClickCount == 2 && mouseContent && mouseContent->IsInComposedDoc()) { //fire double click - WidgetMouseEvent event2(aEvent->IsTrusted(), eMouseDoubleClick, - aEvent->mWidget, WidgetMouseEvent::eReal); - event2.mRefPoint = aEvent->mRefPoint; - event2.mClickCount = aEvent->mClickCount; - event2.mModifiers = aEvent->mModifiers; - event2.buttons = aEvent->buttons; - event2.mFlags.mNoContentDispatch = notDispatchToContents; - event2.button = aEvent->button; - event2.inputSource = aEvent->inputSource; - - ret = presShell->HandleEventWithTarget(&event2, currentTarget, - mouseContent, aStatus); + ret = InitAndDispatchClickEvent(aEvent, aStatus, eMouseDoubleClick, + presShell, mouseContent, currentTarget, + notDispatchToContents); + } + if (NS_SUCCEEDED(ret) && mouseContent && fireAuxClick && + mouseContent->IsInComposedDoc()) { + ret = InitAndDispatchClickEvent(aEvent, aStatus, eMouseAuxClick, + presShell, mouseContent, currentTarget, + false); } } } |