OLD | NEW |
---|---|
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 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1881 result.SetInnerNode(target_node); | 1881 result.SetInnerNode(target_node); |
1882 doc->UpdateHoverActiveState(request, result.InnerElement()); | 1882 doc->UpdateHoverActiveState(request, result.InnerElement()); |
1883 | 1883 |
1884 // The contextmenu event is a mouse event even when invoked using the | 1884 // The contextmenu event is a mouse event even when invoked using the |
1885 // keyboard. This is required for web compatibility. | 1885 // keyboard. This is required for web compatibility. |
1886 WebInputEvent::Type event_type = WebInputEvent::kMouseDown; | 1886 WebInputEvent::Type event_type = WebInputEvent::kMouseDown; |
1887 if (frame_->GetSettings() && | 1887 if (frame_->GetSettings() && |
1888 frame_->GetSettings()->GetShowContextMenuOnMouseUp()) | 1888 frame_->GetSettings()->GetShowContextMenuOnMouseUp()) |
1889 event_type = WebInputEvent::kMouseUp; | 1889 event_type = WebInputEvent::kMouseUp; |
1890 | 1890 |
1891 WebInputEvent::Modifiers modifiers; | |
1892 switch (source_type) { | |
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 | |
1891 WebMouseEvent mouse_event( | 1903 WebMouseEvent mouse_event( |
1892 event_type, | 1904 event_type, |
1893 WebFloatPoint(location_in_root_frame.X(), location_in_root_frame.Y()), | 1905 WebFloatPoint(location_in_root_frame.X(), location_in_root_frame.Y()), |
1894 WebFloatPoint(global_position.X(), global_position.Y()), | 1906 WebFloatPoint(global_position.X(), global_position.Y()), |
1895 WebPointerProperties::Button::kNoButton, /* clickCount */ 0, | 1907 WebPointerProperties::Button::kNoButton, /* clickCount */ 0, modifiers, |
1896 ((source_type == kMenuSourceTouchHandle) | |
1897 ? WebInputEvent::kIsCompatibilityEventForTouch | |
1898 : WebInputEvent::kNoModifiers), | |
1899 TimeTicks::Now().InSeconds()); | 1908 TimeTicks::Now().InSeconds()); |
1900 | 1909 |
1901 // TODO(dtapuska): Transition the mouseEvent to be created really in viewport | 1910 // TODO(dtapuska): Transition the mouseEvent to be created really in viewport |
1902 // coordinates instead of root frame coordinates. | 1911 // coordinates instead of root frame coordinates. |
1903 mouse_event.SetFrameScale(1); | 1912 mouse_event.SetFrameScale(1); |
1904 | 1913 |
1905 return SendContextMenuEvent(mouse_event, override_target_element); | 1914 return SendContextMenuEvent(mouse_event, override_target_element); |
1906 } | 1915 } |
1907 | 1916 |
1917 void EventHandler::SendContextMenuEventForTouchSelection( | |
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())) | |
yosin_UTC9
2017/05/24 04:51:23
Please change this conditional expression to:
!se
amaralp1
2017/05/24 08:30:34
Done.
| |
1925 return; | |
1926 SendContextMenuEventForKey(nullptr, menu_source); | |
1927 } | |
1928 | |
1908 void EventHandler::ScheduleHoverStateUpdate() { | 1929 void EventHandler::ScheduleHoverStateUpdate() { |
1909 // 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. |
1910 if (!hover_timer_.IsActive() && | 1931 if (!hover_timer_.IsActive() && |
1911 !mouse_event_manager_->IsMousePositionUnknown()) | 1932 !mouse_event_manager_->IsMousePositionUnknown()) |
1912 hover_timer_.StartOneShot(0, BLINK_FROM_HERE); | 1933 hover_timer_.StartOneShot(0, BLINK_FROM_HERE); |
1913 } | 1934 } |
1914 | 1935 |
1915 void EventHandler::ScheduleCursorUpdate() { | 1936 void EventHandler::ScheduleCursorUpdate() { |
1916 // 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 |
1917 // 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 Loading... | |
2126 MouseEventWithHitTestResults& mev, | 2147 MouseEventWithHitTestResults& mev, |
2127 LocalFrame* subframe) { | 2148 LocalFrame* subframe) { |
2128 WebInputEventResult result = | 2149 WebInputEventResult result = |
2129 subframe->GetEventHandler().HandleMouseReleaseEvent(mev.Event()); | 2150 subframe->GetEventHandler().HandleMouseReleaseEvent(mev.Event()); |
2130 if (result != WebInputEventResult::kNotHandled) | 2151 if (result != WebInputEventResult::kNotHandled) |
2131 return result; | 2152 return result; |
2132 return WebInputEventResult::kHandledSystem; | 2153 return WebInputEventResult::kHandledSystem; |
2133 } | 2154 } |
2134 | 2155 |
2135 } // namespace blink | 2156 } // namespace blink |
OLD | NEW |