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

Unified Diff: content/browser/renderer_host/input/web_input_event_builders_mac.mm

Issue 2056053002: We did not set the pointer type for WebMouseEvent, which is created from NSEvent in WebMouseEventBu… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/input/web_input_event_builders_mac.mm
diff --git a/content/browser/renderer_host/input/web_input_event_builders_mac.mm b/content/browser/renderer_host/input/web_input_event_builders_mac.mm
index 2e8ea376b856638125284351bfa9cf527ce25316..2fdc15057c74366e2a1ced63ef9debdd47005e3f 100644
--- a/content/browser/renderer_host/input/web_input_event_builders_mac.mm
+++ b/content/browser/renderer_host/input/web_input_event_builders_mac.mm
@@ -668,7 +668,8 @@ blink::WebMouseEvent WebMouseEventBuilder::Build(NSEvent* event, NSView* view) {
result.clickCount = 0;
- switch ([event type]) {
+ NSEventType type = [event type];
+ switch (type) {
case NSMouseExited:
result.type = blink::WebInputEvent::MouseLeave;
result.button = blink::WebMouseEvent::ButtonNone;
@@ -729,6 +730,25 @@ blink::WebMouseEvent WebMouseEventBuilder::Build(NSEvent* event, NSView* view) {
result.timeStampSeconds = [event timestamp];
+ // For NSMouseExited and NSMouseEntered, they do not have a subtype. Styluses
+ // and mouses share the same cursor, so we will set their pointerType as
+ // Unknown for now.
+ if (type == NSMouseExited || type == NSMouseEntered) {
+ result.pointerType = blink::WebPointerProperties::PointerType::Unknown;
+ return result;
+ }
+
+ // For other mouse events and touchpad events, the pointer type is mouse.
+ // For all other tablet events, the pointer type will be just pen.
+ NSEventSubtype subtype = [event subtype];
+ if (subtype == NSTabletPointEventSubtype ||
+ subtype == NSTabletProximityEventSubtype) {
+ result.pointerType = blink::WebPointerProperties::PointerType::Pen;
+ } else {
+ result.pointerType = blink::WebPointerProperties::PointerType::Mouse;
+ }
+ result.id = [event deviceID];
+ result.force = [event pressure];
return result;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698