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

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

Issue 727593003: Implement MouseEvent buttons attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: nits Created 6 years 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 ace8b87e1e61a8ae8f3e40325bba4b64e77a30d6..fa881dbecbe69dba10daf0419567ce353e783818 100644
--- a/Source/core/events/MouseEvent.h
+++ b/Source/core/events/MouseEvent.h
@@ -45,6 +45,7 @@ struct MouseEventInit : public UIEventInit {
bool shiftKey;
bool metaKey;
unsigned short button;
+ unsigned short buttons;
RefPtrWillBeMember<EventTarget> relatedTarget;
};
@@ -59,7 +60,7 @@ public:
static PassRefPtrWillBeRawPtr<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>,
int detail, int screenX, int screenY, int pageX, int pageY,
int movementX, int movementY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons,
PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPtr<DataTransfer>,
bool isSimulated = false, PlatformMouseEvent::SyntheticEventType = PlatformMouseEvent::RealOrIndistinguishable);
@@ -69,14 +70,17 @@ public:
virtual ~MouseEvent();
+ static unsigned short platformModifiersToButtons(unsigned modifiers);
+
void initMouseEvent(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 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; }
+ unsigned short buttons() const { return m_buttons; }
bool buttonDown() const { return m_buttonDown; }
EventTarget* relatedTarget() const { return m_relatedTarget.get(); }
void setRelatedTarget(PassRefPtrWillBeRawPtr<EventTarget> relatedTarget) { m_relatedTarget = relatedTarget; }
@@ -100,7 +104,7 @@ protected:
MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>,
int detail, int screenX, int screenY, int pageX, int pageY,
int movementX, int movementY,
- bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, unsigned short buttons,
PassRefPtrWillBeRawPtr<EventTarget> relatedTarget, PassRefPtrWillBeRawPtr<DataTransfer>,
bool isSimulated, PlatformMouseEvent::SyntheticEventType);
@@ -110,6 +114,7 @@ protected:
private:
unsigned short m_button;
+ unsigned short m_buttons;
bool m_buttonDown;
RefPtrWillBeMember<EventTarget> m_relatedTarget;
RefPtrWillBeMember<DataTransfer> m_dataTransfer;
« no previous file with comments | « LayoutTests/fast/events/mouse-event-buttons-attribute-expected.txt ('k') | Source/core/events/MouseEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698