Index: content/browser/renderer_host/render_widget_host_view_mac.mm |
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm |
index 4bbf13f0be7f533b4700161c86e22e63c83846a8..c2083b27f1329925ffc66646ced19fc1ca4c01d0 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm |
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm |
@@ -1911,10 +1911,16 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged( |
// Set the pointer type when we are receiving a NSMouseEntered event and the |
// following NSMouseExited event should have the same pointer type. |
NSEventType type = [theEvent type]; |
- if (type == NSMouseEntered) { |
+ if (type == NSMouseEntered || type == NSMouseExited) { |
pointerType_ = isStylusEnteringProximity_ |
Navid Zolghadr
2017/03/08 19:30:27
Can we just use an if statement here and not set p
lanwei
2017/03/08 21:01:19
I thought it was clearer to set the pointer type f
|
- ? blink::WebPointerProperties::PointerType::Pen |
+ ? pointerType_ |
: blink::WebPointerProperties::PointerType::Mouse; |
+ } else { |
+ NSEventSubtype subtype = [theEvent subtype]; |
+ if (subtype != NSTabletPointEventSubtype && |
+ subtype != NSTabletProximityEventSubtype) { |
+ pointerType_ = blink::WebPointerProperties::PointerType::Mouse; |
Navid Zolghadr
2017/03/08 19:30:27
Why did we make this change here along with the er
lanwei
2017/03/08 21:01:19
I moved all the logic of setting the pointer type
|
+ } |
} |
if ([self shouldIgnoreMouseEvent:theEvent]) { |
@@ -1987,8 +1993,13 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged( |
} |
- (void)tabletEvent:(NSEvent*)theEvent { |
- if ([theEvent type] == NSTabletProximity) |
+ if ([theEvent type] == NSTabletProximity) { |
isStylusEnteringProximity_ = [theEvent isEnteringProximity]; |
+ NSPointingDeviceType deviceType = [theEvent pointingDeviceType]; |
+ pointerType_ = deviceType == NSEraserPointingDevice |
+ ? blink::WebPointerProperties::PointerType::Eraser |
+ : blink::WebPointerProperties::PointerType::Pen; |
+ } |
} |
- (BOOL)performKeyEquivalent:(NSEvent*)theEvent { |