Chromium Code Reviews| Index: third_party/WebKit/Source/core/input/EventHandler.cpp |
| diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp |
| index 8aadf84044a353d2123124a369d1265ac3cc1f84..f436cccca86b54762d1d3aa94d19ca2472b36a47 100644 |
| --- a/third_party/WebKit/Source/core/input/EventHandler.cpp |
| +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp |
| @@ -1810,7 +1810,7 @@ static bool ShouldShowContextMenuAtSelection(const FrameSelection& selection) { |
| return selection.SelectionHasFocus(); |
| } |
| -WebInputEventResult EventHandler::SendContextMenuEventForKey( |
| +WebInputEventResult EventHandler::ShowNonLocatedContextMenu( |
|
yosin_UTC9
2017/05/25 04:47:21
Can we have another patch rename |SendContextMenuE
amaralp1
2017/05/25 07:11:56
Done. https://codereview.chromium.org/2905783002
|
| Element* override_target_element, |
| WebMenuSourceType source_type) { |
| FrameView* view = frame_->View(); |
| @@ -1882,20 +1882,29 @@ WebInputEventResult EventHandler::SendContextMenuEventForKey( |
| doc->UpdateHoverActiveState(request, result.InnerElement()); |
| // The contextmenu event is a mouse event even when invoked using the |
| - // keyboard. This is required for web compatibility. |
| + // keyboard or other methods. This is required for web compatibility. |
| WebInputEvent::Type event_type = WebInputEvent::kMouseDown; |
| if (frame_->GetSettings() && |
| frame_->GetSettings()->GetShowContextMenuOnMouseUp()) |
| event_type = WebInputEvent::kMouseUp; |
| + WebInputEvent::Modifiers modifiers; |
| + switch (source_type) { |
| + case kMenuSourceTouch: |
| + case kMenuSourceLongPress: |
| + case kMenuSourceTouchHandle: |
| + modifiers = WebInputEvent::kIsCompatibilityEventForTouch; |
| + break; |
| + default: |
| + modifiers = WebInputEvent::kNoModifiers; |
| + break; |
| + } |
| + |
| WebMouseEvent mouse_event( |
| event_type, |
| WebFloatPoint(location_in_root_frame.X(), location_in_root_frame.Y()), |
| WebFloatPoint(global_position.X(), global_position.Y()), |
| - WebPointerProperties::Button::kNoButton, /* clickCount */ 0, |
| - ((source_type == kMenuSourceTouchHandle) |
| - ? WebInputEvent::kIsCompatibilityEventForTouch |
| - : WebInputEvent::kNoModifiers), |
| + WebPointerProperties::Button::kNoButton, /* clickCount */ 0, modifiers, |
| TimeTicks::Now().InSeconds()); |
| // TODO(dtapuska): Transition the mouseEvent to be created really in viewport |