mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 05:10:49 +00:00
Bug 866436 - Cleanup the implementation of UIEvent.which; r=smaug
This commit is contained in:
parent
a60820e813
commit
e4191ddfb4
@ -134,15 +134,6 @@ nsDOMKeyboardEvent::KeyCode()
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
nsresult
|
||||
nsDOMKeyboardEvent::Which(uint32_t* aWhich)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWhich);
|
||||
*aWhich = Which();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
nsDOMKeyboardEvent::Which()
|
||||
{
|
||||
|
@ -76,10 +76,6 @@ public:
|
||||
aCtrlKey, aAltKey, aShiftKey,aMetaKey,
|
||||
aKeyCode, aCharCode);
|
||||
}
|
||||
|
||||
protected:
|
||||
// Specific implementation for a keyboard event.
|
||||
virtual nsresult Which(uint32_t* aWhich);
|
||||
};
|
||||
|
||||
|
||||
|
@ -447,17 +447,6 @@ nsDOMMouseEvent::GetModifierState(const nsAString& aKey,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
nsresult
|
||||
nsDOMMouseEvent::Which(uint32_t* aWhich)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWhich);
|
||||
uint16_t button;
|
||||
(void) GetButton(&button);
|
||||
*aWhich = button + 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMouseEvent::GetMozPressure(float* aPressure)
|
||||
{
|
||||
|
@ -40,9 +40,7 @@ public:
|
||||
// Web IDL binding methods
|
||||
virtual uint32_t Which() MOZ_OVERRIDE
|
||||
{
|
||||
uint32_t w = 0;
|
||||
Which(&w);
|
||||
return w;
|
||||
return Button() + 1;
|
||||
}
|
||||
|
||||
int32_t ScreenX();
|
||||
@ -123,9 +121,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
// Specific implementation for a mouse event.
|
||||
virtual nsresult Which(uint32_t* aWhich);
|
||||
|
||||
nsresult InitMouseEvent(const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
|
@ -253,7 +253,9 @@ nsDOMUIEvent::GetPageY(int32_t* aPageY)
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetWhich(uint32_t* aWhich)
|
||||
{
|
||||
return Which(aWhich);
|
||||
NS_ENSURE_ARG_POINTER(aWhich);
|
||||
*aWhich = Which();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsINode>
|
||||
|
@ -135,9 +135,11 @@ public:
|
||||
|
||||
virtual uint32_t Which()
|
||||
{
|
||||
uint32_t w;
|
||||
GetWhich(&w);
|
||||
return w;
|
||||
MOZ_ASSERT(mEvent->eventStructType != NS_KEY_EVENT,
|
||||
"Key events should override Which()");
|
||||
MOZ_ASSERT(mEvent->eventStructType != NS_MOUSE_EVENT,
|
||||
"Mouse events should override Which()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
already_AddRefed<nsINode> GetRangeParent();
|
||||
@ -168,15 +170,6 @@ protected:
|
||||
nsIntPoint GetLayerPoint();
|
||||
nsIntPoint GetPagePoint();
|
||||
|
||||
// Allow specializations.
|
||||
virtual nsresult Which(uint32_t* aWhich)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWhich);
|
||||
// Usually we never reach here, as this is reimplemented for mouse and keyboard events.
|
||||
*aWhich = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> mView;
|
||||
int32_t mDetail;
|
||||
nsIntPoint mClientPoint;
|
||||
|
Loading…
x
Reference in New Issue
Block a user