OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/input/GestureManager.h" | 5 #include "core/input/GestureManager.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/editing/SelectionController.h" | 8 #include "core/editing/SelectionController.h" |
9 #include "core/events/GestureEvent.h" | 9 #include "core/events/GestureEvent.h" |
10 #include "core/frame/FrameHost.h" | 10 #include "core/frame/FrameHost.h" |
11 #include "core/frame/FrameView.h" | 11 #include "core/frame/FrameView.h" |
12 #include "core/frame/Settings.h" | 12 #include "core/frame/Settings.h" |
13 #include "core/frame/VisualViewport.h" | 13 #include "core/frame/VisualViewport.h" |
14 #include "core/input/EventHandler.h" | 14 #include "core/input/EventHandler.h" |
15 #include "core/input/EventHandlingUtil.h" | 15 #include "core/input/EventHandlingUtil.h" |
16 #include "core/page/ChromeClient.h" | 16 #include "core/page/ChromeClient.h" |
17 #include "core/page/Page.h" | 17 #include "core/page/Page.h" |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 | 20 |
21 GestureManager::GestureManager(LocalFrame* frame, ScrollManager* scrollManager, | 21 GestureManager::GestureManager(LocalFrame* frame, ScrollManager* scrollManager, |
| 22 MouseEventManager* mouseEventManager, |
22 PointerEventManager* pointerEventManager, | 23 PointerEventManager* pointerEventManager, |
23 SelectionController* selectionController) | 24 SelectionController* selectionController) |
24 : m_frame(frame) | 25 : m_frame(frame) |
25 , m_scrollManager(scrollManager) | 26 , m_scrollManager(scrollManager) |
| 27 , m_mouseEventManager(mouseEventManager) |
26 , m_pointerEventManager(pointerEventManager) | 28 , m_pointerEventManager(pointerEventManager) |
27 , m_selectionController(selectionController) | 29 , m_selectionController(selectionController) |
28 { | 30 { |
29 clear(); | 31 clear(); |
30 } | 32 } |
31 | 33 |
32 void GestureManager::clear() | 34 void GestureManager::clear() |
33 { | 35 { |
34 m_suppressMouseEventsFromGestures = false; | 36 m_suppressMouseEventsFromGestures = false; |
35 m_longTapShouldInvokeContextMenu = false; | 37 m_longTapShouldInvokeContextMenu = false; |
36 m_lastShowPressTimestamp = 0; | 38 m_lastShowPressTimestamp = 0; |
37 } | 39 } |
38 | 40 |
39 DEFINE_TRACE(GestureManager) | 41 DEFINE_TRACE(GestureManager) |
40 { | 42 { |
41 visitor->trace(m_frame); | 43 visitor->trace(m_frame); |
| 44 visitor->trace(m_scrollManager); |
| 45 visitor->trace(m_mouseEventManager); |
| 46 visitor->trace(m_pointerEventManager); |
42 visitor->trace(m_selectionController); | 47 visitor->trace(m_selectionController); |
43 visitor->trace(m_pointerEventManager); | |
44 visitor->trace(m_scrollManager); | |
45 } | 48 } |
46 | 49 |
47 HitTestRequest::HitTestRequestType GestureManager::getHitTypeForGestureType(Plat
formEvent::EventType type) | 50 HitTestRequest::HitTestRequestType GestureManager::getHitTypeForGestureType(Plat
formEvent::EventType type) |
48 { | 51 { |
49 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent; | 52 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEvent; |
50 switch (type) { | 53 switch (type) { |
51 case PlatformEvent::GestureShowPress: | 54 case PlatformEvent::GestureShowPress: |
52 case PlatformEvent::GestureTapUnconfirmed: | 55 case PlatformEvent::GestureTapUnconfirmed: |
53 return hitType | HitTestRequest::Active; | 56 return hitType | HitTestRequest::Active; |
54 case PlatformEvent::GestureTapDownCancel: | 57 case PlatformEvent::GestureTapDownCancel: |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // co-ordinates outside the target's bounds. | 142 // co-ordinates outside the target's bounds. |
140 IntPoint adjustedPoint = frameView->rootFrameToContents(gestureEvent.positio
n()); | 143 IntPoint adjustedPoint = frameView->rootFrameToContents(gestureEvent.positio
n()); |
141 | 144 |
142 const unsigned modifiers = gestureEvent.getModifiers(); | 145 const unsigned modifiers = gestureEvent.getModifiers(); |
143 | 146 |
144 if (!m_suppressMouseEventsFromGestures) { | 147 if (!m_suppressMouseEventsFromGestures) { |
145 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.g
lobalPosition(), | 148 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.g
lobalPosition(), |
146 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, /
* clickCount */ 0, | 149 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, /
* clickCount */ 0, |
147 static_cast<PlatformEvent::Modifiers>(modifiers), | 150 static_cast<PlatformEvent::Modifiers>(modifiers), |
148 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerP
roperties::PointerType::Mouse); | 151 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerP
roperties::PointerType::Mouse); |
149 m_frame->eventHandler().dispatchMouseEvent(EventTypeNames::mousemove, cu
rrentHitTest.innerNode(), 0, fakeMouseMove); | 152 m_mouseEventManager->dispatchMouseEvent(currentHitTest.innerNode(), Even
tTypeNames::mousemove, fakeMouseMove, 0); |
150 } | 153 } |
151 | 154 |
152 // Do a new hit-test in case the mousemove event changed the DOM. | 155 // Do a new hit-test in case the mousemove event changed the DOM. |
153 // Note that if the original hit test wasn't over an element (eg. was over a
scrollbar) we | 156 // Note that if the original hit test wasn't over an element (eg. was over a
scrollbar) we |
154 // don't want to re-hit-test because it may be in the wrong frame (and there
's no way the page | 157 // don't want to re-hit-test because it may be in the wrong frame (and there
's no way the page |
155 // could have seen the event anyway). | 158 // could have seen the event anyway). |
156 // Also note that the position of the frame may have changed, so we need to
recompute the content | 159 // Also note that the position of the frame may have changed, so we need to
recompute the content |
157 // co-ordinates (updating layout/style as hitTestResultAtPoint normally woul
d). | 160 // co-ordinates (updating layout/style as hitTestResultAtPoint normally woul
d). |
158 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 | 161 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 |
159 if (currentHitTest.innerNode()) { | 162 if (currentHitTest.innerNode()) { |
160 LocalFrame* mainFrame = m_frame->localFrameRoot(); | 163 LocalFrame* mainFrame = m_frame->localFrameRoot(); |
161 if (mainFrame && mainFrame->view()) | 164 if (mainFrame && mainFrame->view()) |
162 mainFrame->view()->updateLifecycleToCompositingCleanPlusScrolling(); | 165 mainFrame->view()->updateLifecycleToCompositingCleanPlusScrolling(); |
163 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); | 166 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); |
164 currentHitTest = EventHandlingUtil::hitTestResultInFrame(m_frame, adjust
edPoint, hitType); | 167 currentHitTest = EventHandlingUtil::hitTestResultInFrame(m_frame, adjust
edPoint, hitType); |
165 } | 168 } |
166 | 169 |
167 // Capture data for showUnhandledTapUIIfNeeded. | 170 // Capture data for showUnhandledTapUIIfNeeded. |
168 Node* tappedNode = currentHitTest.innerNode(); | 171 Node* tappedNode = currentHitTest.innerNode(); |
169 IntPoint tappedPosition = gestureEvent.position(); | 172 IntPoint tappedPosition = gestureEvent.position(); |
170 Node* tappedNonTextNode = tappedNode; | 173 Node* tappedNonTextNode = tappedNode; |
171 | 174 |
172 if (tappedNonTextNode && tappedNonTextNode->isTextNode()) | 175 if (tappedNonTextNode && tappedNonTextNode->isTextNode()) |
173 tappedNonTextNode = FlatTreeTraversal::parent(*tappedNonTextNode); | 176 tappedNonTextNode = FlatTreeTraversal::parent(*tappedNonTextNode); |
174 | 177 |
175 m_frame->eventHandler().setClickNode(tappedNonTextNode); | 178 m_mouseEventManager->setClickNode(tappedNonTextNode); |
176 | 179 |
177 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa
lPosition(), | 180 PlatformMouseEvent fakeMouseDown(gestureEvent.position(), gestureEvent.globa
lPosition(), |
178 WebPointerProperties::Button::Left, PlatformEvent::MousePressed, gesture
Event.tapCount(), | 181 WebPointerProperties::Button::Left, PlatformEvent::MousePressed, gesture
Event.tapCount(), |
179 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut
tonDown), | 182 static_cast<PlatformEvent::Modifiers>(modifiers | PlatformEvent::LeftBut
tonDown), |
180 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope
rties::PointerType::Mouse); | 183 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope
rties::PointerType::Mouse); |
181 | 184 |
182 // TODO(mustaq): We suppress MEs plus all it's side effects. What would that | 185 // TODO(mustaq): We suppress MEs plus all it's side effects. What would that |
183 // mean for for TEs? What's the right balance here? crbug.com/617255 | 186 // mean for for TEs? What's the right balance here? crbug.com/617255 |
184 WebInputEventResult mouseDownEventResult = WebInputEventResult::HandledSuppr
essed; | 187 WebInputEventResult mouseDownEventResult = WebInputEventResult::HandledSuppr
essed; |
185 if (!m_suppressMouseEventsFromGestures) { | 188 if (!m_suppressMouseEventsFromGestures) { |
186 mouseDownEventResult = m_frame->eventHandler().dispatchMouseEvent(EventT
ypeNames::mousedown, currentHitTest.innerNode(), gestureEvent.tapCount(), fakeMo
useDown); | 189 mouseDownEventResult = m_mouseEventManager->dispatchMouseEvent(currentHi
tTest.innerNode(), EventTypeNames::mousedown, fakeMouseDown); |
187 m_selectionController->initializeSelectionState(); | 190 m_selectionController->initializeSelectionState(); |
188 if (mouseDownEventResult == WebInputEventResult::NotHandled) | 191 if (mouseDownEventResult == WebInputEventResult::NotHandled) |
189 mouseDownEventResult = m_frame->eventHandler().handleMouseFocus(curr
entHitTest, InputDeviceCapabilities::firesTouchEventsSourceCapabilities()); | 192 mouseDownEventResult = m_mouseEventManager->handleMouseFocus(current
HitTest, InputDeviceCapabilities::firesTouchEventsSourceCapabilities()); |
190 if (mouseDownEventResult == WebInputEventResult::NotHandled) | 193 if (mouseDownEventResult == WebInputEventResult::NotHandled) |
191 mouseDownEventResult = m_frame->eventHandler().handleMousePressEvent
(MouseEventWithHitTestResults(fakeMouseDown, currentHitTest)); | 194 mouseDownEventResult = m_mouseEventManager->handleMousePressEvent(Mo
useEventWithHitTestResults(fakeMouseDown, currentHitTest)); |
192 } | 195 } |
193 | 196 |
194 if (currentHitTest.innerNode()) { | 197 if (currentHitTest.innerNode()) { |
195 DCHECK(gestureEvent.type() == PlatformEvent::GestureTap); | 198 DCHECK(gestureEvent.type() == PlatformEvent::GestureTap); |
196 HitTestResult result = currentHitTest; | 199 HitTestResult result = currentHitTest; |
197 result.setToShadowHostIfInUserAgentShadowRoot(); | 200 result.setToShadowHostIfInUserAgentShadowRoot(); |
198 m_frame->chromeClient().onMouseDown(result.innerNode()); | 201 m_frame->chromeClient().onMouseDown(result.innerNode()); |
199 } | 202 } |
200 | 203 |
201 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 | 204 // FIXME: Use a hit-test cache to avoid unnecessary hit tests. http://crbug.
com/398920 |
202 if (currentHitTest.innerNode()) { | 205 if (currentHitTest.innerNode()) { |
203 LocalFrame* mainFrame = m_frame->localFrameRoot(); | 206 LocalFrame* mainFrame = m_frame->localFrameRoot(); |
204 if (mainFrame && mainFrame->view()) | 207 if (mainFrame && mainFrame->view()) |
205 mainFrame->view()->updateAllLifecyclePhases(); | 208 mainFrame->view()->updateAllLifecyclePhases(); |
206 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); | 209 adjustedPoint = frameView->rootFrameToContents(gestureEvent.position()); |
207 currentHitTest = EventHandlingUtil::hitTestResultInFrame(m_frame, adjust
edPoint, hitType); | 210 currentHitTest = EventHandlingUtil::hitTestResultInFrame(m_frame, adjust
edPoint, hitType); |
208 } | 211 } |
209 | 212 |
210 PlatformMouseEvent fakeMouseUp(gestureEvent.position(), gestureEvent.globalP
osition(), | 213 PlatformMouseEvent fakeMouseUp(gestureEvent.position(), gestureEvent.globalP
osition(), |
211 WebPointerProperties::Button::Left, PlatformEvent::MouseReleased, gestur
eEvent.tapCount(), | 214 WebPointerProperties::Button::Left, PlatformEvent::MouseReleased, gestur
eEvent.tapCount(), |
212 static_cast<PlatformEvent::Modifiers>(modifiers), | 215 static_cast<PlatformEvent::Modifiers>(modifiers), |
213 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope
rties::PointerType::Mouse); | 216 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerPrope
rties::PointerType::Mouse); |
214 WebInputEventResult mouseUpEventResult = m_suppressMouseEventsFromGestures | 217 WebInputEventResult mouseUpEventResult = m_suppressMouseEventsFromGestures |
215 ? WebInputEventResult::HandledSuppressed | 218 ? WebInputEventResult::HandledSuppressed |
216 : m_frame->eventHandler().dispatchMouseEvent(EventTypeNames::mouseup, cu
rrentHitTest.innerNode(), gestureEvent.tapCount(), fakeMouseUp); | 219 : m_mouseEventManager->dispatchMouseEvent(currentHitTest.innerNode(), Ev
entTypeNames::mouseup, fakeMouseUp); |
217 | 220 |
218 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; | 221 WebInputEventResult clickEventResult = WebInputEventResult::NotHandled; |
219 if (tappedNonTextNode) { | 222 if (tappedNonTextNode) { |
220 if (currentHitTest.innerNode()) { | 223 if (currentHitTest.innerNode()) { |
221 // Updates distribution because a mouseup (or mousedown) event liste
ner can make the | 224 // Updates distribution because a mouseup (or mousedown) event liste
ner can make the |
222 // tree dirty at dispatchMouseEvent() invocation above. | 225 // tree dirty at dispatchMouseEvent() invocation above. |
223 // Unless distribution is updated, commonAncestor would hit DCHECK. | 226 // Unless distribution is updated, commonAncestor would hit DCHECK. |
224 // Both tappedNonTextNode and currentHitTest.innerNode()) don't need
to be updated | 227 // Both tappedNonTextNode and currentHitTest.innerNode()) don't need
to be updated |
225 // because commonAncestor() will exit early if their documents are d
ifferent. | 228 // because commonAncestor() will exit early if their documents are d
ifferent. |
226 tappedNonTextNode->updateDistribution(); | 229 tappedNonTextNode->updateDistribution(); |
227 Node* clickTargetNode = currentHitTest.innerNode()->commonAncestor(*
tappedNonTextNode, EventHandler::parentForClickEvent); | 230 Node* clickTargetNode = currentHitTest.innerNode()->commonAncestor(*
tappedNonTextNode, EventHandlingUtil::parentForClickEvent); |
228 clickEventResult = m_frame->eventHandler().dispatchMouseEvent(EventT
ypeNames::click, clickTargetNode, gestureEvent.tapCount(), fakeMouseUp); | 231 clickEventResult = m_mouseEventManager->dispatchMouseEvent(clickTarg
etNode, EventTypeNames::click, fakeMouseUp); |
229 } | 232 } |
230 m_frame->eventHandler().setClickNode(nullptr); | 233 m_mouseEventManager->setClickNode(nullptr); |
231 } | 234 } |
232 | 235 |
233 if (mouseUpEventResult == WebInputEventResult::NotHandled) | 236 if (mouseUpEventResult == WebInputEventResult::NotHandled) |
234 mouseUpEventResult = m_frame->eventHandler().handleMouseReleaseEvent(Mou
seEventWithHitTestResults(fakeMouseUp, currentHitTest)); | 237 mouseUpEventResult = m_mouseEventManager->handleMouseReleaseEvent(MouseE
ventWithHitTestResults(fakeMouseUp, currentHitTest)); |
235 m_frame->eventHandler().clearDragHeuristicState(); | 238 m_mouseEventManager->clearDragHeuristicState(); |
236 | 239 |
237 WebInputEventResult eventResult = EventHandlingUtil::mergeEventResult(EventH
andlingUtil::mergeEventResult(mouseDownEventResult, mouseUpEventResult), clickEv
entResult); | 240 WebInputEventResult eventResult = EventHandlingUtil::mergeEventResult(EventH
andlingUtil::mergeEventResult(mouseDownEventResult, mouseUpEventResult), clickEv
entResult); |
238 if (eventResult == WebInputEventResult::NotHandled && tappedNode && m_frame-
>page()) { | 241 if (eventResult == WebInputEventResult::NotHandled && tappedNode && m_frame-
>page()) { |
239 bool domTreeChanged = preDispatchDomTreeVersion != m_frame->document()->
domTreeVersion(); | 242 bool domTreeChanged = preDispatchDomTreeVersion != m_frame->document()->
domTreeVersion(); |
240 bool styleChanged = preDispatchStyleVersion != m_frame->document()->styl
eVersion(); | 243 bool styleChanged = preDispatchStyleVersion != m_frame->document()->styl
eVersion(); |
241 | 244 |
242 IntPoint tappedPositionInViewport = frameHost()->visualViewport().rootFr
ameToViewport(tappedPosition); | 245 IntPoint tappedPositionInViewport = frameHost()->visualViewport().rootFr
ameToViewport(tappedPosition); |
243 m_frame->chromeClient().showUnhandledTapUIIfNeeded(tappedPositionInViewp
ort, tappedNode, domTreeChanged || styleChanged); | 246 m_frame->chromeClient().showUnhandledTapUIIfNeeded(tappedPositionInViewp
ort, tappedNode, domTreeChanged || styleChanged); |
244 } | 247 } |
245 return eventResult; | 248 return eventResult; |
246 } | 249 } |
247 | 250 |
248 WebInputEventResult GestureManager::handleGestureLongPress(const GestureEventWit
hHitTestResults& targetedEvent) | 251 WebInputEventResult GestureManager::handleGestureLongPress(const GestureEventWit
hHitTestResults& targetedEvent) |
249 { | 252 { |
250 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); | 253 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); |
251 | 254 |
252 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests
here (re-using the | 255 // FIXME: Ideally we should try to remove the extra mouse-specific hit-tests
here (re-using the |
253 // supplied HitTestResult), but that will require some overhaul of the touch
drag-and-drop code | 256 // supplied HitTestResult), but that will require some overhaul of the touch
drag-and-drop code |
254 // and LongPress is such a special scenario that it's unlikely to matter muc
h in practice. | 257 // and LongPress is such a special scenario that it's unlikely to matter muc
h in practice. |
255 | 258 |
256 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(gestureEvent.po
sition()); | 259 IntPoint hitTestPoint = m_frame->view()->rootFrameToContents(gestureEvent.po
sition()); |
257 HitTestResult hitTestResult = m_frame->eventHandler().hitTestResultAtPoint(h
itTestPoint); | 260 HitTestResult hitTestResult = m_frame->eventHandler().hitTestResultAtPoint(h
itTestPoint); |
258 | 261 |
259 m_longTapShouldInvokeContextMenu = false; | 262 m_longTapShouldInvokeContextMenu = false; |
260 bool hitTestContainsLinks = hitTestResult.URLElement() || !hitTestResult.abs
oluteImageURL().isNull() || !hitTestResult.absoluteMediaURL().isNull(); | 263 bool hitTestContainsLinks = hitTestResult.URLElement() || !hitTestResult.abs
oluteImageURL().isNull() || !hitTestResult.absoluteMediaURL().isNull(); |
261 | 264 |
262 if (!hitTestContainsLinks && m_frame->eventHandler().handleDragDropIfPossibl
e(targetedEvent)) { | 265 if (!hitTestContainsLinks && m_mouseEventManager->handleDragDropIfPossible(t
argetedEvent)) { |
263 m_longTapShouldInvokeContextMenu = true; | 266 m_longTapShouldInvokeContextMenu = true; |
264 return WebInputEventResult::HandledSystem; | 267 return WebInputEventResult::HandledSystem; |
265 } | 268 } |
266 | 269 |
267 if (m_selectionController->handleGestureLongPress(gestureEvent, hitTestResul
t)) { | 270 if (m_selectionController->handleGestureLongPress(gestureEvent, hitTestResul
t)) { |
268 m_frame->eventHandler().focusDocumentView(); | 271 m_mouseEventManager->focusDocumentView(); |
269 return WebInputEventResult::HandledSystem; | 272 return WebInputEventResult::HandledSystem; |
270 } | 273 } |
271 | 274 |
272 return sendContextMenuEventForGesture(targetedEvent); | 275 return sendContextMenuEventForGesture(targetedEvent); |
273 } | 276 } |
274 | 277 |
275 WebInputEventResult GestureManager::handleGestureLongTap(const GestureEventWithH
itTestResults& targetedEvent) | 278 WebInputEventResult GestureManager::handleGestureLongTap(const GestureEventWithH
itTestResults& targetedEvent) |
276 { | 279 { |
277 #if !OS(ANDROID) | 280 #if !OS(ANDROID) |
278 if (m_longTapShouldInvokeContextMenu) { | 281 if (m_longTapShouldInvokeContextMenu) { |
(...skipping 13 matching lines...) Expand all Loading... |
292 { | 295 { |
293 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); | 296 const PlatformGestureEvent& gestureEvent = targetedEvent.event(); |
294 unsigned modifiers = gestureEvent.getModifiers(); | 297 unsigned modifiers = gestureEvent.getModifiers(); |
295 | 298 |
296 if (!m_suppressMouseEventsFromGestures) { | 299 if (!m_suppressMouseEventsFromGestures) { |
297 // Send MouseMoved event prior to handling (https://crbug.com/485290). | 300 // Send MouseMoved event prior to handling (https://crbug.com/485290). |
298 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.g
lobalPosition(), | 301 PlatformMouseEvent fakeMouseMove(gestureEvent.position(), gestureEvent.g
lobalPosition(), |
299 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, /
* clickCount */ 0, | 302 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, /
* clickCount */ 0, |
300 static_cast<PlatformEvent::Modifiers>(modifiers), | 303 static_cast<PlatformEvent::Modifiers>(modifiers), |
301 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerP
roperties::PointerType::Mouse); | 304 PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), WebPointerP
roperties::PointerType::Mouse); |
302 m_frame->eventHandler().dispatchMouseEvent( | 305 m_mouseEventManager->dispatchMouseEvent( |
303 EventTypeNames::mousemove, targetedEvent.hitTestResult().innerNode()
, 0, fakeMouseMove); | 306 targetedEvent.hitTestResult().innerNode(), EventTypeNames::mousemove
, fakeMouseMove, 0); |
304 } | 307 } |
305 | 308 |
306 PlatformEvent::EventType eventType = PlatformEvent::MousePressed; | 309 PlatformEvent::EventType eventType = PlatformEvent::MousePressed; |
307 if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp()) | 310 if (m_frame->settings() && m_frame->settings()->showContextMenuOnMouseUp()) |
308 eventType = PlatformEvent::MouseReleased; | 311 eventType = PlatformEvent::MouseReleased; |
309 PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEven
t.event().globalPosition(), WebPointerProperties::Button::NoButton, | 312 PlatformMouseEvent mouseEvent(targetedEvent.event().position(), targetedEven
t.event().globalPosition(), WebPointerProperties::Button::NoButton, |
310 eventType, /* clickCount */ 0, static_cast<PlatformEvent::Modifiers>(mod
ifiers), PlatformMouseEvent::FromTouch, | 313 eventType, /* clickCount */ 0, static_cast<PlatformEvent::Modifiers>(mod
ifiers), PlatformMouseEvent::FromTouch, |
311 WTF::monotonicallyIncreasingTime(), WebPointerProperties::PointerType::M
ouse); | 314 WTF::monotonicallyIncreasingTime(), WebPointerProperties::PointerType::M
ouse); |
312 | 315 |
313 if (!m_suppressMouseEventsFromGestures && m_frame->view()) { | 316 if (!m_suppressMouseEventsFromGestures && m_frame->view()) { |
314 HitTestRequest request(HitTestRequest::Active); | 317 HitTestRequest request(HitTestRequest::Active); |
315 LayoutPoint documentPoint = m_frame->view()->rootFrameToContents(targete
dEvent.event().position()); | 318 LayoutPoint documentPoint = m_frame->view()->rootFrameToContents(targete
dEvent.event().position()); |
316 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEven
t(request, documentPoint, mouseEvent); | 319 MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEven
t(request, documentPoint, mouseEvent); |
317 | 320 |
318 WebInputEventResult eventResult = m_frame->eventHandler().dispatchMouseE
vent( | 321 WebInputEventResult eventResult = m_mouseEventManager->dispatchMouseEven
t( |
319 EventTypeNames::mousedown, mev.innerNode(), /* clickCount */ 0, mous
eEvent); | 322 mev.innerNode(), EventTypeNames::mousedown, mouseEvent, /* clickCoun
t */ 0); |
320 | 323 |
321 if (eventResult == WebInputEventResult::NotHandled) | 324 if (eventResult == WebInputEventResult::NotHandled) |
322 eventResult = m_frame->eventHandler().handleMouseFocus(mev.hitTestRe
sult(), InputDeviceCapabilities::firesTouchEventsSourceCapabilities()); | 325 eventResult = m_mouseEventManager->handleMouseFocus(mev.hitTestResul
t(), InputDeviceCapabilities::firesTouchEventsSourceCapabilities()); |
323 | 326 |
324 if (eventResult == WebInputEventResult::NotHandled) | 327 if (eventResult == WebInputEventResult::NotHandled) |
325 m_frame->eventHandler().handleMousePressEvent(mev); | 328 m_mouseEventManager->handleMousePressEvent(mev); |
326 } | 329 } |
327 | 330 |
328 return m_frame->eventHandler().sendContextMenuEvent(mouseEvent); | 331 return m_frame->eventHandler().sendContextMenuEvent(mouseEvent); |
329 } | 332 } |
330 | 333 |
331 WebInputEventResult GestureManager::handleGestureShowPress() | 334 WebInputEventResult GestureManager::handleGestureShowPress() |
332 { | 335 { |
333 m_lastShowPressTimestamp = WTF::monotonicallyIncreasingTime(); | 336 m_lastShowPressTimestamp = WTF::monotonicallyIncreasingTime(); |
334 | 337 |
335 FrameView* view = m_frame->view(); | 338 FrameView* view = m_frame->view(); |
(...skipping 19 matching lines...) Expand all Loading... |
355 | 358 |
356 return &m_frame->page()->frameHost(); | 359 return &m_frame->page()->frameHost(); |
357 } | 360 } |
358 | 361 |
359 double GestureManager::getLastShowPressTimestamp() const | 362 double GestureManager::getLastShowPressTimestamp() const |
360 { | 363 { |
361 return m_lastShowPressTimestamp; | 364 return m_lastShowPressTimestamp; |
362 } | 365 } |
363 | 366 |
364 } // namespace blink | 367 } // namespace blink |
OLD | NEW |