1 /* 2 * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. 3 */ 4 #include "config.h" 5 6 #include "NotImplemented.h" 7 8 #include "EventHandler.h" 9 #include "FocusController.h" 10 #include "Frame.h" 11 #include "FrameView.h" 12 #include "MouseEventWithHitTestResults.h" 13 #include "Page.h" 14 #include "PlatformKeyboardEvent.h" 15 #include "Widget.h" 16 #include "DataTransfer.h" 17 18 namespace WebCore { 19 20 #if ENABLE(DRAG_SUPPORT) 21 const Seconds EventHandler::TextDragDelay { 0_s }; 22 #endif 23 24 OptionSet<PlatformEvent::Modifier> EventHandler::accessKeyModifiers() 25 { 26 return PlatformEvent::Modifier::AltKey; 27 } 28 29 void EventHandler::focusDocumentView() 30 { 31 Page* page = m_frame.page(); 32 if (page) { 33 page->focusController().setFocusedFrame(&m_frame); 34 } 35 } 36 37 bool EventHandler::eventActivatedView(const PlatformMouseEvent &) const 38 { 39 // Implementation below is probably incorrect/incomplete, 40 // so leaving 'notImplemented()' here. 41 notImplemented(); 42 43 // Return false here as activation is handled separately from 44 // mouse events 45 return false; 46 } 47 48 bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& event, Frame* subFrame) 49 { 50 subFrame->eventHandler().handleMousePressEvent(event.event()); 51 return true; 52 } 53 54 bool EventHandler::widgetDidHandleWheelEvent(const PlatformWheelEvent& wheelEvent, Widget& widget) 55 { 56 if (!is<FrameView>(widget)) 57 return false; 58 59 return downcast<FrameView>(widget).frame().eventHandler().handleWheelEvent(wheelEvent); 60 } 61 62 bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& event, Frame* subFrame, HitTestResult* hoveredNode) 63 { 64 if (m_mouseDownMayStartDrag && !m_mouseDownWasInSubframe) 65 return false; 66 subFrame->eventHandler().handleMouseMoveEvent(event.event(), hoveredNode); 67 return true; 68 } 69 70 bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& event, Frame* subFrame) 71 { 72 subFrame->eventHandler().handleMouseReleaseEvent(event.event()); 73 return true; 74 } 75 76 bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults&) 77 { 78 notImplemented(); 79 return false; 80 } 81 82 bool EventHandler::tabsToAllFormControls(KeyboardEvent&) const 83 { 84 return true; 85 } 86 87 } // namespace WebCore