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

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

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 test cases 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.cpp
diff --git a/Source/core/events/MouseEvent.cpp b/Source/core/events/MouseEvent.cpp
index 2ecccb43c3dd31e669da96c199b179628a2bab6b..12b14724518c203c7fd76c2f18415fd464b55183 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 == -1 ? 0 : button)
philipj_slow 2015/06/09 09:35:38 Getting rid of these casts will be nice. However,
ramya.v 2015/06/09 11:14:31 I've checked for any internal paths which could pa
philipj_slow 2015/06/09 12:04:06 OK, it looks like the MouseButton enum member NoBu
, m_buttons(buttons)
- , m_buttonDown(button != (unsigned short)-1)
+ , m_buttonDown(button != -1)
, 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() == -1 ? 0 : 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 == -1 ? 0 : button;
m_buttons = buttons;
- m_buttonDown = button != (unsigned short)-1;
+ m_buttonDown = button != -1;
m_relatedTarget = relatedTarget;
initCoordinates(IntPoint(clientX, clientY));

Powered by Google App Engine
This is Rietveld 408576698