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 1874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1885 if (!target_node) | 1885 if (!target_node) |
1886 target_node = doc; | 1886 target_node = doc; |
1887 | 1887 |
1888 // Use the focused node as the target for hover and active. | 1888 // Use the focused node as the target for hover and active. |
1889 HitTestRequest request(HitTestRequest::kActive); | 1889 HitTestRequest request(HitTestRequest::kActive); |
1890 HitTestResult result(request, location_in_root_frame); | 1890 HitTestResult result(request, location_in_root_frame); |
1891 result.SetInnerNode(target_node); | 1891 result.SetInnerNode(target_node); |
1892 doc->UpdateHoverActiveState(request, result.InnerElement()); | 1892 doc->UpdateHoverActiveState(request, result.InnerElement()); |
1893 | 1893 |
1894 // The contextmenu event is a mouse event even when invoked using the | 1894 // The contextmenu event is a mouse event even when invoked using the |
1895 // keyboard or other methods. This is required for web compatibility. | 1895 // keyboard. This is required for web compatibility. |
1896 WebInputEvent::Type event_type = WebInputEvent::kMouseDown; | 1896 WebInputEvent::Type event_type = WebInputEvent::kMouseDown; |
1897 if (frame_->GetSettings() && | 1897 if (frame_->GetSettings() && |
1898 frame_->GetSettings()->GetShowContextMenuOnMouseUp()) | 1898 frame_->GetSettings()->GetShowContextMenuOnMouseUp()) |
1899 event_type = WebInputEvent::kMouseUp; | 1899 event_type = WebInputEvent::kMouseUp; |
1900 | 1900 |
| 1901 WebInputEvent::Modifiers modifiers; |
| 1902 switch (source_type) { |
| 1903 case kMenuSourceTouch: |
| 1904 case kMenuSourceLongPress: |
| 1905 case kMenuSourceTouchHandle: |
| 1906 modifiers = WebInputEvent::kIsCompatibilityEventForTouch; |
| 1907 break; |
| 1908 default: |
| 1909 modifiers = WebInputEvent::kNoModifiers; |
| 1910 break; |
| 1911 } |
| 1912 |
1901 WebMouseEvent mouse_event( | 1913 WebMouseEvent mouse_event( |
1902 event_type, | 1914 event_type, |
1903 WebFloatPoint(location_in_root_frame.X(), location_in_root_frame.Y()), | 1915 WebFloatPoint(location_in_root_frame.X(), location_in_root_frame.Y()), |
1904 WebFloatPoint(global_position.X(), global_position.Y()), | 1916 WebFloatPoint(global_position.X(), global_position.Y()), |
1905 WebPointerProperties::Button::kNoButton, /* clickCount */ 0, | 1917 WebPointerProperties::Button::kNoButton, /* clickCount */ 0, modifiers, |
1906 ((source_type == kMenuSourceTouchHandle) | |
1907 ? WebInputEvent::kIsCompatibilityEventForTouch | |
1908 : WebInputEvent::kNoModifiers), | |
1909 TimeTicks::Now().InSeconds()); | 1918 TimeTicks::Now().InSeconds()); |
1910 | 1919 |
1911 // TODO(dtapuska): Transition the mouseEvent to be created really in viewport | 1920 // TODO(dtapuska): Transition the mouseEvent to be created really in viewport |
1912 // coordinates instead of root frame coordinates. | 1921 // coordinates instead of root frame coordinates. |
1913 mouse_event.SetFrameScale(1); | 1922 mouse_event.SetFrameScale(1); |
1914 | 1923 |
1915 return SendContextMenuEvent(mouse_event, override_target_element); | 1924 return SendContextMenuEvent(mouse_event, override_target_element); |
1916 } | 1925 } |
1917 | 1926 |
1918 void EventHandler::ScheduleHoverStateUpdate() { | 1927 void EventHandler::ScheduleHoverStateUpdate() { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2136 MouseEventWithHitTestResults& mev, | 2145 MouseEventWithHitTestResults& mev, |
2137 LocalFrame* subframe) { | 2146 LocalFrame* subframe) { |
2138 WebInputEventResult result = | 2147 WebInputEventResult result = |
2139 subframe->GetEventHandler().HandleMouseReleaseEvent(mev.Event()); | 2148 subframe->GetEventHandler().HandleMouseReleaseEvent(mev.Event()); |
2140 if (result != WebInputEventResult::kNotHandled) | 2149 if (result != WebInputEventResult::kNotHandled) |
2141 return result; | 2150 return result; |
2142 return WebInputEventResult::kHandledSystem; | 2151 return WebInputEventResult::kHandledSystem; |
2143 } | 2152 } |
2144 | 2153 |
2145 } // namespace blink | 2154 } // namespace blink |
OLD | NEW |