Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Unified Diff: Source/core/events/MouseEvent.h

Issue 1165693005: Change MouseEvent.button to be 'short' instead of 'unsigned short' (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updating as per review comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/events/MouseEvent.h
diff --git a/Source/core/events/MouseEvent.h b/Source/core/events/MouseEvent.h
index 3416c30b5e1c9153015e3374f72711e9c0391b12..8bba9e2fa38a357eeb8e3fa84da59ff1855b2175 100644
--- a/Source/core/events/MouseEvent.h
+++ b/Source/core/events/MouseEvent.h
@@ -46,7 +46,7 @@ public:
static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>,
int detail, int screenX, int screenY, int windowX, int windowY,
int movementX, int movementY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, short button, unsigned short buttons,
PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, DataTransfer*,
bool isSimulated = false, PlatformMouseEvent::SyntheticEventType = PlatformMouseEvent::RealOrIndistinguishable,
double uiCreateTime = 0);
@@ -62,11 +62,11 @@ public:
void initMouseEvent(ScriptState*, const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>,
int detail, int screenX, int screenY, int clientX, int clientY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
- unsigned short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, unsigned short buttons = 0);
+ short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, unsigned short buttons = 0);
// WinIE uses 1,4,2 for left/middle/right but not for click (just for mousedown/up, maybe others),
// but we will match the standard DOM.
- unsigned short button() const { return m_button; }
+ short button() const { return m_button == -1 ? 0 : m_button; }
unsigned short buttons() const { return m_buttons; }
bool buttonDown() const { return m_buttonDown; }
EventTarget* relatedTarget() const { return m_relatedTarget.get(); }
@@ -91,7 +91,7 @@ protected:
MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>,
int detail, int screenX, int screenY, int windowX, int windowY,
int movementX, int movementY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, short button, unsigned short buttons,
PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, DataTransfer*,
bool isSimulated, PlatformMouseEvent::SyntheticEventType, double uiCreateTime = 0);
@@ -100,7 +100,7 @@ protected:
MouseEvent();
private:
- unsigned short m_button;
+ short m_button;
unsigned short m_buttons;
bool m_buttonDown;
RefPtrWillBeMember<EventTarget> m_relatedTarget;

Powered by Google App Engine
This is Rietveld 408576698