mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 04:09:50 +00:00
Bug 1701108 - Split this assertion up into three assertions that are easier to understand. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D109825
This commit is contained in:
parent
403199a321
commit
53b0e331c3
@ -217,6 +217,10 @@ class WidgetMouseEvent : public WidgetMouseEventBase,
|
||||
mUseLegacyNonPrimaryDispatch(false),
|
||||
mClickEventPrevented(false) {}
|
||||
|
||||
#ifdef DEBUG
|
||||
void AssertContextMenuEventButtonConsistency() const;
|
||||
#endif
|
||||
|
||||
public:
|
||||
virtual WidgetMouseEvent* AsMouseEvent() override { return this; }
|
||||
|
||||
@ -237,15 +241,7 @@ class WidgetMouseEvent : public WidgetMouseEventBase,
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
virtual ~WidgetMouseEvent() {
|
||||
NS_WARNING_ASSERTION(
|
||||
mMessage != eContextMenu ||
|
||||
(mButton == ((mContextMenuTrigger == eNormal)
|
||||
? MouseButton::eSecondary
|
||||
: MouseButton::ePrimary) &&
|
||||
(mContextMenuTrigger != eControlClick || IsControl())),
|
||||
"Wrong button set to eContextMenu event?");
|
||||
}
|
||||
virtual ~WidgetMouseEvent() { AssertContextMenuEventButtonConsistency(); }
|
||||
#endif
|
||||
|
||||
virtual WidgetEvent* Duplicate() const override {
|
||||
|
@ -651,6 +651,30 @@ bool WidgetMouseEvent::IsMiddleClickPasteEnabled() {
|
||||
return Preferences::GetBool("middlemouse.paste", false);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void WidgetMouseEvent::AssertContextMenuEventButtonConsistency() const {
|
||||
if (mMessage != eContextMenu) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mContextMenuTrigger == eNormal) {
|
||||
NS_WARNING_ASSERTION(mButton == MouseButton::eSecondary,
|
||||
"eContextMenu events with eNormal trigger should use "
|
||||
"secondary mouse button");
|
||||
} else {
|
||||
NS_WARNING_ASSERTION(mButton == MouseButton::ePrimary,
|
||||
"eContextMenu events with non-eNormal trigger should "
|
||||
"use primary mouse button");
|
||||
}
|
||||
|
||||
if (mContextMenuTrigger == eControlClick) {
|
||||
NS_WARNING_ASSERTION(IsControl(),
|
||||
"eContextMenu events with eControlClick trigger "
|
||||
"should return true from IsControl()");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* mozilla::WidgetDragEvent (MouseEvents.h)
|
||||
******************************************************************************/
|
||||
|
Loading…
x
Reference in New Issue
Block a user