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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 result.SetInnerNode(target_node); 1878 result.SetInnerNode(target_node);
1879 doc->UpdateHoverActiveState(request, result.InnerElement()); 1879 doc->UpdateHoverActiveState(request, result.InnerElement());
1880 1880
1881 // The contextmenu event is a mouse event even when invoked using the 1881 // The contextmenu event is a mouse event even when invoked using the
1882 // keyboard. This is required for web compatibility. 1882 // keyboard. This is required for web compatibility.
1883 WebInputEvent::Type event_type = WebInputEvent::kMouseDown; 1883 WebInputEvent::Type event_type = WebInputEvent::kMouseDown;
1884 if (frame_->GetSettings() && 1884 if (frame_->GetSettings() &&
1885 frame_->GetSettings()->GetShowContextMenuOnMouseUp()) 1885 frame_->GetSettings()->GetShowContextMenuOnMouseUp())
1886 event_type = WebInputEvent::kMouseUp; 1886 event_type = WebInputEvent::kMouseUp;
1887 1887
1888 WebInputEvent::Modifiers modifiers;
1889 switch (source_type) {
1890 case kMenuSourceSelectAll:
1891 modifiers = WebInputEvent::kSelectAll;
1892 break;
1893 case kMenuSourceTouch:
1894 case kMenuSourceLongPress:
1895 case kMenuSourceTouchHandle:
1896 modifiers = WebInputEvent::kIsCompatibilityEventForTouch;
1897 break;
1898 default:
1899 modifiers = WebInputEvent::kNoModifiers;
1900 break;
1901 }
1902
1888 WebMouseEvent mouse_event( 1903 WebMouseEvent mouse_event(
1889 event_type, 1904 event_type,
1890 WebFloatPoint(location_in_root_frame.X(), location_in_root_frame.Y()), 1905 WebFloatPoint(location_in_root_frame.X(), location_in_root_frame.Y()),
1891 WebFloatPoint(global_position.X(), global_position.Y()), 1906 WebFloatPoint(global_position.X(), global_position.Y()),
1892 WebPointerProperties::Button::kNoButton, /* clickCount */ 0, 1907 WebPointerProperties::Button::kNoButton, /* clickCount */ 0, modifiers,
1893 ((source_type == kMenuSourceTouchHandle)
1894 ? WebInputEvent::kIsCompatibilityEventForTouch
1895 : WebInputEvent::kNoModifiers),
1896 TimeTicks::Now().InSeconds()); 1908 TimeTicks::Now().InSeconds());
1897 1909
1898 // TODO(dtapuska): Transition the mouseEvent to be created really in viewport 1910 // TODO(dtapuska): Transition the mouseEvent to be created really in viewport
1899 // coordinates instead of root frame coordinates. 1911 // coordinates instead of root frame coordinates.
1900 mouse_event.SetFrameScale(1); 1912 mouse_event.SetFrameScale(1);
1901 1913
1902 return SendContextMenuEvent(mouse_event, override_target_element); 1914 return SendContextMenuEvent(mouse_event, override_target_element);
1903 } 1915 }
1904 1916
1917 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.
1918 WebMenuSourceType menu_source) {
1919 // TODO(editing-dev): The use of UpdateStyleAndLayoutIgnorePendingStylesheets
1920 // needs to be audited. See http://crbug.com/590369 for more details.
1921 frame_->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
1922 FrameSelection& selection = frame_->Selection();
1923 if (!(selection.IsAvailable() && selection.IsHandleVisible() &&
1924 selection.ComputeVisibleSelectionInFlatTree().IsRange()))
1925 return WebInputEventResult::kNotHandled;
1926 return SendContextMenuEventForKey(nullptr, menu_source);
1927 }
1928
1905 void EventHandler::ScheduleHoverStateUpdate() { 1929 void EventHandler::ScheduleHoverStateUpdate() {
1906 // TODO(https://crbug.com/668758): Use a normal BeginFrame update for this. 1930 // TODO(https://crbug.com/668758): Use a normal BeginFrame update for this.
1907 if (!hover_timer_.IsActive() && 1931 if (!hover_timer_.IsActive() &&
1908 !mouse_event_manager_->IsMousePositionUnknown()) 1932 !mouse_event_manager_->IsMousePositionUnknown())
1909 hover_timer_.StartOneShot(0, BLINK_FROM_HERE); 1933 hover_timer_.StartOneShot(0, BLINK_FROM_HERE);
1910 } 1934 }
1911 1935
1912 void EventHandler::ScheduleCursorUpdate() { 1936 void EventHandler::ScheduleCursorUpdate() {
1913 // We only want one timer for the page, rather than each frame having it's own 1937 // We only want one timer for the page, rather than each frame having it's own
1914 // timer competing which eachother (since there's only one mouse cursor). 1938 // timer competing which eachother (since there's only one mouse cursor).
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 MouseEventWithHitTestResults& mev, 2147 MouseEventWithHitTestResults& mev,
2124 LocalFrame* subframe) { 2148 LocalFrame* subframe) {
2125 WebInputEventResult result = 2149 WebInputEventResult result =
2126 subframe->GetEventHandler().HandleMouseReleaseEvent(mev.Event()); 2150 subframe->GetEventHandler().HandleMouseReleaseEvent(mev.Event());
2127 if (result != WebInputEventResult::kNotHandled) 2151 if (result != WebInputEventResult::kNotHandled)
2128 return result; 2152 return result;
2129 return WebInputEventResult::kHandledSystem; 2153 return WebInputEventResult::kHandledSystem;
2130 } 2154 }
2131 2155
2132 } // namespace blink 2156 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698