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..aae92b3949d2cdec51fbc6030863a871f91a1dca 100644 |
| --- a/third_party/WebKit/Source/core/input/EventHandler.cpp |
| +++ b/third_party/WebKit/Source/core/input/EventHandler.cpp |
| @@ -1888,14 +1888,23 @@ WebInputEventResult EventHandler::SendContextMenuEventForKey( |
| 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 |
| @@ -1905,6 +1914,18 @@ WebInputEventResult EventHandler::SendContextMenuEventForKey( |
| return SendContextMenuEvent(mouse_event, override_target_element); |
| } |
| +void EventHandler::SendContextMenuEventForTouchSelection( |
| + WebMenuSourceType menu_source) { |
| + // TODO(editing-dev): The use of UpdateStyleAndLayoutIgnorePendingStylesheets |
| + // needs to be audited. See http://crbug.com/590369 for more details. |
| + frame_->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); |
| + FrameSelection& selection = frame_->Selection(); |
| + if (!selection.IsAvailable() || !selection.IsHandleVisible() || |
|
bokan
2017/05/24 19:15:52
Do we need a new method here? Couldn't we just do
|
| + selection.IsHidden()) |
| + return; |
| + SendContextMenuEventForKey(nullptr, menu_source); |
| +} |
| + |
| void EventHandler::ScheduleHoverStateUpdate() { |
| // TODO(https://crbug.com/668758): Use a normal BeginFrame update for this. |
| if (!hover_timer_.IsActive() && |