1 /* 2 * Copyright (C) 2006 Zack Rusin <zack (at) kde.org> 3 * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia 4 * Copyright (C) 2009,2010 ProFUSION embedded systems 5 * Copyright (C) 2009,2010 Samsung Electronics 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #include "config.h" 30 #include "EventHandler.h" 31 32 #include "ClipboardEfl.h" 33 #include "EventNames.h" 34 #include "FloatPoint.h" 35 #include "FocusController.h" 36 #include "Frame.h" 37 #include "FrameView.h" 38 #include "KeyboardEvent.h" 39 #include "MouseEventWithHitTestResults.h" 40 #include "NotImplemented.h" 41 #include "Page.h" 42 #include "PlatformKeyboardEvent.h" 43 #include "PlatformWheelEvent.h" 44 #include "RenderWidget.h" 45 #include "Scrollbar.h" 46 47 namespace WebCore { 48 49 const double EventHandler::TextDragDelay = 0.0; 50 51 bool EventHandler::tabsToAllFormControls(KeyboardEvent* event) const 52 { 53 return true; 54 } 55 56 void EventHandler::focusDocumentView() 57 { 58 if (Page* page = m_frame->page()) 59 page->focusController()->setFocusedFrame(m_frame); 60 } 61 62 bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event) 63 { 64 RenderObject* target = targetNode(event) ? targetNode(event)->renderer() : 0; 65 66 if (!target || !target->isWidget()) 67 return false; 68 69 return passMouseDownEventToWidget(static_cast<RenderWidget*>(target)->widget()); 70 } 71 72 bool EventHandler::passWidgetMouseDownEventToWidget(RenderWidget* renderWidget) 73 { 74 return passMouseDownEventToWidget(renderWidget->widget()); 75 } 76 77 bool EventHandler::passMouseDownEventToWidget(Widget* widget) 78 { 79 notImplemented(); 80 return false; 81 } 82 83 bool EventHandler::eventActivatedView(const PlatformMouseEvent&) const 84 { 85 notImplemented(); 86 return false; 87 } 88 89 bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& event, Widget* widget) 90 { 91 ASSERT(widget); 92 if (!widget->isFrameView()) 93 return false; 94 95 return static_cast<FrameView*>(widget)->frame()->eventHandler()->handleWheelEvent(event); 96 } 97 98 PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const 99 { 100 return ClipboardEfl::create(ClipboardWritable, Clipboard::DragAndDrop); 101 } 102 103 bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) 104 { 105 subframe->eventHandler()->handleMousePressEvent(mev.event()); 106 return true; 107 } 108 109 bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe, HitTestResult* hoveredNode) 110 { 111 subframe->eventHandler()->handleMouseMoveEvent(mev.event(), hoveredNode); 112 return true; 113 } 114 115 bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) 116 { 117 subframe->eventHandler()->handleMouseReleaseEvent(mev.event()); 118 return true; 119 } 120 121 unsigned EventHandler::accessKeyModifiers() 122 { 123 return PlatformKeyboardEvent::AltKey; 124 } 125 } 126