Commit 0531e1c1 authored by Ella Ge's avatar Ella Ge Committed by Commit Bot

send mousemove instead of leave after context menu

This CL changes mac SetShowingContextMenu to send a MouseMove instead
of MouseLeave. And add kRelativeMotionEvent flag in the modifier to
avoid sending the event to DOM.
Sending MouseLeave will cause hover/active state be cleared when open
contextmenu.

Bug: 803844
Change-Id: I38f2864b108f95a51c6e93536a1b410333fdf50e
Reviewed-on: https://chromium-review.googlesource.com/888092Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Commit-Queue: Ella Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532931}
parent b6818c7c
...@@ -1161,8 +1161,8 @@ void RenderWidgetHostViewMac::SetShowingContextMenu(bool showing) { ...@@ -1161,8 +1161,8 @@ void RenderWidgetHostViewMac::SetShowingContextMenu(bool showing) {
clickCount:0 clickCount:0
pressure:0]; pressure:0];
WebMouseEvent web_event = WebMouseEventBuilder::Build(event, cocoa_view_); WebMouseEvent web_event = WebMouseEventBuilder::Build(event, cocoa_view_);
if (showing) web_event.SetModifiers(web_event.GetModifiers() |
web_event.SetType(WebInputEvent::kMouseLeave); WebInputEvent::kRelativeMotionEvent);
ForwardMouseEvent(web_event); ForwardMouseEvent(web_event);
} }
......
...@@ -1111,6 +1111,21 @@ TEST_F(RenderWidgetHostViewMacTest, PointerEventWithMouseType) { ...@@ -1111,6 +1111,21 @@ TEST_F(RenderWidgetHostViewMacTest, PointerEventWithMouseType) {
GetPointerType(events)); GetPointerType(events));
} }
TEST_F(RenderWidgetHostViewMacTest, SendMouseMoveOnShowingContextMenu) {
rwhv_mac_->SetShowingContextMenu(true);
base::RunLoop().RunUntilIdle();
MockWidgetInputHandler::MessageVector events =
host_->GetAndResetDispatchedMessages();
ASSERT_EQ("MouseMove", GetMessageNames(events));
events.clear();
rwhv_mac_->SetShowingContextMenu(false);
base::RunLoop().RunUntilIdle();
events = host_->GetAndResetDispatchedMessages();
ASSERT_EQ("MouseMove", GetMessageNames(events));
}
void RenderWidgetHostViewMacTest:: void RenderWidgetHostViewMacTest::
IgnoreEmptyUnhandledWheelEventWithWheelGestures() { IgnoreEmptyUnhandledWheelEventWithWheelGestures() {
// Add a delegate to the view. // Add a delegate to the view.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment