Bug 1259661 part.2 Rename WidgetMouseEvent::context to WidgetMouseEvent::ContextMenuTrigger r?smaug
MozReview-Commit-ID: 2amULUnzsxc
--- a/widget/MouseEvents.h
+++ b/widget/MouseEvents.h
@@ -183,59 +183,61 @@ private:
public:
typedef bool ReasonType;
enum Reason : ReasonType
{
eReal,
eSynthesized
};
- enum contextType
+ typedef bool ContextMenuTriggerType;
+ enum ContextMenuTrigger : ContextMenuTriggerType
{
eNormal,
eContextMenuKey
};
enum exitType
{
eChild,
eTopLevel
};
protected:
WidgetMouseEvent()
: reason(eReal)
+ , context(eNormal)
, acceptActivation(false)
, ignoreRootScrollFrame(false)
, clickCount(0)
{
}
WidgetMouseEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
EventClassID aEventClassID, Reason aReason)
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, aEventClassID)
, reason(aReason)
+ , context(eNormal)
, acceptActivation(false)
, ignoreRootScrollFrame(false)
- , context(eNormal)
, exit(eChild)
, clickCount(0)
{
}
public:
virtual WidgetMouseEvent* AsMouseEvent() override { return this; }
WidgetMouseEvent(bool aIsTrusted, EventMessage aMessage, nsIWidget* aWidget,
- Reason aReason, contextType aContext = eNormal)
+ Reason aReason, ContextMenuTrigger aContext = eNormal)
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eMouseEventClass)
, reason(aReason)
+ , context(aContext)
, acceptActivation(false)
, ignoreRootScrollFrame(false)
- , context(aContext)
, exit(eChild)
, clickCount(0)
{
if (aMessage == eContextMenu) {
button = (context == eNormal) ? eRightButton : eLeftButton;
}
}
@@ -258,23 +260,24 @@ public:
new WidgetMouseEvent(false, mMessage, nullptr, reason, context);
result->AssignMouseEventData(*this, true);
result->mFlags = mFlags;
return result;
}
Reason reason;
+ ContextMenuTrigger context;
+
// Special return code for MOUSE_ACTIVATE to signal.
// If the target accepts activation (1), or denies it (0).
bool acceptActivation;
// Whether the event should ignore scroll frame bounds during dispatch.
bool ignoreRootScrollFrame;
- contextType context : 4;
exitType exit;
/// The number of mouse clicks.
uint32_t clickCount;
void AssignMouseEventData(const WidgetMouseEvent& aEvent, bool aCopyTargets)
{
AssignMouseEventBaseData(aEvent, aCopyTargets);
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -227,36 +227,38 @@ struct ParamTraits<mozilla::WidgetMouseE
{
typedef mozilla::WidgetMouseEvent paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, static_cast<mozilla::WidgetMouseEventBase>(aParam));
WriteParam(aMsg, aParam.ignoreRootScrollFrame);
WriteParam(aMsg, static_cast<paramType::ReasonType>(aParam.reason));
- WriteParam(aMsg, (uint8_t) aParam.context);
+ WriteParam(aMsg,
+ static_cast<paramType::ContextMenuTriggerType>(aParam.context));
WriteParam(aMsg, (uint8_t) aParam.exit);
WriteParam(aMsg, aParam.clickCount);
}
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
{
bool rv;
paramType::ReasonType reason = 0;
- uint8_t context = 0, exit = 0;
+ paramType::ContextMenuTriggerType contextMenuTrigger = 0;
+ uint8_t exit = 0;
rv = ReadParam(aMsg, aIter,
static_cast<mozilla::WidgetMouseEventBase*>(aResult)) &&
ReadParam(aMsg, aIter, &aResult->ignoreRootScrollFrame) &&
ReadParam(aMsg, aIter, &reason) &&
- ReadParam(aMsg, aIter, &context) &&
+ ReadParam(aMsg, aIter, &contextMenuTrigger) &&
ReadParam(aMsg, aIter, &exit) &&
ReadParam(aMsg, aIter, &aResult->clickCount);
aResult->reason = static_cast<paramType::Reason>(reason);
aResult->context =
- static_cast<mozilla::WidgetMouseEvent::contextType>(context);
+ static_cast<paramType::ContextMenuTrigger>(contextMenuTrigger);
aResult->exit = static_cast<mozilla::WidgetMouseEvent::exitType>(exit);
return rv;
}
};
template<>
struct ParamTraits<mozilla::WidgetDragEvent>