Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Unified Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 2785853002: Selection Action mode triggered like a context menu (Closed)
Patch Set: fix tests Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 324a6522f6fa58065495fb2b43db3373c7af2a07..a0bb10ddc9dee35b9a120af1c9686c57c5dd9eb2 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -1885,14 +1885,26 @@ WebInputEventResult EventHandler::SendContextMenuEventForKey(
frame_->GetSettings()->GetShowContextMenuOnMouseUp())
event_type = WebInputEvent::kMouseUp;
+ WebInputEvent::Modifiers modifiers;
+ switch (source_type) {
+ case kMenuSourceSelectAll:
+ modifiers = WebInputEvent::kSelectAll;
+ break;
+ 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
@@ -1902,6 +1914,18 @@ WebInputEventResult EventHandler::SendContextMenuEventForKey(
return SendContextMenuEvent(mouse_event, override_target_element);
}
+WebInputEventResult EventHandler::SendContextMenuEventForTouchSelection(
aelias_OOO_until_Jul13 2017/05/23 20:52:05 This return value is unused by the callers. Since
amaralp1 2017/05/24 08:30:34 Done.
+ 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()))
+ return WebInputEventResult::kNotHandled;
+ return SendContextMenuEventForKey(nullptr, menu_source);
+}
+
void EventHandler::ScheduleHoverStateUpdate() {
// TODO(https://crbug.com/668758): Use a normal BeginFrame update for this.
if (!hover_timer_.IsActive() &&

Powered by Google App Engine
This is Rietveld 408576698