| 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 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1804 | 1804 |
| 1805 static bool ShouldShowContextMenuAtSelection(const FrameSelection& selection) { | 1805 static bool ShouldShowContextMenuAtSelection(const FrameSelection& selection) { |
| 1806 const VisibleSelection& visible_selection = | 1806 const VisibleSelection& visible_selection = |
| 1807 selection.ComputeVisibleSelectionInDOMTreeDeprecated(); | 1807 selection.ComputeVisibleSelectionInDOMTreeDeprecated(); |
| 1808 if (!visible_selection.IsRange() && !visible_selection.RootEditableElement()) | 1808 if (!visible_selection.IsRange() && !visible_selection.RootEditableElement()) |
| 1809 return false; | 1809 return false; |
| 1810 return selection.SelectionHasFocus(); | 1810 return selection.SelectionHasFocus(); |
| 1811 } | 1811 } |
| 1812 | 1812 |
| 1813 WebInputEventResult EventHandler::ShowNonLocatedContextMenu( | 1813 WebInputEventResult EventHandler::ShowNonLocatedContextMenu( |
| 1814 Element* override_target_element) { | 1814 Element* override_target_element, |
| 1815 WebMenuSourceType source_type) { |
| 1815 FrameView* view = frame_->View(); | 1816 FrameView* view = frame_->View(); |
| 1816 if (!view) | 1817 if (!view) |
| 1817 return WebInputEventResult::kNotHandled; | 1818 return WebInputEventResult::kNotHandled; |
| 1818 | 1819 |
| 1819 Document* doc = frame_->GetDocument(); | 1820 Document* doc = frame_->GetDocument(); |
| 1820 if (!doc) | 1821 if (!doc) |
| 1821 return WebInputEventResult::kNotHandled; | 1822 return WebInputEventResult::kNotHandled; |
| 1822 | 1823 |
| 1823 static const int kContextMenuMargin = 1; | 1824 static const int kContextMenuMargin = 1; |
| 1824 | 1825 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1885 WebInputEvent::Type event_type = WebInputEvent::kMouseDown; | 1886 WebInputEvent::Type event_type = WebInputEvent::kMouseDown; |
| 1886 if (frame_->GetSettings() && | 1887 if (frame_->GetSettings() && |
| 1887 frame_->GetSettings()->GetShowContextMenuOnMouseUp()) | 1888 frame_->GetSettings()->GetShowContextMenuOnMouseUp()) |
| 1888 event_type = WebInputEvent::kMouseUp; | 1889 event_type = WebInputEvent::kMouseUp; |
| 1889 | 1890 |
| 1890 WebMouseEvent mouse_event( | 1891 WebMouseEvent mouse_event( |
| 1891 event_type, | 1892 event_type, |
| 1892 WebFloatPoint(location_in_root_frame.X(), location_in_root_frame.Y()), | 1893 WebFloatPoint(location_in_root_frame.X(), location_in_root_frame.Y()), |
| 1893 WebFloatPoint(global_position.X(), global_position.Y()), | 1894 WebFloatPoint(global_position.X(), global_position.Y()), |
| 1894 WebPointerProperties::Button::kNoButton, /* clickCount */ 0, | 1895 WebPointerProperties::Button::kNoButton, /* clickCount */ 0, |
| 1895 WebInputEvent::kNoModifiers, TimeTicks::Now().InSeconds()); | 1896 ((source_type == kMenuSourceTouchHandle) |
| 1897 ? WebInputEvent::kIsCompatibilityEventForTouch |
| 1898 : WebInputEvent::kNoModifiers), |
| 1899 TimeTicks::Now().InSeconds()); |
| 1896 | 1900 |
| 1897 // TODO(dtapuska): Transition the mouseEvent to be created really in viewport | 1901 // TODO(dtapuska): Transition the mouseEvent to be created really in viewport |
| 1898 // coordinates instead of root frame coordinates. | 1902 // coordinates instead of root frame coordinates. |
| 1899 mouse_event.SetFrameScale(1); | 1903 mouse_event.SetFrameScale(1); |
| 1900 | 1904 |
| 1901 return SendContextMenuEvent(mouse_event, override_target_element); | 1905 return SendContextMenuEvent(mouse_event, override_target_element); |
| 1902 } | 1906 } |
| 1903 | 1907 |
| 1904 void EventHandler::ScheduleHoverStateUpdate() { | 1908 void EventHandler::ScheduleHoverStateUpdate() { |
| 1905 // TODO(https://crbug.com/668758): Use a normal BeginFrame update for this. | 1909 // TODO(https://crbug.com/668758): Use a normal BeginFrame update for this. |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2122 MouseEventWithHitTestResults& mev, | 2126 MouseEventWithHitTestResults& mev, |
| 2123 LocalFrame* subframe) { | 2127 LocalFrame* subframe) { |
| 2124 WebInputEventResult result = | 2128 WebInputEventResult result = |
| 2125 subframe->GetEventHandler().HandleMouseReleaseEvent(mev.Event()); | 2129 subframe->GetEventHandler().HandleMouseReleaseEvent(mev.Event()); |
| 2126 if (result != WebInputEventResult::kNotHandled) | 2130 if (result != WebInputEventResult::kNotHandled) |
| 2127 return result; | 2131 return result; |
| 2128 return WebInputEventResult::kHandledSystem; | 2132 return WebInputEventResult::kHandledSystem; |
| 2129 } | 2133 } |
| 2130 | 2134 |
| 2131 } // namespace blink | 2135 } // namespace blink |
| OLD | NEW |