Index: Source/core/events/MouseEvent.cpp |
diff --git a/Source/core/events/MouseEvent.cpp b/Source/core/events/MouseEvent.cpp |
index 2ecccb43c3dd31e669da96c199b179628a2bab6b..cba1190a3047dba42be57d947a694f65d5184043 100644 |
--- a/Source/core/events/MouseEvent.cpp |
+++ b/Source/core/events/MouseEvent.cpp |
@@ -60,7 +60,7 @@ PassRefPtrWillBeRawPtr<MouseEvent> MouseEvent::create(const AtomicString& type, |
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, |
+ short button, unsigned short buttons, |
PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, DataTransfer* dataTransfer, bool isSimulated, PlatformMouseEvent::SyntheticEventType syntheticEventType, |
double uiCreateTime) |
{ |
@@ -73,7 +73,6 @@ PassRefPtrWillBeRawPtr<MouseEvent> MouseEvent::create(const AtomicString& type, |
MouseEvent::MouseEvent() |
: m_button(0) |
, m_buttons(0) |
- , m_buttonDown(false) |
, m_relatedTarget(nullptr) |
, m_dataTransfer(nullptr) |
, m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable) |
@@ -84,16 +83,15 @@ MouseEvent::MouseEvent(const AtomicString& eventType, bool canBubble, bool cance |
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, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, |
+ short button, unsigned short buttons, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, |
DataTransfer* dataTransfer, bool isSimulated, PlatformMouseEvent::SyntheticEventType syntheticEventType, |
double uiCreateTime) |
: MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, IntPoint(screenX, screenY), |
IntPoint(windowX, windowY), |
IntPoint(movementX, movementY), |
ctrlKey, altKey, shiftKey, metaKey, isSimulated) |
- , m_button(button == (unsigned short)-1 ? 0 : button) |
+ , m_button(button) |
, m_buttons(buttons) |
- , m_buttonDown(button != (unsigned short)-1) |
, m_relatedTarget(relatedTarget) |
, m_dataTransfer(dataTransfer) |
, m_syntheticEventType(syntheticEventType) |
@@ -106,9 +104,8 @@ MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& init |
IntPoint(0 /* pageX */, 0 /* pageY */), |
IntPoint(initializer.movementX(), initializer.movementY()), |
initializer.ctrlKey(), initializer.altKey(), initializer.shiftKey(), initializer.metaKey(), false /* isSimulated */) |
- , m_button(initializer.button() == (unsigned short)-1 ? 0 : initializer.button()) |
+ , m_button(initializer.button()) |
, m_buttons(initializer.buttons()) |
- , m_buttonDown(initializer.button() != (unsigned short)-1) |
, m_relatedTarget(initializer.relatedTarget()) |
, m_dataTransfer(nullptr) |
, m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable) |
@@ -137,7 +134,7 @@ unsigned short MouseEvent::platformModifiersToButtons(unsigned modifiers) |
void MouseEvent::initMouseEvent(ScriptState* scriptState, const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view, |
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) |
+ short button, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, unsigned short buttons) |
{ |
if (dispatched()) |
return; |
@@ -152,9 +149,8 @@ void MouseEvent::initMouseEvent(ScriptState* scriptState, const AtomicString& ty |
m_altKey = altKey; |
m_shiftKey = shiftKey; |
m_metaKey = metaKey; |
- m_button = button == (unsigned short)-1 ? 0 : button; |
+ m_button = button; |
m_buttons = buttons; |
- m_buttonDown = button != (unsigned short)-1; |
m_relatedTarget = relatedTarget; |
initCoordinates(IntPoint(clientX, clientY)); |
@@ -185,8 +181,6 @@ int MouseEvent::which() const |
// For the DOM, the return values for left, middle and right mouse buttons are 0, 1, 2, respectively. |
// For the Netscape "which" property, the return values for left, middle and right mouse buttons are 1, 2, 3, respectively. |
// So we must add 1. |
- if (!m_buttonDown) |
- return 0; |
return m_button + 1; |
} |