Chromium Code Reviews| 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 384bc26e6c6ce9b9ad80bd1be324c28b90d3a594..5dadac98c25e457da2f9c6399fd0f3503c420dbf 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_mac.mm |
| +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm |
| @@ -1255,7 +1255,8 @@ void RenderWidgetHostViewMac::SetShowingContextMenu(bool showing) { |
| eventNumber:0 |
| clickCount:0 |
| pressure:0]; |
| - WebMouseEvent web_event = WebMouseEventBuilder::Build(event, cocoa_view_); |
| + WebMouseEvent web_event = WebMouseEventBuilder::Build( |
| + event, cocoa_view_, blink::WebPointerProperties::PointerType::Mouse); |
| if (showing) |
| web_event.type = WebInputEvent::MouseLeave; |
| ForwardMouseEvent(web_event); |
| @@ -1989,10 +1990,17 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged( |
| return; |
| } |
| + // If the pointing device enters proximity of its tablet and does not leave, |
| + // the pointer type should be pen, otherwise is mouse. |
|
Navid Zolghadr
2016/05/31 04:18:12
Just a quick question for clarification. Does this
lanwei
2016/05/31 14:33:35
Even without actually touching the tablet screen,
mustaq
2016/05/31 14:43:50
Navid: Blink gets move & leave respectively, defin
|
| + blink::WebPointerProperties::PointerType pointerType = |
| + stylusEnteringProximity_ |
|
dtapuska
2016/05/31 13:31:05
Can we not always just use the subtype? It looks
lanwei
2016/05/31 14:33:35
Sorry, I forgot to add the comment that MouseEnter
mustaq
2016/05/31 14:43:50
The following link seems to suggest that subtype i
|
| + ? blink::WebPointerProperties::PointerType::Pen |
| + : blink::WebPointerProperties::PointerType::Mouse; |
| if ([self shouldIgnoreMouseEvent:theEvent]) { |
| // If this is the first such event, send a mouse exit to the host view. |
| if (!mouseEventWasIgnored_ && renderWidgetHostView_->render_widget_host_) { |
| - WebMouseEvent exitEvent = WebMouseEventBuilder::Build(theEvent, self); |
| + WebMouseEvent exitEvent = |
| + WebMouseEventBuilder::Build(theEvent, self, pointerType); |
| exitEvent.type = WebInputEvent::MouseLeave; |
| exitEvent.button = WebMouseEvent::ButtonNone; |
| renderWidgetHostView_->ForwardMouseEvent(exitEvent); |
| @@ -2005,7 +2013,8 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged( |
| // If this is the first mouse event after a previous event that was ignored |
| // due to the hitTest, send a mouse enter event to the host view. |
| if (renderWidgetHostView_->render_widget_host_) { |
| - WebMouseEvent enterEvent = WebMouseEventBuilder::Build(theEvent, self); |
| + WebMouseEvent enterEvent = |
| + WebMouseEventBuilder::Build(theEvent, self, pointerType); |
| enterEvent.type = WebInputEvent::MouseMove; |
| enterEvent.button = WebMouseEvent::ButtonNone; |
| if (renderWidgetHostView_->ShouldRouteEvent(enterEvent)) { |
| @@ -2042,7 +2051,8 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged( |
| [self confirmComposition]; |
| } |
| - WebMouseEvent event = WebMouseEventBuilder::Build(theEvent, self); |
| + WebMouseEvent event = |
| + WebMouseEventBuilder::Build(theEvent, self, pointerType); |
| if (renderWidgetHostView_->ShouldRouteEvent(event)) { |
| renderWidgetHostView_->render_widget_host_->delegate() |
| ->GetInputEventRouter() |
| @@ -2052,6 +2062,10 @@ void RenderWidgetHostViewMac::OnDisplayMetricsChanged( |
| } |
| } |
| +- (void)tabletEvent:(NSEvent*)theEvent { |
| + stylusEnteringProximity_ = [theEvent isEnteringProximity]; |
| +} |
| + |
| - (BOOL)performKeyEquivalent:(NSEvent*)theEvent { |
| // |performKeyEquivalent:| is sent to all views of a window, not only down the |
| // responder chain (cf. "Handling Key Equivalents" in |