OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 FrameView* view = m_frame->view(); | 856 FrameView* view = m_frame->view(); |
857 PaintLayer* layer = mev.innerNode()->layoutObject() ? mev.innerNode()->l
ayoutObject()->enclosingLayer() : nullptr; | 857 PaintLayer* layer = mev.innerNode()->layoutObject() ? mev.innerNode()->l
ayoutObject()->enclosingLayer() : nullptr; |
858 IntPoint p = view->rootFrameToContents(mouseEvent.position()); | 858 IntPoint p = view->rootFrameToContents(mouseEvent.position()); |
859 if (layer && layer->getScrollableArea() && layer->getScrollableArea()->i
sPointInResizeControl(p, ResizerForPointer)) { | 859 if (layer && layer->getScrollableArea() && layer->getScrollableArea()->i
sPointInResizeControl(p, ResizerForPointer)) { |
860 m_scrollManager.setResizeScrollableArea(layer, p); | 860 m_scrollManager.setResizeScrollableArea(layer, p); |
861 return WebInputEventResult::HandledSystem; | 861 return WebInputEventResult::HandledSystem; |
862 } | 862 } |
863 } | 863 } |
864 | 864 |
865 // m_selectionInitiationState is initialized after dispatching mousedown | 865 // m_selectionInitiationState is initialized after dispatching mousedown |
866 // event in order not to keep the selection by DOM APIs Because we can't | 866 // event in order not to keep the selection by DOM APIs because we can't |
867 // give the user the chance to handle the selection by user action like | 867 // give the user the chance to handle the selection by user action like |
868 // dragging if we keep the selection in case of mousedown. FireFox also has | 868 // dragging if we keep the selection in case of mousedown. FireFox also has |
869 // the same behavior and it's more compatible with other browsers. | 869 // the same behavior and it's more compatible with other browsers. |
870 selectionController().initializeSelectionState(); | 870 selectionController().initializeSelectionState(); |
871 HitTestResult hitTestResult = hitTestResultInFrame(m_frame, documentPoint, H
itTestRequest::ReadOnly); | 871 HitTestResult hitTestResult = hitTestResultInFrame(m_frame, documentPoint, H
itTestRequest::ReadOnly); |
872 InputDeviceCapabilities* sourceCapabilities = mouseEvent.getSyntheticEventTy
pe() == PlatformMouseEvent::FromTouch ? InputDeviceCapabilities::firesTouchEvent
sSourceCapabilities() : | 872 InputDeviceCapabilities* sourceCapabilities = mouseEvent.getSyntheticEventTy
pe() == PlatformMouseEvent::FromTouch ? InputDeviceCapabilities::firesTouchEvent
sSourceCapabilities() : |
873 InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities(); | 873 InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities(); |
874 if (eventResult == WebInputEventResult::NotHandled) | 874 if (eventResult == WebInputEventResult::NotHandled) |
875 eventResult = handleMouseFocus(MouseEventWithHitTestResults(mev.event(),
hitTestResult), sourceCapabilities); | 875 eventResult = handleMouseFocus(MouseEventWithHitTestResults(mev.event(),
hitTestResult), sourceCapabilities); |
876 m_capturesDragging = eventResult == WebInputEventResult::NotHandled || mev.s
crollbar(); | 876 m_capturesDragging = eventResult == WebInputEventResult::NotHandled || mev.s
crollbar(); |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 eventType = PlatformEvent::MouseReleased; | 2087 eventType = PlatformEvent::MouseReleased; |
2088 | 2088 |
2089 PlatformMouseEvent mouseEvent(locationInRootFrame, globalPosition, | 2089 PlatformMouseEvent mouseEvent(locationInRootFrame, globalPosition, |
2090 RightButton, eventType, 1, | 2090 RightButton, eventType, 1, |
2091 PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishable, | 2091 PlatformEvent::NoModifiers, PlatformMouseEvent::RealOrIndistinguishable, |
2092 WTF::monotonicallyIncreasingTime(), WebPointerProperties::PointerType::M
ouse); | 2092 WTF::monotonicallyIncreasingTime(), WebPointerProperties::PointerType::M
ouse); |
2093 | 2093 |
2094 return sendContextMenuEvent(mouseEvent, overrideTargetElement); | 2094 return sendContextMenuEvent(mouseEvent, overrideTargetElement); |
2095 } | 2095 } |
2096 | 2096 |
2097 WebInputEventResult EventHandler::sendContextMenuEventForGesture(const GestureEv
entWithHitTestResults& targetedEvent) | |
2098 { | |
2099 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); | |
2100 unsigned modifiers = gestureEvent.getModifiers(); | |
2101 | |
2102 // Send MouseMoved event prior to handling (https://crbug.com/485290). | |
2103 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.globa
lPosition(), | |
2104 NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, | |
2105 static_cast<PlatformEvent::Modifiers>(modifiers), | |
2106 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope
rties::PointerType::Mouse); | |
2107 dispatchMouseEvent(EventTypeNames::mousemove, targetedEvent.hitTestResult().
innerNode(), 0, fakeMouseMove); | |
2108 | |
2109 PlatformEvent::EventType eventType = PlatformEvent::MousePressed; | |
2110 | |
2111 if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp()) | |
2112 eventType = PlatformEvent::MouseReleased; | |
2113 | |
2114 // Always set right button down as we are sending mousedown event regardless | |
2115 modifiers |= PlatformEvent::RightButtonDown; | |
2116 | |
2117 // TODO(crbug.com/579564): Maybe we should not send mouse down at all | |
2118 PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEven
t.event().globalPosition(), RightButton, eventType, 1, | |
2119 static_cast<PlatformEvent::Modifiers>(modifiers), | |
2120 PlatformMouseEvent::FromTouch, WTF::monotonicallyIncreasingTime(), WebPo
interProperties::PointerType::Mouse); | |
2121 // To simulate right-click behavior, we send a right mouse down and then | |
2122 // context menu event. | |
2123 // FIXME: Send HitTestResults to avoid redundant hit tests. | |
2124 handleMousePressEvent(mouseEvent); | |
2125 return sendContextMenuEvent(mouseEvent); | |
2126 // We do not need to send a corresponding mouse release because in case of | |
2127 // right-click, the context menu takes capture and consumes all events. | |
2128 } | |
2129 | |
2130 void EventHandler::scheduleHoverStateUpdate() | 2097 void EventHandler::scheduleHoverStateUpdate() |
2131 { | 2098 { |
2132 if (!m_hoverTimer.isActive()) | 2099 if (!m_hoverTimer.isActive()) |
2133 m_hoverTimer.startOneShot(0, BLINK_FROM_HERE); | 2100 m_hoverTimer.startOneShot(0, BLINK_FROM_HERE); |
2134 } | 2101 } |
2135 | 2102 |
2136 void EventHandler::scheduleCursorUpdate() | 2103 void EventHandler::scheduleCursorUpdate() |
2137 { | 2104 { |
2138 // We only want one timer for the page, rather than each frame having it's o
wn timer | 2105 // We only want one timer for the page, rather than each frame having it's o
wn timer |
2139 // competing which eachother (since there's only one mouse cursor). | 2106 // competing which eachother (since there's only one mouse cursor). |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2611 | 2578 |
2612 FrameHost* EventHandler::frameHost() const | 2579 FrameHost* EventHandler::frameHost() const |
2613 { | 2580 { |
2614 if (!m_frame->page()) | 2581 if (!m_frame->page()) |
2615 return nullptr; | 2582 return nullptr; |
2616 | 2583 |
2617 return &m_frame->page()->frameHost(); | 2584 return &m_frame->page()->frameHost(); |
2618 } | 2585 } |
2619 | 2586 |
2620 } // namespace blink | 2587 } // namespace blink |
OLD | NEW |