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..f8f7d784fcaa5f2458ea64f122080463458f21b0 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() && |
| + selection.ComputeVisibleSelectionInFlatTree().IsRange())) |
|
yosin_UTC9
2017/05/24 04:51:23
Please change this conditional expression to:
!se
amaralp1
2017/05/24 08:30:34
Done.
|
| + return; |
| + SendContextMenuEventForKey(nullptr, menu_source); |
| +} |
| + |
| void EventHandler::ScheduleHoverStateUpdate() { |
| // TODO(https://crbug.com/668758): Use a normal BeginFrame update for this. |
| if (!hover_timer_.IsActive() && |