Chromium Code Reviews| Index: Source/core/events/MouseEvent.cpp |
| diff --git a/Source/core/events/MouseEvent.cpp b/Source/core/events/MouseEvent.cpp |
| index 2ecccb43c3dd31e669da96c199b179628a2bab6b..4d583f93edad046c7abfb68db11b4374159da10e 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) |
| { |
| @@ -84,16 +84,16 @@ 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_buttonDown(button != -1) |
|
philipj_slow
2015/06/10 08:46:25
Can the m_buttonDown member be removed? Just imple
ramya.v
2015/06/10 09:21:28
buttonDown() function is used in other places like
ramya.v
2015/06/10 09:25:39
Sorry, didn't get you, yes the variable can be re
ramya.v
2015/06/10 09:41:25
Done.
|
| , m_relatedTarget(relatedTarget) |
| , m_dataTransfer(dataTransfer) |
| , m_syntheticEventType(syntheticEventType) |
| @@ -106,9 +106,9 @@ 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_buttonDown(initializer.button() != -1) |
| , m_relatedTarget(initializer.relatedTarget()) |
| , m_dataTransfer(nullptr) |
| , m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable) |
| @@ -137,7 +137,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 +152,9 @@ 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_buttonDown = button != -1; |
| m_relatedTarget = relatedTarget; |
| initCoordinates(IntPoint(clientX, clientY)); |
| @@ -185,8 +185,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; |
| } |