WebCore/page/efl/EventHandlerEfl.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     1 /*
       
     2  * Copyright (C) 2006 Zack Rusin <zack@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 static bool isKeyboardOptionTab(KeyboardEvent* event)
       
    52 {
       
    53     return event
       
    54         && (event->type() == eventNames().keydownEvent || event->type() == eventNames().keypressEvent)
       
    55         && event->altKey()
       
    56         && event->keyIdentifier() == "U+0009";
       
    57 }
       
    58 
       
    59 bool EventHandler::invertSenseOfTabsToLinks(KeyboardEvent* event) const
       
    60 {
       
    61     return isKeyboardOptionTab(event);
       
    62 }
       
    63 
       
    64 bool EventHandler::tabsToAllControls(KeyboardEvent* event) const
       
    65 {
       
    66     return true;
       
    67 }
       
    68 
       
    69 void EventHandler::focusDocumentView()
       
    70 {
       
    71     if (Page* page = m_frame->page())
       
    72         page->focusController()->setFocusedFrame(m_frame);
       
    73 }
       
    74 
       
    75 bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
       
    76 {
       
    77     RenderObject* target = event.targetNode() ? event.targetNode()->renderer() : 0;
       
    78 
       
    79     if (!target || !target->isWidget())
       
    80         return false;
       
    81 
       
    82     return passMouseDownEventToWidget(static_cast<RenderWidget*>(target)->widget());
       
    83 }
       
    84 
       
    85 bool EventHandler::passWidgetMouseDownEventToWidget(RenderWidget* renderWidget)
       
    86 {
       
    87     return passMouseDownEventToWidget(renderWidget->widget());
       
    88 }
       
    89 
       
    90 bool EventHandler::passMouseDownEventToWidget(Widget* widget)
       
    91 {
       
    92     notImplemented();
       
    93     return false;
       
    94 }
       
    95 
       
    96 bool EventHandler::eventActivatedView(const PlatformMouseEvent&) const
       
    97 {
       
    98     notImplemented();
       
    99     return false;
       
   100 }
       
   101 
       
   102 bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& event, Widget* widget)
       
   103 {
       
   104     ASSERT(widget);
       
   105     if (!widget->isFrameView())
       
   106         return false;
       
   107 
       
   108     return static_cast<FrameView*>(widget)->frame()->eventHandler()->handleWheelEvent(event);
       
   109 }
       
   110 
       
   111 PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
       
   112 {
       
   113     return new ClipboardEfl(ClipboardWritable, true);
       
   114 }
       
   115 
       
   116 bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
       
   117 {
       
   118     subframe->eventHandler()->handleMousePressEvent(mev.event());
       
   119     return true;
       
   120 }
       
   121 
       
   122 bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe, HitTestResult* hoveredNode)
       
   123 {
       
   124     subframe->eventHandler()->handleMouseMoveEvent(mev.event(), hoveredNode);
       
   125     return true;
       
   126 }
       
   127 
       
   128 bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
       
   129 {
       
   130     subframe->eventHandler()->handleMouseReleaseEvent(mev.event());
       
   131     return true;
       
   132 }
       
   133 
       
   134 unsigned EventHandler::accessKeyModifiers()
       
   135 {
       
   136     return PlatformKeyboardEvent::AltKey;
       
   137 }
       
   138 }