Bug 970199 - Switch mouse event button type from ushort to short according to spec change. r=smaug

--HG--
extra : rebase_source : 7da22cbb4a3fcc6fa7cc8350bea0f87adf896788
This commit is contained in:
Maksim Lebedev 2014-02-20 10:38:13 -08:00
parent 91032a3dca
commit 2bef39fb53
14 changed files with 21 additions and 20 deletions

View File

@ -106,7 +106,7 @@ nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent)
(eventType.EqualsLiteral("contextmenu") && mIsContext)))
return NS_OK;
uint16_t button;
int16_t button;
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
if (!mouseEvent) {

View File

@ -96,7 +96,7 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString& aType,
int32_t aScreenY,
int32_t aClientX,
int32_t aClientY,
uint16_t aButton,
int16_t aButton,
nsIDOMEventTarget *aRelatedTarget,
const nsAString& aModifiersList)
{
@ -179,14 +179,14 @@ nsDOMMouseEvent::InitNSMouseEvent(const nsAString & aType, bool aCanBubble, bool
}
NS_IMETHODIMP
nsDOMMouseEvent::GetButton(uint16_t* aButton)
nsDOMMouseEvent::GetButton(int16_t* aButton)
{
NS_ENSURE_ARG_POINTER(aButton);
*aButton = Button();
return NS_OK;
}
uint16_t
int16_t
nsDOMMouseEvent::Button()
{
switch(mEvent->eventStructType)

View File

@ -47,7 +47,7 @@ public:
bool ShiftKey();
bool AltKey();
bool MetaKey();
uint16_t Button();
int16_t Button();
uint16_t Buttons();
already_AddRefed<mozilla::dom::EventTarget> GetRelatedTarget();
void InitMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
@ -108,7 +108,7 @@ protected:
int32_t aScreenY,
int32_t aClientX,
int32_t aClientY,
uint16_t aButton,
int16_t aButton,
nsIDOMEventTarget *aRelatedTarget,
const nsAString& aModifiersList);
};

View File

@ -4103,6 +4103,7 @@ nsEventStateManager::DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
}
event->refPoint = aMouseEvent->refPoint;
event->modifiers = aMouseEvent->modifiers;
event->button = aMouseEvent->button;
event->buttons = aMouseEvent->buttons;
event->pluginEvent = aMouseEvent->pluginEvent;
event->relatedTarget = aRelatedContent;

View File

@ -313,7 +313,7 @@ nsIMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
return; // ignore untrusted event.
}
uint16_t button;
int16_t button;
rv = aMouseEvent->GetButton(&button);
NS_ENSURE_SUCCESS_VOID(rv);
if (button != 0) {

View File

@ -13,7 +13,7 @@
* http://www.w3.org/TR/DOM-Level-2-Events/
*/
[scriptable, builtinclass, uuid(afb2e57b-2822-4969-b2a9-0cada6859534)]
[scriptable, builtinclass, uuid(df068636-9a5b-11e3-b71f-2c27d728e7f9)]
interface nsIDOMMouseEvent : nsIDOMUIEvent
{
readonly attribute long screenX;
@ -30,7 +30,7 @@ interface nsIDOMMouseEvent : nsIDOMUIEvent
readonly attribute boolean altKey;
readonly attribute boolean metaKey;
readonly attribute unsigned short button;
readonly attribute short button;
readonly attribute unsigned short buttons;
readonly attribute nsIDOMEventTarget relatedTarget;

View File

@ -19,7 +19,7 @@ interface MouseEvent : UIEvent {
readonly attribute boolean shiftKey;
readonly attribute boolean altKey;
readonly attribute boolean metaKey;
readonly attribute unsigned short button;
readonly attribute short button;
readonly attribute unsigned short buttons;
readonly attribute EventTarget? relatedTarget;
// Deprecated in DOM Level 3:
@ -37,7 +37,7 @@ interface MouseEvent : UIEvent {
boolean altKeyArg,
boolean shiftKeyArg,
boolean metaKeyArg,
unsigned short buttonArg,
short buttonArg,
EventTarget? relatedTargetArg);
// Introduced in DOM Level 3:
boolean getModifierState(DOMString keyArg);
@ -69,7 +69,7 @@ dictionary MouseEventInit {
boolean shiftKey = false;
boolean altKey = false;
boolean metaKey = false;
unsigned short button = 0;
short button = 0;
// Note: "buttons" was not previously initializable through initMouseEvent!
unsigned short buttons = 0;
EventTarget? relatedTarget = null;
@ -109,7 +109,7 @@ partial interface MouseEvent
boolean altKeyArg,
boolean shiftKeyArg,
boolean metaKeyArg,
unsigned short buttonArg,
short buttonArg,
EventTarget? relatedTargetArg,
float pressure,
unsigned short inputSourceArg);

View File

@ -644,7 +644,7 @@ nsXBLPrototypeHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent)
if (mDetail == -1 && mMisc == 0 && (mKeyMask & cAllModifiers) == 0)
return true; // No filters set up. It's generic.
uint16_t button;
int16_t button;
aMouseEvent->GetButton(&button);
if (mDetail != -1 && (button != mDetail))
return false;

View File

@ -587,7 +587,7 @@ nsEditorEventListener::MouseClick(nsIDOMEvent* aMouseEvent)
// IME to commit before we change the cursor position
mEditor->ForceCompositionEnd();
uint16_t button = (uint16_t)-1;
int16_t button = -1;
mouseEvent->GetButton(&button);
// middle-mouse click (paste);
if (button == 1)

View File

@ -91,7 +91,7 @@ nsHTMLEditorEventListener::MouseDown(nsIDOMEvent* aMouseEvent)
// Detect only "context menu" click
//XXX This should be easier to do!
// But eDOMEvents_contextmenu and NS_CONTEXTMENU is not exposed in any event interface :-(
uint16_t buttonNumber;
int16_t buttonNumber;
nsresult res = mouseEvent->GetButton(&buttonNumber);
NS_ENSURE_SUCCESS(res, res);

View File

@ -1947,7 +1947,7 @@ nsresult mozInlineSpellChecker::MouseClick(nsIDOMEvent *aMouseEvent)
// ignore any errors from HandleNavigationEvent as we don't want to prevent
// anyone else from seeing this event.
uint16_t button;
int16_t button;
mouseEvent->GetButton(&button);
HandleNavigationEvent(button != 0);
return NS_OK;

View File

@ -1506,7 +1506,7 @@ nsListControlFrame::IsLeftButton(nsIDOMEvent* aMouseEvent)
// only allow selection with the left button
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aMouseEvent);
if (mouseEvent) {
uint16_t whichButton;
int16_t whichButton;
if (NS_SUCCEEDED(mouseEvent->GetButton(&whichButton))) {
return whichButton != 0?false:true;
}

View File

@ -602,7 +602,7 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
if (!mouseEvent)
return NS_OK;
uint16_t button = 0;
int16_t button = 0;
mouseEvent->GetButton(&button);
// only if left button

View File

@ -962,7 +962,7 @@ nsFormFillController::MouseDown(nsIDOMEvent* aEvent)
if (!targetInput)
return NS_OK;
uint16_t button;
int16_t button;
mouseEvent->GetButton(&button);
if (button != 0)
return NS_OK;