mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 930860 Move IsLeftClickEvent() and IsContextMenuKeyEvent() from WidgetEvent to WidgetMouseEvent(Base) r=smaug
This commit is contained in:
parent
6e5f3115ff
commit
221421aeb2
@ -2245,11 +2245,11 @@ Element::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_MOUSE_CLICK:
|
||||
if (aVisitor.mEvent->IsLeftClickEvent()) {
|
||||
WidgetInputEvent* inputEvent = aVisitor.mEvent->AsInputEvent();
|
||||
if (inputEvent->IsControl() || inputEvent->IsMeta() ||
|
||||
inputEvent->IsAlt() ||inputEvent->IsShift()) {
|
||||
case NS_MOUSE_CLICK: {
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
if (mouseEvent->IsLeftClickEvent()) {
|
||||
if (mouseEvent->IsControl() || mouseEvent->IsMeta() ||
|
||||
mouseEvent->IsAlt() ||mouseEvent->IsShift()) {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2258,7 +2258,7 @@ Element::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
|
||||
if (shell) {
|
||||
// single-click
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
InternalUIEvent actEvent(aVisitor.mEvent->mFlags.mIsTrusted,
|
||||
InternalUIEvent actEvent(mouseEvent->mFlags.mIsTrusted,
|
||||
NS_UI_ACTIVATE, 1);
|
||||
|
||||
rv = shell->HandleDOMEventWithTarget(this, &actEvent, &status);
|
||||
@ -2268,7 +2268,7 @@ Element::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
case NS_UI_ACTIVATE:
|
||||
{
|
||||
if (aVisitor.mEvent->originalTarget == this) {
|
||||
|
@ -1009,22 +1009,23 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
#endif
|
||||
// Store last known screenPoint and clientPoint so pointer lock
|
||||
// can use these values as constants.
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
if (aEvent->mFlags.mIsTrusted &&
|
||||
((aEvent->IsMouseDerivedEvent() && IsMouseEventReal(aEvent)) ||
|
||||
aEvent->eventStructType == NS_WHEEL_EVENT)) {
|
||||
if (!sIsPointerLocked) {
|
||||
sLastScreenPoint = nsDOMUIEvent::CalculateScreenPoint(aPresContext, aEvent);
|
||||
sLastClientPoint = nsDOMUIEvent::CalculateClientPoint(aPresContext, aEvent, nullptr);
|
||||
}
|
||||
((mouseEvent && IsMouseEventReal(mouseEvent)) ||
|
||||
aEvent->eventStructType == NS_WHEEL_EVENT) &&
|
||||
!sIsPointerLocked) {
|
||||
sLastScreenPoint =
|
||||
nsDOMUIEvent::CalculateScreenPoint(aPresContext, aEvent);
|
||||
sLastClientPoint =
|
||||
nsDOMUIEvent::CalculateClientPoint(aPresContext, aEvent, nullptr);
|
||||
}
|
||||
|
||||
// Do not take account NS_MOUSE_ENTER/EXIT so that loading a page
|
||||
// when user is not active doesn't change the state to active.
|
||||
if (aEvent->mFlags.mIsTrusted &&
|
||||
((aEvent->eventStructType == NS_MOUSE_EVENT &&
|
||||
IsMouseEventReal(aEvent) &&
|
||||
aEvent->message != NS_MOUSE_ENTER &&
|
||||
aEvent->message != NS_MOUSE_EXIT) ||
|
||||
((mouseEvent && IsMouseEventReal(mouseEvent) &&
|
||||
mouseEvent->message != NS_MOUSE_ENTER &&
|
||||
mouseEvent->message != NS_MOUSE_EXIT) ||
|
||||
aEvent->eventStructType == NS_WHEEL_EVENT ||
|
||||
aEvent->eventStructType == NS_KEY_EVENT)) {
|
||||
if (gMouseOrKeyboardEventCounter == 0) {
|
||||
@ -1044,7 +1045,6 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
|
||||
switch (aEvent->message) {
|
||||
case NS_MOUSE_BUTTON_DOWN: {
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
switch (mouseEvent->button) {
|
||||
case WidgetMouseEvent::eLeftButton:
|
||||
#ifndef XP_OS2
|
||||
@ -1069,7 +1069,6 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
break;
|
||||
}
|
||||
case NS_MOUSE_BUTTON_UP: {
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
switch (mouseEvent->button) {
|
||||
case WidgetMouseEvent::eLeftButton:
|
||||
if (Prefs::ClickHoldContextMenu()) {
|
||||
@ -1095,21 +1094,18 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
// If the event is not a top-level window exit, then it's not
|
||||
// really an exit --- we may have traversed widget boundaries but
|
||||
// we're still in our toplevel window.
|
||||
{
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
if (mouseEvent->exit != WidgetMouseEvent::eTopLevel) {
|
||||
// Treat it as a synthetic move so we don't generate spurious
|
||||
// "exit" or "move" events. Any necessary "out" or "over" events
|
||||
// will be generated by GenerateMouseEnterExit
|
||||
mouseEvent->message = NS_MOUSE_MOVE;
|
||||
mouseEvent->reason = WidgetMouseEvent::eSynthesized;
|
||||
// then fall through...
|
||||
} else {
|
||||
GenerateMouseEnterExit(mouseEvent);
|
||||
//This is a window level mouse exit event and should stop here
|
||||
aEvent->message = 0;
|
||||
break;
|
||||
}
|
||||
if (mouseEvent->exit != WidgetMouseEvent::eTopLevel) {
|
||||
// Treat it as a synthetic move so we don't generate spurious
|
||||
// "exit" or "move" events. Any necessary "out" or "over" events
|
||||
// will be generated by GenerateMouseEnterExit
|
||||
mouseEvent->message = NS_MOUSE_MOVE;
|
||||
mouseEvent->reason = WidgetMouseEvent::eSynthesized;
|
||||
// then fall through...
|
||||
} else {
|
||||
GenerateMouseEnterExit(mouseEvent);
|
||||
//This is a window level mouse exit event and should stop here
|
||||
aEvent->message = 0;
|
||||
break;
|
||||
}
|
||||
case NS_MOUSE_MOVE: {
|
||||
// on the Mac, GenerateDragGesture() may not return until the drag
|
||||
@ -1118,7 +1114,6 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
// that ClearFrameRefs() has been called and it cleared out
|
||||
// |mCurrentTarget|. As a result, we should pass |mCurrentTarget|
|
||||
// into UpdateCursor().
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
GenerateDragGesture(aPresContext, mouseEvent);
|
||||
UpdateCursor(aPresContext, aEvent, mCurrentTarget, aStatus);
|
||||
GenerateMouseEnterExit(mouseEvent);
|
||||
|
@ -198,8 +198,9 @@ HTMLButtonElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
// cause activation of the input. That is, if we're a click event, or a
|
||||
// DOMActivate that was dispatched directly, this will be set, but if we're
|
||||
// a DOMActivate dispatched from click handling, it will not be set.
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
bool outerActivateEvent =
|
||||
(aVisitor.mEvent->IsLeftClickEvent() ||
|
||||
((mouseEvent && mouseEvent->IsLeftClickEvent()) ||
|
||||
(aVisitor.mEvent->message == NS_UI_ACTIVATE &&
|
||||
!mInInternalActivate));
|
||||
|
||||
@ -225,22 +226,25 @@ HTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (aVisitor.mEventStatus != nsEventStatus_eConsumeNoDefault &&
|
||||
aVisitor.mEvent->IsLeftClickEvent()) {
|
||||
InternalUIEvent actEvent(aVisitor.mEvent->mFlags.mIsTrusted,
|
||||
NS_UI_ACTIVATE, 1);
|
||||
if (aVisitor.mEventStatus != nsEventStatus_eConsumeNoDefault) {
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
if (mouseEvent && mouseEvent->IsLeftClickEvent()) {
|
||||
InternalUIEvent actEvent(aVisitor.mEvent->mFlags.mIsTrusted,
|
||||
NS_UI_ACTIVATE, 1);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
|
||||
if (shell) {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
mInInternalActivate = true;
|
||||
shell->HandleDOMEventWithTarget(this, &actEvent, &status);
|
||||
mInInternalActivate = false;
|
||||
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
|
||||
if (shell) {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
mInInternalActivate = true;
|
||||
shell->HandleDOMEventWithTarget(this, &actEvent, &status);
|
||||
mInInternalActivate = false;
|
||||
|
||||
// If activate is cancelled, we must do the same as when click is
|
||||
// cancelled (revert the checkbox to its original value).
|
||||
if (status == nsEventStatus_eConsumeNoDefault)
|
||||
aVisitor.mEventStatus = status;
|
||||
// If activate is cancelled, we must do the same as when click is
|
||||
// cancelled (revert the checkbox to its original value).
|
||||
if (status == nsEventStatus_eConsumeNoDefault) {
|
||||
aVisitor.mEventStatus = status;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,8 @@ HTMLImageElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
// the Generic Element as this could cause a click event to fire
|
||||
// twice, once by the image frame for the map and once by the Anchor
|
||||
// element. (bug 39723)
|
||||
if (aVisitor.mEvent->IsLeftClickEvent()) {
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
if (mouseEvent && mouseEvent->IsLeftClickEvent()) {
|
||||
bool isMap = false;
|
||||
GetIsMap(&isMap);
|
||||
if (isMap) {
|
||||
|
@ -3112,8 +3112,9 @@ HTMLInputElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
// cause activation of the input. That is, if we're a click event, or a
|
||||
// DOMActivate that was dispatched directly, this will be set, but if we're
|
||||
// a DOMActivate dispatched from click handling, it will not be set.
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
bool outerActivateEvent =
|
||||
(aVisitor.mEvent->IsLeftClickEvent() ||
|
||||
((mouseEvent && mouseEvent->IsLeftClickEvent()) ||
|
||||
(aVisitor.mEvent->message == NS_UI_ACTIVATE && !mInInternalActivate));
|
||||
|
||||
if (outerActivateEvent) {
|
||||
@ -3342,14 +3343,18 @@ HTMLInputElement::MaybeInitPickers(nsEventChainPostVisitor& aVisitor)
|
||||
// - it's the left mouse button.
|
||||
// We do not prevent non-trusted click because authors can already use
|
||||
// .click(). However, the pickers will follow the rules of popup-blocking.
|
||||
if (aVisitor.mEvent->IsLeftClickEvent() &&
|
||||
!aVisitor.mEvent->mFlags.mDefaultPrevented) {
|
||||
if (mType == NS_FORM_INPUT_FILE) {
|
||||
return InitFilePicker(FILE_PICKER_FILE);
|
||||
}
|
||||
if (mType == NS_FORM_INPUT_COLOR) {
|
||||
return InitColorPicker();
|
||||
}
|
||||
if (aVisitor.mEvent->mFlags.mDefaultPrevented) {
|
||||
return NS_OK;
|
||||
}
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
if (!(mouseEvent && mouseEvent->IsLeftClickEvent())) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (mType == NS_FORM_INPUT_FILE) {
|
||||
return InitFilePicker(FILE_PICKER_FILE);
|
||||
}
|
||||
if (mType == NS_FORM_INPUT_COLOR) {
|
||||
return InitColorPicker();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -3395,23 +3400,26 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
// the click event handling, and allow cancellation of DOMActivate to cancel
|
||||
// the click.
|
||||
if (aVisitor.mEventStatus != nsEventStatus_eConsumeNoDefault &&
|
||||
!IsSingleLineTextControl(true) &&
|
||||
aVisitor.mEvent->IsLeftClickEvent() &&
|
||||
!ShouldPreventDOMActivateDispatch(aVisitor.mEvent->originalTarget)) {
|
||||
InternalUIEvent actEvent(aVisitor.mEvent->mFlags.mIsTrusted,
|
||||
NS_UI_ACTIVATE, 1);
|
||||
!IsSingleLineTextControl(true)) {
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
if (mouseEvent && mouseEvent->IsLeftClickEvent() &&
|
||||
!ShouldPreventDOMActivateDispatch(aVisitor.mEvent->originalTarget)) {
|
||||
InternalUIEvent actEvent(aVisitor.mEvent->mFlags.mIsTrusted,
|
||||
NS_UI_ACTIVATE, 1);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
|
||||
if (shell) {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
mInInternalActivate = true;
|
||||
rv = shell->HandleDOMEventWithTarget(this, &actEvent, &status);
|
||||
mInInternalActivate = false;
|
||||
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
|
||||
if (shell) {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
mInInternalActivate = true;
|
||||
rv = shell->HandleDOMEventWithTarget(this, &actEvent, &status);
|
||||
mInInternalActivate = false;
|
||||
|
||||
// If activate is cancelled, we must do the same as when click is
|
||||
// cancelled (revert the checkbox to its original value).
|
||||
if (status == nsEventStatus_eConsumeNoDefault)
|
||||
aVisitor.mEventStatus = status;
|
||||
// If activate is cancelled, we must do the same as when click is
|
||||
// cancelled (revert the checkbox to its original value).
|
||||
if (status == nsEventStatus_eConsumeNoDefault) {
|
||||
aVisitor.mEventStatus = status;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,8 +114,9 @@ DestroyMouseDownPoint(void * /*aObject*/,
|
||||
nsresult
|
||||
HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
{
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
if (mHandlingEvent ||
|
||||
(!aVisitor.mEvent->IsLeftClickEvent() &&
|
||||
(!(mouseEvent && mouseEvent->IsLeftClickEvent()) &&
|
||||
aVisitor.mEvent->message != NS_MOUSE_BUTTON_DOWN) ||
|
||||
aVisitor.mEventStatus == nsEventStatus_eConsumeNoDefault ||
|
||||
!aVisitor.mPresContext ||
|
||||
@ -131,12 +132,11 @@ HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
mHandlingEvent = true;
|
||||
switch (aVisitor.mEvent->message) {
|
||||
case NS_MOUSE_BUTTON_DOWN:
|
||||
if (aVisitor.mEvent->AsMouseEvent()->button ==
|
||||
WidgetMouseEvent::eLeftButton) {
|
||||
if (mouseEvent->button == WidgetMouseEvent::eLeftButton) {
|
||||
// We reset the mouse-down point on every event because there is
|
||||
// no guarantee we will reach the NS_MOUSE_CLICK code below.
|
||||
LayoutDeviceIntPoint* curPoint =
|
||||
new LayoutDeviceIntPoint(aVisitor.mEvent->refPoint);
|
||||
new LayoutDeviceIntPoint(mouseEvent->refPoint);
|
||||
SetProperty(nsGkAtoms::labelMouseDownPtProperty,
|
||||
static_cast<void*>(curPoint),
|
||||
DestroyMouseDownPoint);
|
||||
@ -144,8 +144,7 @@ HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
break;
|
||||
|
||||
case NS_MOUSE_CLICK:
|
||||
if (aVisitor.mEvent->IsLeftClickEvent()) {
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
if (mouseEvent->IsLeftClickEvent()) {
|
||||
LayoutDeviceIntPoint* mouseDownPoint =
|
||||
static_cast<LayoutDeviceIntPoint*>(
|
||||
GetProperty(nsGkAtoms::labelMouseDownPtProperty));
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -108,11 +109,13 @@ nsButtonBoxFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
break;
|
||||
}
|
||||
|
||||
case NS_MOUSE_CLICK:
|
||||
if (aEvent->IsLeftClickEvent()) {
|
||||
MouseClicked(aPresContext, aEvent);
|
||||
case NS_MOUSE_CLICK: {
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
if (mouseEvent->IsLeftClickEvent()) {
|
||||
MouseClicked(aPresContext, mouseEvent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return nsBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
@ -283,13 +283,13 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_MOUSE_CLICK:
|
||||
if (aEvent->IsLeftClickEvent())
|
||||
{
|
||||
MouseClicked(aPresContext, aEvent);
|
||||
case NS_MOUSE_CLICK: {
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
if (mouseEvent->IsLeftClickEvent()) {
|
||||
MouseClicked(aPresContext, mouseEvent);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
case NS_MOUSE_DOUBLECLICK:
|
||||
if (aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton) {
|
||||
nsCOMPtr<nsIBaseWindow> window;
|
||||
@ -536,7 +536,7 @@ nsResizerFrame::GetDirection()
|
||||
|
||||
void
|
||||
nsResizerFrame::MouseClicked(nsPresContext* aPresContext,
|
||||
WidgetGUIEvent *aEvent)
|
||||
WidgetMouseEvent* aEvent)
|
||||
{
|
||||
// Execute the oncommand event handler.
|
||||
nsContentUtils::DispatchXULCommand(mContent,
|
||||
|
@ -6,6 +6,7 @@
|
||||
#define nsResizerFrame_h___
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsTitleBarFrame.h"
|
||||
|
||||
class nsIBaseWindow;
|
||||
@ -31,7 +32,7 @@ public:
|
||||
nsEventStatus* aEventStatus) MOZ_OVERRIDE;
|
||||
|
||||
virtual void MouseClicked(nsPresContext* aPresContext,
|
||||
mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE;
|
||||
mozilla::WidgetMouseEvent* aEvent) MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
nsIContent* GetContentToResize(nsIPresShell* aPresShell, nsIBaseWindow** aWindow);
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "nsButtonBoxFrame.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsRepeatService.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -104,12 +104,14 @@ nsAutoRepeatBoxFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
mTrustedEvent = false;
|
||||
break;
|
||||
|
||||
case NS_MOUSE_CLICK:
|
||||
if (aEvent->IsLeftClickEvent()) {
|
||||
case NS_MOUSE_CLICK: {
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
if (mouseEvent->IsLeftClickEvent()) {
|
||||
// skip button frame handling to prevent click handling
|
||||
return nsBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
return nsBoxFrame::HandleEvent(aPresContext, mouseEvent, aEventStatus);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return nsButtonBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
@ -148,14 +148,13 @@ nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case NS_MOUSE_CLICK:
|
||||
if (aEvent->IsLeftClickEvent())
|
||||
{
|
||||
MouseClicked(aPresContext, aEvent);
|
||||
case NS_MOUSE_CLICK: {
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
if (mouseEvent->IsLeftClickEvent()) {
|
||||
MouseClicked(aPresContext, mouseEvent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( doDefault )
|
||||
@ -166,7 +165,7 @@ nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
|
||||
void
|
||||
nsTitleBarFrame::MouseClicked(nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent)
|
||||
WidgetMouseEvent* aEvent)
|
||||
{
|
||||
// Execute the oncommand event handler.
|
||||
nsContentUtils::DispatchXULCommand(mContent,
|
||||
|
@ -6,6 +6,7 @@
|
||||
#define nsTitleBarFrame_h___
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsBoxFrame.h"
|
||||
|
||||
class nsTitleBarFrame : public nsBoxFrame
|
||||
@ -26,7 +27,7 @@ public:
|
||||
nsEventStatus* aEventStatus) MOZ_OVERRIDE;
|
||||
|
||||
virtual void MouseClicked(nsPresContext* aPresContext,
|
||||
mozilla::WidgetGUIEvent* aEvent);
|
||||
mozilla::WidgetMouseEvent* aEvent);
|
||||
|
||||
void UpdateMouseThrough() MOZ_OVERRIDE { AddStateBits(NS_FRAME_MOUSE_THROUGH_NEVER); }
|
||||
|
||||
|
@ -703,14 +703,15 @@ nsViewManager::DispatchEvent(WidgetGUIEvent *aEvent,
|
||||
{
|
||||
PROFILER_LABEL("event", "nsViewManager::DispatchEvent");
|
||||
|
||||
if ((aEvent->HasMouseEventMessage() &&
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
if ((mouseEvent &&
|
||||
// Ignore mouse events that we synthesize.
|
||||
aEvent->AsMouseEvent()->reason == WidgetMouseEvent::eReal &&
|
||||
mouseEvent->reason == WidgetMouseEvent::eReal &&
|
||||
// Ignore mouse exit and enter (we'll get moves if the user
|
||||
// is really moving the mouse) since we get them when we
|
||||
// create and destroy widgets.
|
||||
aEvent->message != NS_MOUSE_EXIT &&
|
||||
aEvent->message != NS_MOUSE_ENTER) ||
|
||||
mouseEvent->message != NS_MOUSE_EXIT &&
|
||||
mouseEvent->message != NS_MOUSE_ENTER) ||
|
||||
aEvent->HasKeyEventMessage() ||
|
||||
aEvent->HasIMEEventMessage() ||
|
||||
aEvent->message == NS_PLUGIN_INPUT_EVENT) {
|
||||
|
@ -737,14 +737,6 @@ public:
|
||||
*/
|
||||
bool HasPluginActivationEventMessage() const;
|
||||
|
||||
/**
|
||||
* Returns true if left click event.
|
||||
*/
|
||||
bool IsLeftClickEvent() const;
|
||||
/**
|
||||
* Returns true if the event is a context menu event caused by key.
|
||||
*/
|
||||
bool IsContextMenuKeyEvent() const;
|
||||
/**
|
||||
* Returns true if the event is native event deliverer event for plugin and
|
||||
* it should be retarted to focused document.
|
||||
|
@ -108,6 +108,14 @@ public:
|
||||
pressure = aEvent.pressure;
|
||||
inputSource = aEvent.inputSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if left click event.
|
||||
*/
|
||||
bool IsLeftClickEvent() const
|
||||
{
|
||||
return message == NS_MOUSE_CLICK && button == eLeftButton;
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
@ -221,6 +229,14 @@ public:
|
||||
ignoreRootScrollFrame = aEvent.ignoreRootScrollFrame;
|
||||
clickCount = aEvent.clickCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the event is a context menu event caused by key.
|
||||
*/
|
||||
bool IsContextMenuKeyEvent() const
|
||||
{
|
||||
return message == NS_CONTEXTMENU && context == eContextMenuKey;
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -166,22 +166,6 @@ WidgetEvent::HasPluginActivationEventMessage() const
|
||||
* Specific event checking methods.
|
||||
******************************************************************************/
|
||||
|
||||
bool
|
||||
WidgetEvent::IsLeftClickEvent() const
|
||||
{
|
||||
const WidgetMouseEvent* mouseEvent = AsMouseEvent();
|
||||
return mouseEvent && message == NS_MOUSE_CLICK &&
|
||||
mouseEvent->button == WidgetMouseEvent::eLeftButton;
|
||||
}
|
||||
|
||||
bool
|
||||
WidgetEvent::IsContextMenuKeyEvent() const
|
||||
{
|
||||
const WidgetMouseEvent* mouseEvent = AsMouseEvent();
|
||||
return mouseEvent && message == NS_CONTEXTMENU &&
|
||||
mouseEvent->context == WidgetMouseEvent::eContextMenuKey;
|
||||
}
|
||||
|
||||
bool
|
||||
WidgetEvent::IsRetargetedNativeEventDelivererForPlugin() const
|
||||
{
|
||||
@ -205,8 +189,11 @@ WidgetEvent::IsIMERelatedEvent() const
|
||||
bool
|
||||
WidgetEvent::IsUsingCoordinates() const
|
||||
{
|
||||
const WidgetMouseEvent* mouseEvent = AsMouseEvent();
|
||||
if (mouseEvent) {
|
||||
return !mouseEvent->IsContextMenuKeyEvent();
|
||||
}
|
||||
return !HasKeyEventMessage() && !IsIMERelatedEvent() &&
|
||||
!IsContextMenuKeyEvent() &&
|
||||
!HasPluginActivationEventMessage() &&
|
||||
!IsNativeEventDelivererForPlugin() &&
|
||||
!IsContentCommandEvent() &&
|
||||
@ -216,8 +203,11 @@ WidgetEvent::IsUsingCoordinates() const
|
||||
bool
|
||||
WidgetEvent::IsTargetedAtFocusedWindow() const
|
||||
{
|
||||
const WidgetMouseEvent* mouseEvent = AsMouseEvent();
|
||||
if (mouseEvent) {
|
||||
return mouseEvent->IsContextMenuKeyEvent();
|
||||
}
|
||||
return HasKeyEventMessage() || IsIMERelatedEvent() ||
|
||||
IsContextMenuKeyEvent() ||
|
||||
IsContentCommandEvent() ||
|
||||
IsRetargetedNativeEventDelivererForPlugin();
|
||||
}
|
||||
@ -225,8 +215,11 @@ WidgetEvent::IsTargetedAtFocusedWindow() const
|
||||
bool
|
||||
WidgetEvent::IsTargetedAtFocusedContent() const
|
||||
{
|
||||
const WidgetMouseEvent* mouseEvent = AsMouseEvent();
|
||||
if (mouseEvent) {
|
||||
return mouseEvent->IsContextMenuKeyEvent();
|
||||
}
|
||||
return HasKeyEventMessage() || IsIMERelatedEvent() ||
|
||||
IsContextMenuKeyEvent() ||
|
||||
IsRetargetedNativeEventDelivererForPlugin();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user