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

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

Issue 2840023002: Fix button event on mouse events. (Closed)
Patch Set: Fix button event on mouse events. Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/events/MouseEvent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/events/MouseEvent.cpp
diff --git a/third_party/WebKit/Source/core/events/MouseEvent.cpp b/third_party/WebKit/Source/core/events/MouseEvent.cpp
index ace0d091e15826f7c909f3850f520f6463d59ada..c8db6a7220fddfdb07472dbb869ee535aa73ae42 100644
--- a/third_party/WebKit/Source/core/events/MouseEvent.cpp
+++ b/third_party/WebKit/Source/core/events/MouseEvent.cpp
@@ -384,6 +384,18 @@ bool MouseEvent::IsMouseEvent() const {
return true;
}
+short MouseEvent::button() const {
+ const AtomicString& event_name = type();
+ if (button_ == -1 || event_name == EventTypeNames::mousemove ||
+ event_name == EventTypeNames::mouseleave ||
+ event_name == EventTypeNames::mouseenter ||
+ event_name == EventTypeNames::mouseover ||
+ event_name == EventTypeNames::mouseout) {
+ return 0;
+ }
+ return button_;
+}
+
int MouseEvent::which() const {
// For the DOM, the return values for left, middle and right mouse buttons are
// 0, 1, 2, respectively.
« no previous file with comments | « third_party/WebKit/Source/core/events/MouseEvent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698