Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 2255323004: Create MouseEventManager and EventHandlingUtil (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "core/frame/FrameHost.h" 56 #include "core/frame/FrameHost.h"
57 #include "core/frame/FrameView.h" 57 #include "core/frame/FrameView.h"
58 #include "core/frame/LocalFrame.h" 58 #include "core/frame/LocalFrame.h"
59 #include "core/frame/Settings.h" 59 #include "core/frame/Settings.h"
60 #include "core/frame/UseCounter.h" 60 #include "core/frame/UseCounter.h"
61 #include "core/frame/VisualViewport.h" 61 #include "core/frame/VisualViewport.h"
62 #include "core/html/HTMLDialogElement.h" 62 #include "core/html/HTMLDialogElement.h"
63 #include "core/html/HTMLFrameElementBase.h" 63 #include "core/html/HTMLFrameElementBase.h"
64 #include "core/html/HTMLFrameSetElement.h" 64 #include "core/html/HTMLFrameSetElement.h"
65 #include "core/html/HTMLInputElement.h" 65 #include "core/html/HTMLInputElement.h"
66 #include "core/input/EventHandlingUtil.h"
66 #include "core/input/InputDeviceCapabilities.h" 67 #include "core/input/InputDeviceCapabilities.h"
67 #include "core/input/TouchActionUtil.h" 68 #include "core/input/TouchActionUtil.h"
68 #include "core/layout/HitTestRequest.h" 69 #include "core/layout/HitTestRequest.h"
69 #include "core/layout/HitTestResult.h" 70 #include "core/layout/HitTestResult.h"
70 #include "core/layout/LayoutPart.h" 71 #include "core/layout/LayoutPart.h"
71 #include "core/layout/LayoutTextControlSingleLine.h" 72 #include "core/layout/LayoutTextControlSingleLine.h"
72 #include "core/layout/LayoutView.h" 73 #include "core/layout/LayoutView.h"
73 #include "core/layout/api/LayoutViewItem.h" 74 #include "core/layout/api/LayoutViewItem.h"
74 #include "core/loader/DocumentLoader.h" 75 #include "core/loader/DocumentLoader.h"
75 #include "core/loader/FrameLoader.h" 76 #include "core/loader/FrameLoader.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 , m_hoverTimer(this, &EventHandler::hoverTimerFired) 185 , m_hoverTimer(this, &EventHandler::hoverTimerFired)
185 , m_cursorUpdateTimer(this, &EventHandler::cursorUpdateTimerFired) 186 , m_cursorUpdateTimer(this, &EventHandler::cursorUpdateTimerFired)
186 , m_mouseDownMayStartAutoscroll(false) 187 , m_mouseDownMayStartAutoscroll(false)
187 , m_fakeMouseMoveEventTimer(this, &EventHandler::fakeMouseMoveEventTimerFire d) 188 , m_fakeMouseMoveEventTimer(this, &EventHandler::fakeMouseMoveEventTimerFire d)
188 , m_svgPan(false) 189 , m_svgPan(false)
189 , m_eventHandlerWillResetCapturingMouseEventsNode(0) 190 , m_eventHandlerWillResetCapturingMouseEventsNode(0)
190 , m_clickCount(0) 191 , m_clickCount(0)
191 , m_shouldOnlyFireDragOverEvent(false) 192 , m_shouldOnlyFireDragOverEvent(false)
192 , m_mousePositionIsUnknown(true) 193 , m_mousePositionIsUnknown(true)
193 , m_mouseDownTimestamp(0) 194 , m_mouseDownTimestamp(0)
194 , m_pointerEventManager(frame) 195 , m_scrollManager(new ScrollManager(frame))
195 , m_scrollManager(frame) 196 , m_mouseEventManager(new MouseEventManager(frame))
196 , m_keyboardEventManager(frame, &m_scrollManager) 197 , m_keyboardEventManager(new KeyboardEventManager(frame, m_scrollManager))
197 , m_gestureManager(frame, &m_scrollManager, &m_pointerEventManager, m_select ionController) 198 , m_pointerEventManager(new PointerEventManager(frame, m_mouseEventManager))
199 , m_gestureManager(new GestureManager(frame, m_scrollManager, m_pointerEvent Manager, m_selectionController))
198 , m_activeIntervalTimer(this, &EventHandler::activeIntervalTimerFired) 200 , m_activeIntervalTimer(this, &EventHandler::activeIntervalTimerFired)
199 { 201 {
200 } 202 }
201 203
202 EventHandler::~EventHandler() 204 EventHandler::~EventHandler()
203 { 205 {
204 ASSERT(!m_fakeMouseMoveEventTimer.isActive()); 206 ASSERT(!m_fakeMouseMoveEventTimer.isActive());
205 } 207 }
206 208
207 DEFINE_TRACE(EventHandler) 209 DEFINE_TRACE(EventHandler)
208 { 210 {
209 visitor->trace(m_frame); 211 visitor->trace(m_frame);
210 visitor->trace(m_mousePressNode); 212 visitor->trace(m_mousePressNode);
213 visitor->trace(m_selectionController);
211 visitor->trace(m_capturingMouseEventsNode); 214 visitor->trace(m_capturingMouseEventsNode);
212 visitor->trace(m_nodeUnderMouse); 215 visitor->trace(m_nodeUnderMouse);
213 visitor->trace(m_lastMouseMoveEventSubframe); 216 visitor->trace(m_lastMouseMoveEventSubframe);
214 visitor->trace(m_lastScrollbarUnderMouse); 217 visitor->trace(m_lastScrollbarUnderMouse);
215 visitor->trace(m_clickNode); 218 visitor->trace(m_clickNode);
216 visitor->trace(m_dragTarget); 219 visitor->trace(m_dragTarget);
217 visitor->trace(m_frameSetBeingResized); 220 visitor->trace(m_frameSetBeingResized);
221 visitor->trace(m_scrollManager);
222 visitor->trace(m_mouseEventManager);
223 visitor->trace(m_keyboardEventManager);
224 visitor->trace(m_pointerEventManager);
225 visitor->trace(m_gestureManager);
218 visitor->trace(m_lastDeferredTapElement); 226 visitor->trace(m_lastDeferredTapElement);
219 visitor->trace(m_selectionController);
220 visitor->trace(m_pointerEventManager);
221 visitor->trace(m_scrollManager);
222 visitor->trace(m_keyboardEventManager);
223 visitor->trace(m_gestureManager);
224 } 227 }
225 228
226 DragState& EventHandler::dragState() 229 DragState& EventHandler::dragState()
227 { 230 {
228 DEFINE_STATIC_LOCAL(DragState, state, (new DragState)); 231 DEFINE_STATIC_LOCAL(DragState, state, (new DragState));
229 return state; 232 return state;
230 } 233 }
231 234
232 void EventHandler::clear() 235 void EventHandler::clear()
233 { 236 {
(...skipping 10 matching lines...) Expand all
244 m_dragTarget = nullptr; 247 m_dragTarget = nullptr;
245 m_shouldOnlyFireDragOverEvent = false; 248 m_shouldOnlyFireDragOverEvent = false;
246 m_mousePositionIsUnknown = true; 249 m_mousePositionIsUnknown = true;
247 m_lastKnownMousePosition = IntPoint(); 250 m_lastKnownMousePosition = IntPoint();
248 m_lastKnownMouseGlobalPosition = IntPoint(); 251 m_lastKnownMouseGlobalPosition = IntPoint();
249 m_lastMouseDownUserGestureToken.clear(); 252 m_lastMouseDownUserGestureToken.clear();
250 m_mousePressNode = nullptr; 253 m_mousePressNode = nullptr;
251 m_mousePressed = false; 254 m_mousePressed = false;
252 m_capturesDragging = false; 255 m_capturesDragging = false;
253 m_capturingMouseEventsNode = nullptr; 256 m_capturingMouseEventsNode = nullptr;
254 m_pointerEventManager.clear(); 257 m_pointerEventManager->clear();
255 m_scrollManager.clear(); 258 m_scrollManager->clear();
256 m_gestureManager.clear(); 259 m_gestureManager->clear();
260 m_mouseEventManager->clear();
257 m_mouseDownMayStartDrag = false; 261 m_mouseDownMayStartDrag = false;
258 m_lastDeferredTapElement = nullptr; 262 m_lastDeferredTapElement = nullptr;
259 m_eventHandlerWillResetCapturingMouseEventsNode = false; 263 m_eventHandlerWillResetCapturingMouseEventsNode = false;
260 m_mouseDownMayStartAutoscroll = false; 264 m_mouseDownMayStartAutoscroll = false;
261 m_svgPan = false; 265 m_svgPan = false;
262 m_mouseDownPos = IntPoint(); 266 m_mouseDownPos = IntPoint();
263 m_mouseDownTimestamp = 0; 267 m_mouseDownTimestamp = 0;
264 m_dragStartPos = LayoutPoint(); 268 m_dragStartPos = LayoutPoint();
265 m_mouseDown = PlatformMouseEvent(); 269 m_mouseDown = PlatformMouseEvent();
266 } 270 }
267 271
268 WebInputEventResult EventHandler::mergeEventResult(
269 WebInputEventResult resultA, WebInputEventResult resultB)
270 {
271 // The ordering of the enumeration is specific. There are times that
272 // multiple events fire and we need to combine them into a single
273 // result code. The enumeration is based on the level of consumption that
274 // is most significant. The enumeration is ordered with smaller specified
275 // numbers first. Examples of merged results are:
276 // (HandledApplication, HandledSystem) -> HandledSystem
277 // (NotHandled, HandledApplication) -> HandledApplication
278 static_assert(static_cast<int>(WebInputEventResult::NotHandled) == 0, "WebIn putEventResult not ordered");
279 static_assert(static_cast<int>(WebInputEventResult::HandledSuppressed) < sta tic_cast<int>(WebInputEventResult::HandledApplication), "WebInputEventResult not ordered");
280 static_assert(static_cast<int>(WebInputEventResult::HandledApplication) < st atic_cast<int>(WebInputEventResult::HandledSystem), "WebInputEventResult not ord ered");
281 return static_cast<WebInputEventResult>(max(static_cast<int>(resultA), stati c_cast<int>(resultB)));
282 }
283
284 WebInputEventResult EventHandler::toWebInputEventResult(
285 DispatchEventResult result)
286 {
287 switch (result) {
288 case DispatchEventResult::NotCanceled:
289 return WebInputEventResult::NotHandled;
290 case DispatchEventResult::CanceledByEventHandler:
291 return WebInputEventResult::HandledApplication;
292 case DispatchEventResult::CanceledByDefaultEventHandler:
293 return WebInputEventResult::HandledSystem;
294 case DispatchEventResult::CanceledBeforeDispatch:
295 return WebInputEventResult::HandledSuppressed;
296 default:
297 ASSERT_NOT_REACHED();
298 return WebInputEventResult::HandledSystem;
299 }
300 }
301
302 void EventHandler::nodeWillBeRemoved(Node& nodeToBeRemoved) 272 void EventHandler::nodeWillBeRemoved(Node& nodeToBeRemoved)
303 { 273 {
304 if (nodeToBeRemoved.isShadowIncludingInclusiveAncestorOf(m_clickNode.get())) { 274 if (nodeToBeRemoved.isShadowIncludingInclusiveAncestorOf(m_clickNode.get())) {
305 // We don't dispatch click events if the mousedown node is removed 275 // We don't dispatch click events if the mousedown node is removed
306 // before a mouseup event. It is compatible with IE and Firefox. 276 // before a mouseup event. It is compatible with IE and Firefox.
307 m_clickNode = nullptr; 277 m_clickNode = nullptr;
308 } 278 }
309 } 279 }
310 280
311 WebInputEventResult EventHandler::handleMousePressEvent(const MouseEventWithHitT estResults& event) 281 WebInputEventResult EventHandler::handleMousePressEvent(const MouseEventWithHitT estResults& event)
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if (!parent) 374 if (!parent)
405 return WebInputEventResult::NotHandled; 375 return WebInputEventResult::NotHandled;
406 376
407 layoutObject = parent->layoutObject(); 377 layoutObject = parent->layoutObject();
408 if (!layoutObject || !layoutObject->isListBox()) 378 if (!layoutObject || !layoutObject->isListBox())
409 return WebInputEventResult::NotHandled; 379 return WebInputEventResult::NotHandled;
410 } 380 }
411 381
412 m_mouseDownMayStartDrag = false; 382 m_mouseDownMayStartDrag = false;
413 383
414 if (m_mouseDownMayStartAutoscroll && !m_scrollManager.panScrollInProgress()) { 384 if (m_mouseDownMayStartAutoscroll && !m_scrollManager->panScrollInProgress() ) {
415 if (AutoscrollController* controller = m_scrollManager.autoscrollControl ler()) { 385 if (AutoscrollController* controller = m_scrollManager->autoscrollContro ller()) {
416 controller->startAutoscrollForSelection(layoutObject); 386 controller->startAutoscrollForSelection(layoutObject);
417 m_mouseDownMayStartAutoscroll = false; 387 m_mouseDownMayStartAutoscroll = false;
418 } 388 }
419 } 389 }
420 390
421 selectionController().handleMouseDraggedEvent(event, m_mouseDownPos, m_dragS tartPos, m_mousePressNode.get(), m_lastKnownMousePosition); 391 selectionController().handleMouseDraggedEvent(event, m_mouseDownPos, m_dragS tartPos, m_mousePressNode.get(), m_lastKnownMousePosition);
422 return WebInputEventResult::HandledSystem; 392 return WebInputEventResult::HandledSystem;
423 } 393 }
424 394
425 void EventHandler::updateSelectionForMouseDrag() 395 void EventHandler::updateSelectionForMouseDrag()
426 { 396 {
427 selectionController().updateSelectionForMouseDrag(m_mousePressNode.get(), m_ dragStartPos, m_lastKnownMousePosition); 397 selectionController().updateSelectionForMouseDrag(m_mousePressNode.get(), m_ dragStartPos, m_lastKnownMousePosition);
428 } 398 }
429 399
400 // TODO(nzolghadr): Refactor the mouse related functions to MouseEventManager.
430 WebInputEventResult EventHandler::handleMouseReleaseEvent(const MouseEventWithHi tTestResults& event) 401 WebInputEventResult EventHandler::handleMouseReleaseEvent(const MouseEventWithHi tTestResults& event)
431 { 402 {
432 AutoscrollController* controller = m_scrollManager.autoscrollController(); 403 AutoscrollController* controller = m_scrollManager->autoscrollController();
433 if (controller && controller->autoscrollInProgress()) 404 if (controller && controller->autoscrollInProgress())
434 m_scrollManager.stopAutoscroll(); 405 m_scrollManager->stopAutoscroll();
435 406
436 return selectionController().handleMouseReleaseEvent(event, m_dragStartPos) ? WebInputEventResult::HandledSystem : WebInputEventResult::NotHandled; 407 return selectionController().handleMouseReleaseEvent(event, m_dragStartPos) ? WebInputEventResult::HandledSystem : WebInputEventResult::NotHandled;
437 } 408 }
438 409
439 #if OS(WIN) 410 #if OS(WIN)
440 411
441 void EventHandler::startPanScrolling(LayoutObject* layoutObject) 412 void EventHandler::startPanScrolling(LayoutObject* layoutObject)
442 { 413 {
443 if (!layoutObject->isBox()) 414 if (!layoutObject->isBox())
444 return; 415 return;
445 AutoscrollController* controller = m_scrollManager.autoscrollController(); 416 AutoscrollController* controller = m_scrollManager->autoscrollController();
446 if (!controller) 417 if (!controller)
447 return; 418 return;
448 controller->startPanScrolling(toLayoutBox(layoutObject), lastKnownMousePosit ion()); 419 controller->startPanScrolling(toLayoutBox(layoutObject), lastKnownMousePosit ion());
449 invalidateClick(); 420 invalidateClick();
450 } 421 }
451 422
452 #endif // OS(WIN) 423 #endif // OS(WIN)
453 424
454 HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTe stRequest::HitTestRequestType hitType, const LayoutSize& padding) 425 HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTe stRequest::HitTestRequestType hitType, const LayoutSize& padding)
455 { 426 {
(...skipping 30 matching lines...) Expand all
486 457
487 m_frame->contentLayoutItem().hitTest(result); 458 m_frame->contentLayoutItem().hitTest(result);
488 if (!request.readOnly()) 459 if (!request.readOnly())
489 m_frame->document()->updateHoverActiveState(request, result.innerElement ()); 460 m_frame->document()->updateHoverActiveState(request, result.innerElement ());
490 461
491 return result; 462 return result;
492 } 463 }
493 464
494 void EventHandler::stopAutoscroll() 465 void EventHandler::stopAutoscroll()
495 { 466 {
496 m_scrollManager.stopAutoscroll(); 467 m_scrollManager->stopAutoscroll();
497 } 468 }
498 469
499 // TODO(bokan): This should be merged with logicalScroll assuming 470 // TODO(bokan): This should be merged with logicalScroll assuming
500 // defaultSpaceEventHandler's chaining scroll can be done crossing frames. 471 // defaultSpaceEventHandler's chaining scroll can be done crossing frames.
501 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g ranularity, Node* startingNode) 472 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g ranularity, Node* startingNode)
502 { 473 {
503 return m_scrollManager.bubblingScroll(direction, granularity, startingNode, m_mousePressNode); 474 return m_scrollManager->bubblingScroll(direction, granularity, startingNode, m_mousePressNode);
504 } 475 }
505 476
506 IntPoint EventHandler::lastKnownMousePosition() const 477 IntPoint EventHandler::lastKnownMousePosition() const
507 { 478 {
508 return m_lastKnownMousePosition; 479 return m_lastKnownMousePosition;
509 } 480 }
510 481
511 IntPoint EventHandler::dragDataTransferLocationForTesting() 482 IntPoint EventHandler::dragDataTransferLocationForTesting()
512 { 483 {
513 if (dragState().m_dragDataTransfer) 484 if (dragState().m_dragDataTransfer)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 if (LocalFrame* frame = result.innerNodeFrame()) { 559 if (LocalFrame* frame = result.innerNodeFrame()) {
589 OptionalCursor optionalCursor = frame->eventHandler().selectCursor(resul t); 560 OptionalCursor optionalCursor = frame->eventHandler().selectCursor(resul t);
590 if (optionalCursor.isCursorChange()) { 561 if (optionalCursor.isCursorChange()) {
591 view->setCursor(optionalCursor.cursor()); 562 view->setCursor(optionalCursor.cursor());
592 } 563 }
593 } 564 }
594 } 565 }
595 566
596 OptionalCursor EventHandler::selectCursor(const HitTestResult& result) 567 OptionalCursor EventHandler::selectCursor(const HitTestResult& result)
597 { 568 {
598 if (m_scrollManager.inResizeMode()) 569 if (m_scrollManager->inResizeMode())
599 return NoCursorChange; 570 return NoCursorChange;
600 571
601 Page* page = m_frame->page(); 572 Page* page = m_frame->page();
602 if (!page) 573 if (!page)
603 return NoCursorChange; 574 return NoCursorChange;
604 if (m_scrollManager.panScrollInProgress()) 575 if (m_scrollManager->panScrollInProgress())
605 return NoCursorChange; 576 return NoCursorChange;
606 577
607 Node* node = result.innerPossiblyPseudoNode(); 578 Node* node = result.innerPossiblyPseudoNode();
608 if (!node) 579 if (!node)
609 return selectAutoCursor(result, node, iBeamCursor()); 580 return selectAutoCursor(result, node, iBeamCursor());
610 581
611 LayoutObject* layoutObject = node->layoutObject(); 582 LayoutObject* layoutObject = node->layoutObject();
612 const ComputedStyle* style = layoutObject ? layoutObject->style() : nullptr; 583 const ComputedStyle* style = layoutObject ? layoutObject->style() : nullptr;
613 584
614 if (layoutObject) { 585 if (layoutObject) {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 m_capturingMouseEventsNode = mev.innerNode(); 798 m_capturingMouseEventsNode = mev.innerNode();
828 m_eventHandlerWillResetCapturingMouseEventsNode = true; 799 m_eventHandlerWillResetCapturingMouseEventsNode = true;
829 } 800 }
830 invalidateClick(); 801 invalidateClick();
831 return result; 802 return result;
832 } 803 }
833 804
834 #if OS(WIN) 805 #if OS(WIN)
835 // We store whether pan scrolling is in progress before calling stopAutoscro ll() 806 // We store whether pan scrolling is in progress before calling stopAutoscro ll()
836 // because it will set m_autoscrollType to NoAutoscroll on return. 807 // because it will set m_autoscrollType to NoAutoscroll on return.
837 bool isPanScrollInProgress = m_scrollManager.panScrollInProgress(); 808 bool isPanScrollInProgress = m_scrollManager->panScrollInProgress();
838 m_scrollManager.stopAutoscroll(); 809 m_scrollManager->stopAutoscroll();
839 if (isPanScrollInProgress) { 810 if (isPanScrollInProgress) {
840 // We invalidate the click when exiting pan scrolling so that we don't i nadvertently navigate 811 // We invalidate the click when exiting pan scrolling so that we don't i nadvertently navigate
841 // away from the current page (e.g. the click was on a hyperlink). See < rdar://problem/6095023>. 812 // away from the current page (e.g. the click was on a hyperlink). See < rdar://problem/6095023>.
842 invalidateClick(); 813 invalidateClick();
843 return WebInputEventResult::HandledSuppressed; 814 return WebInputEventResult::HandledSuppressed;
844 } 815 }
845 #endif 816 #endif
846 817
847 m_clickCount = mouseEvent.clickCount(); 818 m_clickCount = mouseEvent.clickCount();
848 m_clickNode = mev.innerNode()->isTextNode() ? FlatTreeTraversal::parent(*me v.innerNode()) : mev.innerNode(); 819 m_clickNode = mev.innerNode()->isTextNode() ? FlatTreeTraversal::parent(*me v.innerNode()) : mev.innerNode();
849 820
850 if (!mouseEvent.fromTouch()) 821 if (!mouseEvent.fromTouch())
851 m_frame->selection().setCaretBlinkingSuspended(true); 822 m_frame->selection().setCaretBlinkingSuspended(true);
852 823
853 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(Event TypeNames::mousedown, mev.innerNode(), m_clickCount, mev.event()); 824 WebInputEventResult eventResult = updatePointerTargetAndDispatchEvents(Event TypeNames::mousedown, mev.innerNode(), m_clickCount, mev.event());
854 825
855 if (eventResult == WebInputEventResult::NotHandled && m_frame->view()) { 826 if (eventResult == WebInputEventResult::NotHandled && m_frame->view()) {
856 FrameView* view = m_frame->view(); 827 FrameView* view = m_frame->view();
857 PaintLayer* layer = mev.innerNode()->layoutObject() ? mev.innerNode()->l ayoutObject()->enclosingLayer() : nullptr; 828 PaintLayer* layer = mev.innerNode()->layoutObject() ? mev.innerNode()->l ayoutObject()->enclosingLayer() : nullptr;
858 IntPoint p = view->rootFrameToContents(mouseEvent.position()); 829 IntPoint p = view->rootFrameToContents(mouseEvent.position());
859 if (layer && layer->getScrollableArea() && layer->getScrollableArea()->i sPointInResizeControl(p, ResizerForPointer)) { 830 if (layer && layer->getScrollableArea() && layer->getScrollableArea()->i sPointInResizeControl(p, ResizerForPointer)) {
860 m_scrollManager.setResizeScrollableArea(layer, p); 831 m_scrollManager->setResizeScrollableArea(layer, p);
861 return WebInputEventResult::HandledSystem; 832 return WebInputEventResult::HandledSystem;
862 } 833 }
863 } 834 }
864 835
865 // m_selectionInitiationState is initialized after dispatching mousedown 836 // m_selectionInitiationState is initialized after dispatching mousedown
866 // event in order not to keep the selection by DOM APIs because we can't 837 // 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 838 // 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 839 // 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. 840 // the same behavior and it's more compatible with other browsers.
870 selectionController().initializeSelectionState(); 841 selectionController().initializeSelectionState();
871 HitTestResult hitTestResult = hitTestResultInFrame(m_frame, documentPoint, H itTestRequest::ReadOnly); 842 HitTestResult hitTestResult = EventHandlingUtil::hitTestResultInFrame(m_fram e, documentPoint, HitTestRequest::ReadOnly);
872 InputDeviceCapabilities* sourceCapabilities = mouseEvent.getSyntheticEventTy pe() == PlatformMouseEvent::FromTouch ? InputDeviceCapabilities::firesTouchEvent sSourceCapabilities() : 843 InputDeviceCapabilities* sourceCapabilities = mouseEvent.getSyntheticEventTy pe() == PlatformMouseEvent::FromTouch ? InputDeviceCapabilities::firesTouchEvent sSourceCapabilities() :
873 InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities(); 844 InputDeviceCapabilities::doesntFireTouchEventsSourceCapabilities();
874 if (eventResult == WebInputEventResult::NotHandled) 845 if (eventResult == WebInputEventResult::NotHandled)
875 eventResult = handleMouseFocus(hitTestResult, sourceCapabilities); 846 eventResult = handleMouseFocus(hitTestResult, sourceCapabilities);
876 m_capturesDragging = eventResult == WebInputEventResult::NotHandled || mev.s crollbar(); 847 m_capturesDragging = eventResult == WebInputEventResult::NotHandled || mev.s crollbar();
877 848
878 // If the hit testing originally determined the event was in a scrollbar, re fetch the MouseEventWithHitTestResults 849 // If the hit testing originally determined the event was in a scrollbar, re fetch the MouseEventWithHitTestResults
879 // in case the scrollbar widget was destroyed when the mouse event was handl ed. 850 // in case the scrollbar widget was destroyed when the mouse event was handl ed.
880 if (mev.scrollbar()) { 851 if (mev.scrollbar()) {
881 const bool wasLastScrollBar = mev.scrollbar() == m_lastScrollbarUnderMou se.get(); 852 const bool wasLastScrollBar = mev.scrollbar() == m_lastScrollbarUnderMou se.get();
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 hitType |= HitTestRequest::Active; 975 hitType |= HitTestRequest::Active;
1005 } else if (onlyUpdateScrollbars) { 976 } else if (onlyUpdateScrollbars) {
1006 // Mouse events should be treated as "read-only" if we're updating only scrollbars. This 977 // Mouse events should be treated as "read-only" if we're updating only scrollbars. This
1007 // means that :hover and :active freeze in the state they were in, rathe r than updating 978 // means that :hover and :active freeze in the state they were in, rathe r than updating
1008 // for nodes the mouse moves while the window is not key (which will be the case if 979 // for nodes the mouse moves while the window is not key (which will be the case if
1009 // onlyUpdateScrollbars is true). 980 // onlyUpdateScrollbars is true).
1010 hitType |= HitTestRequest::ReadOnly; 981 hitType |= HitTestRequest::ReadOnly;
1011 } 982 }
1012 983
1013 // Treat any mouse move events as readonly if the user is currently touching the screen. 984 // Treat any mouse move events as readonly if the user is currently touching the screen.
1014 if (m_pointerEventManager.isAnyTouchActive()) 985 if (m_pointerEventManager->isAnyTouchActive())
1015 hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly; 986 hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly;
1016 HitTestRequest request(hitType); 987 HitTestRequest request(hitType);
1017 MouseEventWithHitTestResults mev = MouseEventWithHitTestResults(mouseEvent, HitTestResult(request, LayoutPoint())); 988 MouseEventWithHitTestResults mev = MouseEventWithHitTestResults(mouseEvent, HitTestResult(request, LayoutPoint()));
1018 989
1019 // We don't want to do a hit-test in forceLeave scenarios because there migh t actually be some other frame above this one at the specified co-ordinate. 990 // We don't want to do a hit-test in forceLeave scenarios because there migh t actually be some other frame above this one at the specified co-ordinate.
1020 // So we must force the hit-test to fail, while still clearing hover/active state. 991 // So we must force the hit-test to fail, while still clearing hover/active state.
1021 if (forceLeave) 992 if (forceLeave)
1022 m_frame->document()->updateHoverActiveState(request, 0); 993 m_frame->document()->updateHoverActiveState(request, 0);
1023 else 994 else
1024 mev = prepareMouseEvent(request, mouseEvent); 995 mev = prepareMouseEvent(request, mouseEvent);
1025 996
1026 if (hoveredNode) 997 if (hoveredNode)
1027 *hoveredNode = mev.hitTestResult(); 998 *hoveredNode = mev.hitTestResult();
1028 999
1029 Scrollbar* scrollbar = nullptr; 1000 Scrollbar* scrollbar = nullptr;
1030 1001
1031 if (m_scrollManager.inResizeMode()) { 1002 if (m_scrollManager->inResizeMode()) {
1032 m_scrollManager.resize(mev.event()); 1003 m_scrollManager->resize(mev.event());
1033 } else { 1004 } else {
1034 if (!scrollbar) 1005 if (!scrollbar)
1035 scrollbar = mev.scrollbar(); 1006 scrollbar = mev.scrollbar();
1036 1007
1037 updateLastScrollbarUnderMouse(scrollbar, !m_mousePressed); 1008 updateLastScrollbarUnderMouse(scrollbar, !m_mousePressed);
1038 if (onlyUpdateScrollbars) 1009 if (onlyUpdateScrollbars)
1039 return WebInputEventResult::HandledSuppressed; 1010 return WebInputEventResult::HandledSuppressed;
1040 } 1011 }
1041 1012
1042 WebInputEventResult eventResult = WebInputEventResult::NotHandled; 1013 WebInputEventResult eventResult = WebInputEventResult::NotHandled;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 m_clickNode->updateDistribution(); 1150 m_clickNode->updateDistribution();
1180 mev.innerNode()->updateDistribution(); 1151 mev.innerNode()->updateDistribution();
1181 clickTargetNode = mev.innerNode()->commonAncestor( 1152 clickTargetNode = mev.innerNode()->commonAncestor(
1182 *m_clickNode, parentForClickEvent); 1153 *m_clickNode, parentForClickEvent);
1183 } 1154 }
1184 if (clickTargetNode) { 1155 if (clickTargetNode) {
1185 // Dispatch mouseup directly w/o calling updateMouseEventTargetNodeA ndSendEvents 1156 // Dispatch mouseup directly w/o calling updateMouseEventTargetNodeA ndSendEvents
1186 // because the mouseup dispatch above has already updated it 1157 // because the mouseup dispatch above has already updated it
1187 // correctly. Moreover, clickTargetNode is different from 1158 // correctly. Moreover, clickTargetNode is different from
1188 // mev.innerNode at drag-release. 1159 // mev.innerNode at drag-release.
1189 clickEventResult = toWebInputEventResult(clickTargetNode->dispatchMo useEvent(mev.event(), 1160 clickEventResult = EventHandlingUtil::toWebInputEventResult(
1190 !RuntimeEnabledFeatures::auxclickEnabled() 1161 clickTargetNode->dispatchMouseEvent(mev.event(),
1191 || (mev.event().pointerProperties().button == WebPointerProperti es::Button::Left) 1162 !RuntimeEnabledFeatures::auxclickEnabled()
1192 ? EventTypeNames::click 1163 || (mev.event().pointerProperties().button == WebPointerProp erties::Button::Left)
1193 : EventTypeNames::auxclick, 1164 ? EventTypeNames::click
1194 m_clickCount)); 1165 : EventTypeNames::auxclick,
1166 m_clickCount));
1195 } 1167 }
1196 } 1168 }
1197 1169
1198 m_scrollManager.clearResizeScrollableArea(false); 1170 m_scrollManager->clearResizeScrollableArea(false);
1199 1171
1200 if (eventResult == WebInputEventResult::NotHandled) 1172 if (eventResult == WebInputEventResult::NotHandled)
1201 eventResult = handleMouseReleaseEvent(mev); 1173 eventResult = handleMouseReleaseEvent(mev);
1202 clearDragHeuristicState(); 1174 clearDragHeuristicState();
1203 1175
1204 invalidateClick(); 1176 invalidateClick();
1205 1177
1206 return mergeEventResult(clickEventResult, eventResult); 1178 return EventHandlingUtil::mergeEventResult(clickEventResult, eventResult);
1207 } 1179 }
1208 1180
1209 WebInputEventResult EventHandler::dispatchDragEvent(const AtomicString& eventTyp e, Node* dragTarget, const PlatformMouseEvent& event, DataTransfer* dataTransfer ) 1181 WebInputEventResult EventHandler::dispatchDragEvent(const AtomicString& eventTyp e, Node* dragTarget, const PlatformMouseEvent& event, DataTransfer* dataTransfer )
1210 { 1182 {
1211 FrameView* view = m_frame->view(); 1183 FrameView* view = m_frame->view();
1212 1184
1213 // FIXME: We might want to dispatch a dragleave even if the view is gone. 1185 // FIXME: We might want to dispatch a dragleave even if the view is gone.
1214 if (!view) 1186 if (!view)
1215 return WebInputEventResult::NotHandled; 1187 return WebInputEventResult::NotHandled;
1216 1188
1217 DragEvent* me = DragEvent::create(eventType, 1189 DragEvent* me = DragEvent::create(eventType,
1218 true, true, m_frame->document()->domWindow(), 1190 true, true, m_frame->document()->domWindow(),
1219 0, event.globalPosition().x(), event.globalPosition().y(), event.positio n().x(), event.position().y(), 1191 0, event.globalPosition().x(), event.globalPosition().y(), event.positio n().x(), event.position().y(),
1220 event.movementDelta().x(), event.movementDelta().y(), 1192 event.movementDelta().x(), event.movementDelta().y(),
1221 event.getModifiers(), 1193 event.getModifiers(),
1222 0, MouseEvent::platformModifiersToButtons(event.getModifiers()), nullptr , event.timestamp(), dataTransfer, event.getSyntheticEventType()); 1194 0, MouseEvent::platformModifiersToButtons(event.getModifiers()), nullptr , event.timestamp(), dataTransfer, event.getSyntheticEventType());
1223 1195
1224 return toWebInputEventResult(dragTarget->dispatchEvent(me)); 1196 return EventHandlingUtil::toWebInputEventResult(dragTarget->dispatchEvent(me ));
1225 } 1197 }
1226 1198
1227 static bool targetIsFrame(Node* target, LocalFrame*& frame) 1199 static bool targetIsFrame(Node* target, LocalFrame*& frame)
1228 { 1200 {
1229 if (!isHTMLFrameElementBase(target)) 1201 if (!isHTMLFrameElementBase(target))
1230 return false; 1202 return false;
1231 1203
1232 // Cross-process drag and drop is not yet supported. 1204 // Cross-process drag and drop is not yet supported.
1233 if (toHTMLFrameElementBase(target)->contentFrame() && !toHTMLFrameElementBas e(target)->contentFrame()->isLocalFrame()) 1205 if (toHTMLFrameElementBase(target)->contentFrame() && !toHTMLFrameElementBas e(target)->contentFrame()->isLocalFrame())
1234 return false; 1206 return false;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 return eventResult; 1256 return eventResult;
1285 1257
1286 HitTestRequest request(HitTestRequest::ReadOnly); 1258 HitTestRequest request(HitTestRequest::ReadOnly);
1287 MouseEventWithHitTestResults mev = prepareMouseEvent(request, event); 1259 MouseEventWithHitTestResults mev = prepareMouseEvent(request, event);
1288 1260
1289 // Drag events should never go to text nodes (following IE, and proper mouse over/out dispatch) 1261 // Drag events should never go to text nodes (following IE, and proper mouse over/out dispatch)
1290 Node* newTarget = mev.innerNode(); 1262 Node* newTarget = mev.innerNode();
1291 if (newTarget && newTarget->isTextNode()) 1263 if (newTarget && newTarget->isTextNode())
1292 newTarget = FlatTreeTraversal::parent(*newTarget); 1264 newTarget = FlatTreeTraversal::parent(*newTarget);
1293 1265
1294 if (AutoscrollController* controller = m_scrollManager.autoscrollController( )) 1266 if (AutoscrollController* controller = m_scrollManager->autoscrollController ())
1295 controller->updateDragAndDrop(newTarget, event.position(), event.timesta mp()); 1267 controller->updateDragAndDrop(newTarget, event.position(), event.timesta mp());
1296 1268
1297 if (m_dragTarget != newTarget) { 1269 if (m_dragTarget != newTarget) {
1298 // FIXME: this ordering was explicitly chosen to match WinIE. However, 1270 // FIXME: this ordering was explicitly chosen to match WinIE. However,
1299 // it is sometimes incorrect when dragging within subframes, as seen wit h 1271 // it is sometimes incorrect when dragging within subframes, as seen wit h
1300 // LayoutTests/fast/events/drag-in-frames.html. 1272 // LayoutTests/fast/events/drag-in-frames.html.
1301 // 1273 //
1302 // Moreover, this ordering conforms to section 7.9.4 of the HTML 5 spec. <http://dev.w3.org/html5/spec/Overview.html#drag-and-drop-processing-model>. 1274 // Moreover, this ordering conforms to section 7.9.4 of the HTML 5 spec. <http://dev.w3.org/html5/spec/Overview.html#drag-and-drop-processing-model>.
1303 LocalFrame* targetFrame; 1275 LocalFrame* targetFrame;
1304 if (targetIsFrame(newTarget, targetFrame)) { 1276 if (targetIsFrame(newTarget, targetFrame)) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 // Used to prevent mouseMoveEvent from initiating a drag before 1354 // Used to prevent mouseMoveEvent from initiating a drag before
1383 // the mouse is pressed again. 1355 // the mouse is pressed again.
1384 m_mousePressed = false; 1356 m_mousePressed = false;
1385 m_capturesDragging = false; 1357 m_capturesDragging = false;
1386 m_mouseDownMayStartDrag = false; 1358 m_mouseDownMayStartDrag = false;
1387 m_mouseDownMayStartAutoscroll = false; 1359 m_mouseDownMayStartAutoscroll = false;
1388 } 1360 }
1389 1361
1390 void EventHandler::clearDragState() 1362 void EventHandler::clearDragState()
1391 { 1363 {
1392 m_scrollManager.stopAutoscroll(); 1364 m_scrollManager->stopAutoscroll();
1393 m_dragTarget = nullptr; 1365 m_dragTarget = nullptr;
1394 m_capturingMouseEventsNode = nullptr; 1366 m_capturingMouseEventsNode = nullptr;
1395 m_shouldOnlyFireDragOverEvent = false; 1367 m_shouldOnlyFireDragOverEvent = false;
1396 } 1368 }
1397 1369
1398 void EventHandler::setCapturingMouseEventsNode(Node* n) 1370 void EventHandler::setCapturingMouseEventsNode(Node* n)
1399 { 1371 {
1400 m_capturingMouseEventsNode = n; 1372 m_capturingMouseEventsNode = n;
1401 m_eventHandlerWillResetCapturingMouseEventsNode = false; 1373 m_eventHandlerWillResetCapturingMouseEventsNode = false;
1402 } 1374 }
1403 1375
1404 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques t& request, const PlatformMouseEvent& mev) 1376 MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques t& request, const PlatformMouseEvent& mev)
1405 { 1377 {
1406 ASSERT(m_frame); 1378 ASSERT(m_frame);
1407 ASSERT(m_frame->document()); 1379 ASSERT(m_frame->document());
1408 1380
1409 return m_frame->document()->prepareMouseEvent(request, contentPointFromRootF rame(m_frame, mev.position()), mev); 1381 return m_frame->document()->prepareMouseEvent(request, contentPointFromRootF rame(m_frame, mev.position()), mev);
1410 } 1382 }
1411 1383
1412 Node* EventHandler::updateMouseEventTargetNode(Node* targetNode, 1384 Node* EventHandler::updateMouseEventTargetNode(Node* targetNode,
1413 const PlatformMouseEvent& mouseEvent) 1385 const PlatformMouseEvent& mouseEvent)
1414 { 1386 {
1415 Node* newNodeUnderMouse = targetNode; 1387 Node* newNodeUnderMouse = targetNode;
1416 1388
1417 // If we're capturing, we always go right to that node. 1389 // If we're capturing, we always go right to that node.
1418 if (EventTarget* mousePointerCapturingNode = m_pointerEventManager.getMouseC apturingNode()) { 1390 if (EventTarget* mousePointerCapturingNode = m_pointerEventManager->getMouse CapturingNode()) {
1419 newNodeUnderMouse = mousePointerCapturingNode->toNode(); 1391 newNodeUnderMouse = mousePointerCapturingNode->toNode();
1420 DCHECK(newNodeUnderMouse); 1392 DCHECK(newNodeUnderMouse);
1421 } else if (m_capturingMouseEventsNode) { 1393 } else if (m_capturingMouseEventsNode) {
1422 newNodeUnderMouse = m_capturingMouseEventsNode.get(); 1394 newNodeUnderMouse = m_capturingMouseEventsNode.get();
1423 } else { 1395 } else {
1424 // If the target node is a text node, dispatch on the parent node - rdar ://4196646 1396 // If the target node is a text node, dispatch on the parent node - rdar ://4196646
1425 if (newNodeUnderMouse && newNodeUnderMouse->isTextNode()) 1397 if (newNodeUnderMouse && newNodeUnderMouse->isTextNode())
1426 newNodeUnderMouse = FlatTreeTraversal::parent(*newNodeUnderMouse); 1398 newNodeUnderMouse = FlatTreeTraversal::parent(*newNodeUnderMouse);
1427 } 1399 }
1428 Node* lastNodeUnderMouse = m_nodeUnderMouse; 1400 Node* lastNodeUnderMouse = m_nodeUnderMouse;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 m_lastScrollbarUnderMouse = nullptr; 1433 m_lastScrollbarUnderMouse = nullptr;
1462 } 1434 }
1463 1435
1464 return lastNodeUnderMouse; 1436 return lastNodeUnderMouse;
1465 } 1437 }
1466 1438
1467 void EventHandler::updateMouseEventTargetNodeAndSendEvents(Node* targetNode, 1439 void EventHandler::updateMouseEventTargetNodeAndSendEvents(Node* targetNode,
1468 const PlatformMouseEvent& mouseEvent, bool isFrameBoundaryTransition) 1440 const PlatformMouseEvent& mouseEvent, bool isFrameBoundaryTransition)
1469 { 1441 {
1470 Node* lastNodeUnderMouse = updateMouseEventTargetNode(targetNode, mouseEvent ); 1442 Node* lastNodeUnderMouse = updateMouseEventTargetNode(targetNode, mouseEvent );
1471 m_pointerEventManager.sendMouseAndPossiblyPointerBoundaryEvents( 1443 m_pointerEventManager->sendMouseAndPossiblyPointerBoundaryEvents(
1472 lastNodeUnderMouse, m_nodeUnderMouse, mouseEvent, 1444 lastNodeUnderMouse, m_nodeUnderMouse, mouseEvent,
1473 isFrameBoundaryTransition); 1445 isFrameBoundaryTransition);
1474 } 1446 }
1475 1447
1476 WebInputEventResult EventHandler::dispatchMouseEvent(const AtomicString& eventTy pe, Node* targetNode, int clickCount, const PlatformMouseEvent& mouseEvent) 1448 WebInputEventResult EventHandler::dispatchMouseEvent(const AtomicString& eventTy pe, Node* targetNode, int clickCount, const PlatformMouseEvent& mouseEvent)
1477 { 1449 {
1478 updateMouseEventTargetNodeAndSendEvents(targetNode, mouseEvent); 1450 updateMouseEventTargetNodeAndSendEvents(targetNode, mouseEvent);
1479 if (!m_nodeUnderMouse)
1480 return WebInputEventResult::NotHandled;
1481 1451
1482 MouseEvent* event = MouseEvent::create(eventType, m_nodeUnderMouse->document ().domWindow(), mouseEvent, clickCount, nullptr); 1452 return m_mouseEventManager->dispatchMouseEvent(m_nodeUnderMouse, eventType,
1483 return toWebInputEventResult(m_nodeUnderMouse->dispatchEvent(event)); 1453 mouseEvent, nullptr, clickCount);
1484 } 1454 }
1485 1455
1486 bool EventHandler::isPointerEventActive(int pointerId) 1456 bool EventHandler::isPointerEventActive(int pointerId)
1487 { 1457 {
1488 return m_pointerEventManager.isActive(pointerId); 1458 return m_pointerEventManager->isActive(pointerId);
1489 } 1459 }
1490 1460
1491 void EventHandler::setPointerCapture(int pointerId, EventTarget* target) 1461 void EventHandler::setPointerCapture(int pointerId, EventTarget* target)
1492 { 1462 {
1493 // TODO(crbug.com/591387): This functionality should be per page not per fra me. 1463 // TODO(crbug.com/591387): This functionality should be per page not per fra me.
1494 m_pointerEventManager.setPointerCapture(pointerId, target); 1464 m_pointerEventManager->setPointerCapture(pointerId, target);
1495 } 1465 }
1496 1466
1497 void EventHandler::releasePointerCapture(int pointerId, EventTarget* target) 1467 void EventHandler::releasePointerCapture(int pointerId, EventTarget* target)
1498 { 1468 {
1499 m_pointerEventManager.releasePointerCapture(pointerId, target); 1469 m_pointerEventManager->releasePointerCapture(pointerId, target);
1500 } 1470 }
1501 1471
1502 bool EventHandler::hasPointerCapture(int pointerId, const EventTarget* target) c onst 1472 bool EventHandler::hasPointerCapture(int pointerId, const EventTarget* target) c onst
1503 { 1473 {
1504 return m_pointerEventManager.hasPointerCapture(pointerId, target); 1474 return m_pointerEventManager->hasPointerCapture(pointerId, target);
1505 } 1475 }
1506 1476
1507 bool EventHandler::hasProcessedPointerCapture(int pointerId, const EventTarget* target) const 1477 bool EventHandler::hasProcessedPointerCapture(int pointerId, const EventTarget* target) const
1508 { 1478 {
1509 return m_pointerEventManager.hasProcessedPointerCapture(pointerId, target); 1479 return m_pointerEventManager->hasProcessedPointerCapture(pointerId, target);
1510 } 1480 }
1511 1481
1512 void EventHandler::elementRemoved(EventTarget* target) 1482 void EventHandler::elementRemoved(EventTarget* target)
1513 { 1483 {
1514 m_pointerEventManager.elementRemoved(target); 1484 m_pointerEventManager->elementRemoved(target);
1515 } 1485 }
1516 1486
1517 // TODO(mustaq): Make PE drive ME dispatch & bookkeeping in EventHandler. 1487 // TODO(mustaq): Make PE drive ME dispatch & bookkeeping in EventHandler.
1518 WebInputEventResult EventHandler::updatePointerTargetAndDispatchEvents(const Ato micString& mouseEventType, Node* targetNode, int clickCount, const PlatformMouse Event& mouseEvent) 1488 WebInputEventResult EventHandler::updatePointerTargetAndDispatchEvents(const Ato micString& mouseEventType, Node* targetNode, int clickCount, const PlatformMouse Event& mouseEvent)
1519 { 1489 {
1520 ASSERT(mouseEventType == EventTypeNames::mousedown 1490 ASSERT(mouseEventType == EventTypeNames::mousedown
1521 || mouseEventType == EventTypeNames::mousemove 1491 || mouseEventType == EventTypeNames::mousemove
1522 || mouseEventType == EventTypeNames::mouseup); 1492 || mouseEventType == EventTypeNames::mouseup);
1523 1493
1524 Node* lastNodeUnderMouse = updateMouseEventTargetNode(targetNode, mouseEvent ); 1494 Node* lastNodeUnderMouse = updateMouseEventTargetNode(targetNode, mouseEvent );
1525 1495
1526 Node* newNodeUnderMouse = nullptr; 1496 Node* newNodeUnderMouse = nullptr;
1527 const auto& eventResult = m_pointerEventManager.sendMousePointerEvent( 1497 const auto& eventResult = m_pointerEventManager->sendMousePointerEvent(
1528 m_nodeUnderMouse, mouseEventType, clickCount, mouseEvent, 1498 m_nodeUnderMouse, mouseEventType, clickCount, mouseEvent,
1529 lastNodeUnderMouse, &newNodeUnderMouse); 1499 lastNodeUnderMouse, &newNodeUnderMouse);
1530 m_nodeUnderMouse = newNodeUnderMouse; 1500 m_nodeUnderMouse = newNodeUnderMouse;
1531 return eventResult; 1501 return eventResult;
1532 } 1502 }
1533 1503
1534 void EventHandler::setClickNode(Node* node) 1504 void EventHandler::setClickNode(Node* node)
1535 { 1505 {
1536 m_clickNode = node; 1506 m_clickNode = node;
1537 } 1507 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 node = FlatTreeTraversal::parent(*node); 1622 node = FlatTreeTraversal::parent(*node);
1653 1623
1654 // If we're over the frame scrollbar, scroll the document. 1624 // If we're over the frame scrollbar, scroll the document.
1655 if (!node && result.scrollbar()) 1625 if (!node && result.scrollbar())
1656 node = doc->documentElement(); 1626 node = doc->documentElement();
1657 1627
1658 LocalFrame* subframe = subframeForTargetNode(node); 1628 LocalFrame* subframe = subframeForTargetNode(node);
1659 if (subframe) { 1629 if (subframe) {
1660 WebInputEventResult result = subframe->eventHandler().handleWheelEvent(e vent); 1630 WebInputEventResult result = subframe->eventHandler().handleWheelEvent(e vent);
1661 if (result != WebInputEventResult::NotHandled) 1631 if (result != WebInputEventResult::NotHandled)
1662 m_scrollManager.setFrameWasScrolledByUser(); 1632 m_scrollManager->setFrameWasScrolledByUser();
1663 return result; 1633 return result;
1664 } 1634 }
1665 1635
1666 if (node) { 1636 if (node) {
1667 WheelEvent* domEvent = WheelEvent::create(event, node->document().domWin dow()); 1637 WheelEvent* domEvent = WheelEvent::create(event, node->document().domWin dow());
1668 DispatchEventResult domEventResult = node->dispatchEvent(domEvent); 1638 DispatchEventResult domEventResult = node->dispatchEvent(domEvent);
1669 if (domEventResult != DispatchEventResult::NotCanceled) 1639 if (domEventResult != DispatchEventResult::NotCanceled)
1670 return toWebInputEventResult(domEventResult); 1640 return EventHandlingUtil::toWebInputEventResult(domEventResult);
1671 } 1641 }
1672 1642
1673 return WebInputEventResult::NotHandled; 1643 return WebInputEventResult::NotHandled;
1674 } 1644 }
1675 1645
1676 WebInputEventResult EventHandler::handleGestureEvent(const PlatformGestureEvent& gestureEvent) 1646 WebInputEventResult EventHandler::handleGestureEvent(const PlatformGestureEvent& gestureEvent)
1677 { 1647 {
1678 // Propagation to inner frames is handled below this function. 1648 // Propagation to inner frames is handled below this function.
1679 ASSERT(m_frame == m_frame->localFrameRoot()); 1649 ASSERT(m_frame == m_frame->localFrameRoot());
1680 1650
(...skipping 22 matching lines...) Expand all
1703 1673
1704 // update mouseout/leave/over/enter events before jumping directly to the in ner most frame 1674 // update mouseout/leave/over/enter events before jumping directly to the in ner most frame
1705 if (targetedEvent.event().type() == PlatformEvent::GestureTap) 1675 if (targetedEvent.event().type() == PlatformEvent::GestureTap)
1706 updateGestureTargetNodeForMouseEvent(targetedEvent); 1676 updateGestureTargetNodeForMouseEvent(targetedEvent);
1707 1677
1708 // Route to the correct frame. 1678 // Route to the correct frame.
1709 if (LocalFrame* innerFrame = targetedEvent.hitTestResult().innerNodeFrame()) 1679 if (LocalFrame* innerFrame = targetedEvent.hitTestResult().innerNodeFrame())
1710 return innerFrame->eventHandler().handleGestureEventInFrame(targetedEven t); 1680 return innerFrame->eventHandler().handleGestureEventInFrame(targetedEven t);
1711 1681
1712 // No hit test result, handle in root instance. Perhaps we should just retur n false instead? 1682 // No hit test result, handle in root instance. Perhaps we should just retur n false instead?
1713 return m_gestureManager.handleGestureEventInFrame(targetedEvent); 1683 return m_gestureManager->handleGestureEventInFrame(targetedEvent);
1714 } 1684 }
1715 1685
1716 WebInputEventResult EventHandler::handleGestureEventInFrame(const GestureEventWi thHitTestResults& targetedEvent) 1686 WebInputEventResult EventHandler::handleGestureEventInFrame(const GestureEventWi thHitTestResults& targetedEvent)
1717 { 1687 {
1718 return m_gestureManager.handleGestureEventInFrame(targetedEvent); 1688 return m_gestureManager->handleGestureEventInFrame(targetedEvent);
1719 } 1689 }
1720 1690
1721 WebInputEventResult EventHandler::handleGestureScrollEvent(const PlatformGesture Event& gestureEvent) 1691 WebInputEventResult EventHandler::handleGestureScrollEvent(const PlatformGesture Event& gestureEvent)
1722 { 1692 {
1723 TRACE_EVENT0("input", "EventHandler::handleGestureScrollEvent"); 1693 TRACE_EVENT0("input", "EventHandler::handleGestureScrollEvent");
1724 1694
1725 return m_scrollManager.handleGestureScrollEvent(gestureEvent); 1695 return m_scrollManager->handleGestureScrollEvent(gestureEvent);
1726 } 1696 }
1727 1697
1728 WebInputEventResult EventHandler::handleGestureScrollEnd(const PlatformGestureEv ent& gestureEvent) 1698 WebInputEventResult EventHandler::handleGestureScrollEnd(const PlatformGestureEv ent& gestureEvent)
1729 { 1699 {
1730 return m_scrollManager.handleGestureScrollEnd(gestureEvent); 1700 return m_scrollManager->handleGestureScrollEnd(gestureEvent);
1731 } 1701 }
1732 1702
1733 bool EventHandler::isScrollbarHandlingGestures() const 1703 bool EventHandler::isScrollbarHandlingGestures() const
1734 { 1704 {
1735 return m_scrollManager.isScrollbarHandlingGestures(); 1705 return m_scrollManager->isScrollbarHandlingGestures();
1736 } 1706 }
1737 1707
1738 bool EventHandler::shouldApplyTouchAdjustment(const PlatformGestureEvent& event) const 1708 bool EventHandler::shouldApplyTouchAdjustment(const PlatformGestureEvent& event) const
1739 { 1709 {
1740 if (m_frame->settings() && !m_frame->settings()->touchAdjustmentEnabled()) 1710 if (m_frame->settings() && !m_frame->settings()->touchAdjustmentEnabled())
1741 return false; 1711 return false;
1742 return !event.area().isEmpty(); 1712 return !event.area().isEmpty();
1743 } 1713 }
1744 1714
1745 bool EventHandler::bestClickableNodeForHitTestResult(const HitTestResult& result , IntPoint& targetPoint, Node*& targetNode) 1715 bool EventHandler::bestClickableNodeForHitTestResult(const HitTestResult& result , IntPoint& targetPoint, Node*& targetNode)
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 } 1893 }
1924 1894
1925 GestureEventWithHitTestResults EventHandler::targetGestureEvent(const PlatformGe stureEvent& gestureEvent, bool readOnly) 1895 GestureEventWithHitTestResults EventHandler::targetGestureEvent(const PlatformGe stureEvent& gestureEvent, bool readOnly)
1926 { 1896 {
1927 TRACE_EVENT0("input", "EventHandler::targetGestureEvent"); 1897 TRACE_EVENT0("input", "EventHandler::targetGestureEvent");
1928 1898
1929 ASSERT(m_frame == m_frame->localFrameRoot()); 1899 ASSERT(m_frame == m_frame->localFrameRoot());
1930 // Scrolling events get hit tested per frame (like wheel events do). 1900 // Scrolling events get hit tested per frame (like wheel events do).
1931 ASSERT(!gestureEvent.isScrollEvent()); 1901 ASSERT(!gestureEvent.isScrollEvent());
1932 1902
1933 HitTestRequest::HitTestRequestType hitType = m_gestureManager.getHitTypeForG estureType(gestureEvent.type()); 1903 HitTestRequest::HitTestRequestType hitType = m_gestureManager->getHitTypeFor GestureType(gestureEvent.type());
1934 double activeInterval = 0; 1904 double activeInterval = 0;
1935 bool shouldKeepActiveForMinInterval = false; 1905 bool shouldKeepActiveForMinInterval = false;
1936 if (readOnly) { 1906 if (readOnly) {
1937 hitType |= HitTestRequest::ReadOnly; 1907 hitType |= HitTestRequest::ReadOnly;
1938 } else if (gestureEvent.type() == PlatformEvent::GestureTap) { 1908 } else if (gestureEvent.type() == PlatformEvent::GestureTap) {
1939 // If the Tap is received very shortly after ShowPress, we want to 1909 // If the Tap is received very shortly after ShowPress, we want to
1940 // delay clearing of the active state so that it's visible to the user 1910 // delay clearing of the active state so that it's visible to the user
1941 // for at least a couple of frames. 1911 // for at least a couple of frames.
1942 activeInterval = WTF::monotonicallyIncreasingTime() - m_gestureManager.g etLastShowPressTimestamp(); 1912 activeInterval = WTF::monotonicallyIncreasingTime() - m_gestureManager-> getLastShowPressTimestamp();
1943 shouldKeepActiveForMinInterval = m_gestureManager.getLastShowPressTimest amp() && activeInterval < minimumActiveInterval; 1913 shouldKeepActiveForMinInterval = m_gestureManager->getLastShowPressTimes tamp() && activeInterval < minimumActiveInterval;
1944 if (shouldKeepActiveForMinInterval) 1914 if (shouldKeepActiveForMinInterval)
1945 hitType |= HitTestRequest::ReadOnly; 1915 hitType |= HitTestRequest::ReadOnly;
1946 } 1916 }
1947 1917
1948 GestureEventWithHitTestResults eventWithHitTestResults = hitTestResultForGes tureEvent(gestureEvent, hitType); 1918 GestureEventWithHitTestResults eventWithHitTestResults = hitTestResultForGes tureEvent(gestureEvent, hitType);
1949 // Now apply hover/active state to the final target. 1919 // Now apply hover/active state to the final target.
1950 HitTestRequest request(hitType | HitTestRequest::AllowChildFrameContent); 1920 HitTestRequest request(hitType | HitTestRequest::AllowChildFrameContent);
1951 if (!request.readOnly()) 1921 if (!request.readOnly())
1952 updateGestureHoverActiveState(request, eventWithHitTestResults.hitTestRe sult().innerElement()); 1922 updateGestureHoverActiveState(request, eventWithHitTestResults.hitTestRe sult().innerElement());
1953 1923
(...skipping 27 matching lines...) Expand all
1981 applyTouchAdjustment(&adjustedEvent, &hitTestResult); 1951 applyTouchAdjustment(&adjustedEvent, &hitTestResult);
1982 1952
1983 // Do a new hit-test at the (adjusted) gesture co-ordinates. This is necessa ry because 1953 // Do a new hit-test at the (adjusted) gesture co-ordinates. This is necessa ry because
1984 // rect-based hit testing and touch adjustment sometimes return a different node than 1954 // rect-based hit testing and touch adjustment sometimes return a different node than
1985 // what a point-based hit test would return for the same point. 1955 // what a point-based hit test would return for the same point.
1986 // FIXME: Fix touch adjustment to avoid the need for a redundant hit test. h ttp://crbug.com/398914 1956 // FIXME: Fix touch adjustment to avoid the need for a redundant hit test. h ttp://crbug.com/398914
1987 if (shouldApplyTouchAdjustment(gestureEvent)) { 1957 if (shouldApplyTouchAdjustment(gestureEvent)) {
1988 LocalFrame* hitFrame = hitTestResult.innerNodeFrame(); 1958 LocalFrame* hitFrame = hitTestResult.innerNodeFrame();
1989 if (!hitFrame) 1959 if (!hitFrame)
1990 hitFrame = m_frame; 1960 hitFrame = m_frame;
1991 hitTestResult = hitTestResultInFrame(hitFrame, hitFrame->view()->rootFra meToContents(adjustedEvent.position()), (hitType | HitTestRequest::ReadOnly) & ~ HitTestRequest::ListBased); 1961 hitTestResult = EventHandlingUtil::hitTestResultInFrame(hitFrame, hitFra me->view()->rootFrameToContents(adjustedEvent.position()), (hitType | HitTestReq uest::ReadOnly) & ~HitTestRequest::ListBased);
1992 } 1962 }
1993 1963
1994 // If we did a rect-based hit test it must be resolved to the best single no de by now to 1964 // If we did a rect-based hit test it must be resolved to the best single no de by now to
1995 // ensure consumers don't accidentally use one of the other candidates. 1965 // ensure consumers don't accidentally use one of the other candidates.
1996 ASSERT(!hitTestResult.isRectBasedTest()); 1966 ASSERT(!hitTestResult.isRectBasedTest());
1997 1967
1998 return GestureEventWithHitTestResults(adjustedEvent, hitTestResult); 1968 return GestureEventWithHitTestResults(adjustedEvent, hitTestResult);
1999 } 1969 }
2000 1970
2001 void EventHandler::applyTouchAdjustment(PlatformGestureEvent* gestureEvent, HitT estResult* hitTestResult) 1971 void EventHandler::applyTouchAdjustment(PlatformGestureEvent* gestureEvent, HitT estResult* hitTestResult)
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 return m_frame->page()->isCursorVisible(); 2179 return m_frame->page()->isCursorVisible();
2210 } 2180 }
2211 2181
2212 void EventHandler::setResizingFrameSet(HTMLFrameSetElement* frameSet) 2182 void EventHandler::setResizingFrameSet(HTMLFrameSetElement* frameSet)
2213 { 2183 {
2214 m_frameSetBeingResized = frameSet; 2184 m_frameSetBeingResized = frameSet;
2215 } 2185 }
2216 2186
2217 void EventHandler::resizeScrollableAreaDestroyed() 2187 void EventHandler::resizeScrollableAreaDestroyed()
2218 { 2188 {
2219 m_scrollManager.clearResizeScrollableArea(true); 2189 m_scrollManager->clearResizeScrollableArea(true);
2220 } 2190 }
2221 2191
2222 void EventHandler::hoverTimerFired(TimerBase*) 2192 void EventHandler::hoverTimerFired(TimerBase*)
2223 { 2193 {
2224 TRACE_EVENT0("input", "EventHandler::hoverTimerFired"); 2194 TRACE_EVENT0("input", "EventHandler::hoverTimerFired");
2225 m_hoverTimer.stop(); 2195 m_hoverTimer.stop();
2226 2196
2227 ASSERT(m_frame); 2197 ASSERT(m_frame);
2228 ASSERT(m_frame->document()); 2198 ASSERT(m_frame->document());
2229 2199
(...skipping 26 matching lines...) Expand all
2256 void EventHandler::notifyElementActivated() 2226 void EventHandler::notifyElementActivated()
2257 { 2227 {
2258 // Since another element has been set to active, stop current timer and clea r reference. 2228 // Since another element has been set to active, stop current timer and clea r reference.
2259 if (m_activeIntervalTimer.isActive()) 2229 if (m_activeIntervalTimer.isActive())
2260 m_activeIntervalTimer.stop(); 2230 m_activeIntervalTimer.stop();
2261 m_lastDeferredTapElement = nullptr; 2231 m_lastDeferredTapElement = nullptr;
2262 } 2232 }
2263 2233
2264 bool EventHandler::handleAccessKey(const WebKeyboardEvent& evt) 2234 bool EventHandler::handleAccessKey(const WebKeyboardEvent& evt)
2265 { 2235 {
2266 return m_keyboardEventManager.handleAccessKey(evt); 2236 return m_keyboardEventManager->handleAccessKey(evt);
2267 } 2237 }
2268 2238
2269 WebInputEventResult EventHandler::keyEvent(const WebKeyboardEvent& initialKeyEve nt) 2239 WebInputEventResult EventHandler::keyEvent(const WebKeyboardEvent& initialKeyEve nt)
2270 { 2240 {
2271 return m_keyboardEventManager.keyEvent(initialKeyEvent); 2241 return m_keyboardEventManager->keyEvent(initialKeyEvent);
2272 } 2242 }
2273 2243
2274 void EventHandler::defaultKeyboardEventHandler(KeyboardEvent* event) 2244 void EventHandler::defaultKeyboardEventHandler(KeyboardEvent* event)
2275 { 2245 {
2276 m_keyboardEventManager.defaultKeyboardEventHandler(event, m_mousePressNode); 2246 m_keyboardEventManager->defaultKeyboardEventHandler(event, m_mousePressNode) ;
2277 } 2247 }
2278 2248
2279 bool EventHandler::dragHysteresisExceeded(const IntPoint& dragLocationInRootFram e) const 2249 bool EventHandler::dragHysteresisExceeded(const IntPoint& dragLocationInRootFram e) const
2280 { 2250 {
2281 FrameView* view = m_frame->view(); 2251 FrameView* view = m_frame->view();
2282 if (!view) 2252 if (!view)
2283 return false; 2253 return false;
2284 IntPoint dragLocation = view->rootFrameToContents(dragLocationInRootFrame); 2254 IntPoint dragLocation = view->rootFrameToContents(dragLocationInRootFrame);
2285 IntSize delta = dragLocation - m_mouseDownPos; 2255 IntSize delta = dragLocation - m_mouseDownPos;
2286 2256
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
2497 } 2467 }
2498 2468
2499 void EventHandler::defaultTextInputEventHandler(TextEvent* event) 2469 void EventHandler::defaultTextInputEventHandler(TextEvent* event)
2500 { 2470 {
2501 if (m_frame->editor().handleTextEvent(event)) 2471 if (m_frame->editor().handleTextEvent(event))
2502 event->setDefaultHandled(); 2472 event->setDefaultHandled();
2503 } 2473 }
2504 2474
2505 void EventHandler::capsLockStateMayHaveChanged() 2475 void EventHandler::capsLockStateMayHaveChanged()
2506 { 2476 {
2507 m_keyboardEventManager.capsLockStateMayHaveChanged(); 2477 m_keyboardEventManager->capsLockStateMayHaveChanged();
2508 } 2478 }
2509 2479
2510 bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults& mev) 2480 bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults& mev)
2511 { 2481 {
2512 Scrollbar* scrollbar = mev.scrollbar(); 2482 Scrollbar* scrollbar = mev.scrollbar();
2513 updateLastScrollbarUnderMouse(scrollbar, true); 2483 updateLastScrollbarUnderMouse(scrollbar, true);
2514 2484
2515 if (!scrollbar || !scrollbar->enabled()) 2485 if (!scrollbar || !scrollbar->enabled())
2516 return false; 2486 return false;
2517 m_scrollManager.setFrameWasScrolledByUser(); 2487 m_scrollManager->setFrameWasScrolledByUser();
2518 scrollbar->mouseDown(mev.event()); 2488 scrollbar->mouseDown(mev.event());
2519 return true; 2489 return true;
2520 } 2490 }
2521 2491
2522 // If scrollbar (under mouse) is different from last, send a mouse exited. Set 2492 // If scrollbar (under mouse) is different from last, send a mouse exited. Set
2523 // last to scrollbar if setLast is true; else set last to 0. 2493 // last to scrollbar if setLast is true; else set last to 0.
2524 void EventHandler::updateLastScrollbarUnderMouse(Scrollbar* scrollbar, bool setL ast) 2494 void EventHandler::updateLastScrollbarUnderMouse(Scrollbar* scrollbar, bool setL ast)
2525 { 2495 {
2526 if (m_lastScrollbarUnderMouse != scrollbar) { 2496 if (m_lastScrollbarUnderMouse != scrollbar) {
2527 // Send mouse exited to the old scrollbar. 2497 // Send mouse exited to the old scrollbar.
2528 if (m_lastScrollbarUnderMouse) 2498 if (m_lastScrollbarUnderMouse)
2529 m_lastScrollbarUnderMouse->mouseExited(); 2499 m_lastScrollbarUnderMouse->mouseExited();
2530 2500
2531 // Send mouse entered if we're setting a new scrollbar. 2501 // Send mouse entered if we're setting a new scrollbar.
2532 if (scrollbar && setLast) 2502 if (scrollbar && setLast)
2533 scrollbar->mouseEntered(); 2503 scrollbar->mouseEntered();
2534 2504
2535 m_lastScrollbarUnderMouse = setLast ? scrollbar : nullptr; 2505 m_lastScrollbarUnderMouse = setLast ? scrollbar : nullptr;
2536 } 2506 }
2537 } 2507 }
2538 2508
2539 HitTestResult EventHandler::hitTestResultInFrame(LocalFrame* frame, const Layout Point& point, HitTestRequest::HitTestRequestType hitType)
2540 {
2541 HitTestResult result(HitTestRequest(hitType), point);
2542
2543 if (!frame || frame->contentLayoutItem().isNull())
2544 return result;
2545 if (frame->view()) {
2546 IntRect rect = frame->view()->visibleContentRect(IncludeScrollbars);
2547 if (!rect.contains(roundedIntPoint(point)))
2548 return result;
2549 }
2550 frame->contentLayoutItem().hitTest(result);
2551 return result;
2552 }
2553
2554 WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve nt) 2509 WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve nt)
2555 { 2510 {
2556 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent"); 2511 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent");
2557 return m_pointerEventManager.handleTouchEvents(event); 2512 return m_pointerEventManager->handleTouchEvents(event);
2558 } 2513 }
2559 2514
2560 void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event) 2515 void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event)
2561 { 2516 {
2562 m_mousePositionIsUnknown = false; 2517 m_mousePositionIsUnknown = false;
2563 m_lastKnownMousePosition = event.position(); 2518 m_lastKnownMousePosition = event.position();
2564 m_lastKnownMouseGlobalPosition = event.globalPosition(); 2519 m_lastKnownMouseGlobalPosition = event.globalPosition();
2565 } 2520 }
2566 2521
2567 WebInputEventResult EventHandler::passMousePressEventToSubframe(MouseEventWithHi tTestResults& mev, LocalFrame* subframe) 2522 WebInputEventResult EventHandler::passMousePressEventToSubframe(MouseEventWithHi tTestResults& mev, LocalFrame* subframe)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2606 2561
2607 FrameHost* EventHandler::frameHost() const 2562 FrameHost* EventHandler::frameHost() const
2608 { 2563 {
2609 if (!m_frame->page()) 2564 if (!m_frame->page())
2610 return nullptr; 2565 return nullptr;
2611 2566
2612 return &m_frame->page()->frameHost(); 2567 return &m_frame->page()->frameHost();
2613 } 2568 }
2614 2569
2615 } // namespace blink 2570 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.h ('k') | third_party/WebKit/Source/core/input/EventHandlingUtil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698