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

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: 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..7914547c960ca2aa471d2535115b0efe583cbfb7 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,13 +62,13 @@ 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; }
+ bool buttonDown() const { return m_button != -1; }
EventTarget* relatedTarget() const { return m_relatedTarget.get(); }
void setRelatedTarget(PassRefPtrWillBeRawPtr<EventTarget> relatedTarget) { m_relatedTarget = relatedTarget; }
@@ -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,9 +100,8 @@ protected:
MouseEvent();
private:
- unsigned short m_button;
+ short m_button;
unsigned short m_buttons;
- bool m_buttonDown;
RefPtrWillBeMember<EventTarget> m_relatedTarget;
PersistentWillBeMember<DataTransfer> m_dataTransfer;
PlatformMouseEvent::SyntheticEventType m_syntheticEventType;
« no previous file with comments | « LayoutTests/fast/events/constructors/wheel-event-constructor-expected.txt ('k') | Source/core/events/MouseEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698