webengine/osswebengine/WebCore/dom/Event.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /**
       
     2  * This file is part of the DOM implementation for KDE.
       
     3  *
       
     4  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
       
     5  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
       
     6  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
       
     7  * Copyright (C) 2003, 2005, 2006 Apple Computer, Inc.
       
     8  *
       
     9  * This library is free software; you can redistribute it and/or
       
    10  * modify it under the terms of the GNU Library General Public
       
    11  * License as published by the Free Software Foundation; either
       
    12  * version 2 of the License, or (at your option) any later version.
       
    13  *
       
    14  * This library is distributed in the hope that it will be useful,
       
    15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    17  * Library General Public License for more details.
       
    18  *
       
    19  * You should have received a copy of the GNU Library General Public License
       
    20  * along with this library; see the file COPYING.LIB.  If not, write to
       
    21  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
       
    22  * Boston, MA 02110-1301, USA.
       
    23  */
       
    24 #include "config.h"
       
    25 #include "Event.h"
       
    26 
       
    27 #include "AtomicString.h"
       
    28 #include "SystemTime.h"
       
    29 
       
    30 namespace WebCore {
       
    31 
       
    32 Event::Event()
       
    33     : m_canBubble(false)
       
    34     , m_cancelable(false)
       
    35     , m_propagationStopped(false)
       
    36     , m_defaultPrevented(false)
       
    37     , m_defaultHandled(false)
       
    38     , m_cancelBubble(false)
       
    39     , m_currentTarget(0)
       
    40     , m_eventPhase(0)
       
    41     , m_createTime(static_cast<DOMTimeStamp>(currentTime() * 1000.0))
       
    42 {
       
    43 }
       
    44 
       
    45 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg)
       
    46     : m_type(eventType)
       
    47     , m_canBubble(canBubbleArg)
       
    48     , m_cancelable(cancelableArg)
       
    49     , m_propagationStopped(false)
       
    50     , m_defaultPrevented(false)
       
    51     , m_defaultHandled(false)
       
    52     , m_cancelBubble(false)
       
    53     , m_currentTarget(0)
       
    54     , m_eventPhase(0)
       
    55     , m_createTime(static_cast<DOMTimeStamp>(currentTime() * 1000.0))
       
    56 {
       
    57 }
       
    58 
       
    59 Event::~Event()
       
    60 {
       
    61 }
       
    62 
       
    63 void Event::initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool cancelableArg)
       
    64 {
       
    65     if (dispatched())
       
    66         return;
       
    67 
       
    68     m_type = eventTypeArg;
       
    69     m_canBubble = canBubbleArg;
       
    70     m_cancelable = cancelableArg;
       
    71 }
       
    72 
       
    73 bool Event::isUIEvent() const
       
    74 {
       
    75     return false;
       
    76 }
       
    77 
       
    78 bool Event::isMouseEvent() const
       
    79 {
       
    80     return false;
       
    81 }
       
    82 
       
    83 bool Event::isMutationEvent() const
       
    84 {
       
    85     return false;
       
    86 }
       
    87 
       
    88 bool Event::isKeyboardEvent() const
       
    89 {
       
    90     return false;
       
    91 }
       
    92 
       
    93 bool Event::isTextEvent() const
       
    94 {
       
    95     return false;
       
    96 }
       
    97 
       
    98 bool Event::isDragEvent() const
       
    99 {
       
   100     return false;
       
   101 }
       
   102 
       
   103 bool Event::isClipboardEvent() const
       
   104 {
       
   105     return false;
       
   106 }
       
   107 
       
   108 bool Event::isWheelEvent() const
       
   109 {
       
   110     return false;
       
   111 }
       
   112 
       
   113 bool Event::isBeforeTextInsertedEvent() const
       
   114 {
       
   115     return false;
       
   116 }
       
   117 
       
   118 bool Event::isOverflowEvent() const
       
   119 {
       
   120     return false;
       
   121 }
       
   122 
       
   123 #if ENABLE(SVG)
       
   124 bool Event::isSVGZoomEvent() const
       
   125 {
       
   126     return false;
       
   127 }
       
   128 #endif
       
   129 
       
   130 
       
   131 bool Event::storesResultAsString() const
       
   132 {
       
   133     return false;
       
   134 }
       
   135 
       
   136 void Event::storeResult(const String&)
       
   137 {
       
   138 }
       
   139 
       
   140 void Event::setTarget(PassRefPtr<EventTarget> target)
       
   141 {
       
   142     m_target = target;
       
   143     if (m_target)
       
   144         receivedTarget();
       
   145 }
       
   146 
       
   147 void Event::receivedTarget()
       
   148 {
       
   149 }
       
   150 
       
   151 void Event::setUnderlyingEvent(PassRefPtr<Event> ue)
       
   152 {
       
   153     // Prohibit creation of a cycle -- just do nothing in that case.
       
   154     for (Event* e = ue.get(); e; e = e->underlyingEvent())
       
   155         if (e == this)
       
   156             return;
       
   157     m_underlyingEvent = ue;
       
   158 }
       
   159 
       
   160 } // namespace WebCore