• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2001 Peter Kelly (pmk@post.com)
3  * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
4  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5  * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #include "config.h"
24 #include "Event.h"
25 
26 #include "AtomicString.h"
27 #include <wtf/CurrentTime.h>
28 
29 namespace WebCore {
30 
Event()31 Event::Event()
32     : m_canBubble(false)
33     , m_cancelable(false)
34     , m_propagationStopped(false)
35     , m_defaultPrevented(false)
36     , m_defaultHandled(false)
37     , m_cancelBubble(false)
38     , m_currentTarget(0)
39     , m_eventPhase(0)
40     , m_createTime(static_cast<DOMTimeStamp>(currentTime() * 1000.0))
41 {
42 }
43 
Event(const AtomicString & eventType,bool canBubbleArg,bool cancelableArg)44 Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg)
45     : m_type(eventType)
46     , m_canBubble(canBubbleArg)
47     , m_cancelable(cancelableArg)
48     , m_propagationStopped(false)
49     , m_defaultPrevented(false)
50     , m_defaultHandled(false)
51     , m_cancelBubble(false)
52     , m_currentTarget(0)
53     , m_eventPhase(0)
54     , m_createTime(static_cast<DOMTimeStamp>(currentTime() * 1000.0))
55 {
56 }
57 
~Event()58 Event::~Event()
59 {
60 }
61 
initEvent(const AtomicString & eventTypeArg,bool canBubbleArg,bool cancelableArg)62 void Event::initEvent(const AtomicString& eventTypeArg, bool canBubbleArg, bool cancelableArg)
63 {
64     if (dispatched())
65         return;
66 
67     m_type = eventTypeArg;
68     m_canBubble = canBubbleArg;
69     m_cancelable = cancelableArg;
70 }
71 
isUIEvent() const72 bool Event::isUIEvent() const
73 {
74     return false;
75 }
76 
isMouseEvent() const77 bool Event::isMouseEvent() const
78 {
79     return false;
80 }
81 
isMutationEvent() const82 bool Event::isMutationEvent() const
83 {
84     return false;
85 }
86 
isKeyboardEvent() const87 bool Event::isKeyboardEvent() const
88 {
89     return false;
90 }
91 
isTextEvent() const92 bool Event::isTextEvent() const
93 {
94     return false;
95 }
96 
isDragEvent() const97 bool Event::isDragEvent() const
98 {
99     return false;
100 }
101 
isClipboardEvent() const102 bool Event::isClipboardEvent() const
103 {
104     return false;
105 }
106 
isWheelEvent() const107 bool Event::isWheelEvent() const
108 {
109     return false;
110 }
111 
isMessageEvent() const112 bool Event::isMessageEvent() const
113 {
114     return false;
115 }
116 
isBeforeTextInsertedEvent() const117 bool Event::isBeforeTextInsertedEvent() const
118 {
119     return false;
120 }
121 
isOverflowEvent() const122 bool Event::isOverflowEvent() const
123 {
124     return false;
125 }
126 
isProgressEvent() const127 bool Event::isProgressEvent() const
128 {
129     return false;
130 }
131 
isWebKitAnimationEvent() const132 bool Event::isWebKitAnimationEvent() const
133 {
134     return false;
135 }
136 
isWebKitTransitionEvent() const137 bool Event::isWebKitTransitionEvent() const
138 {
139     return false;
140 }
141 
isXMLHttpRequestProgressEvent() const142 bool Event::isXMLHttpRequestProgressEvent() const
143 {
144     return false;
145 }
146 
147 #if ENABLE(SVG)
isSVGZoomEvent() const148 bool Event::isSVGZoomEvent() const
149 {
150     return false;
151 }
152 #endif
153 
154 #if ENABLE(DOM_STORAGE)
isStorageEvent() const155 bool Event::isStorageEvent() const
156 {
157     return false;
158 }
159 #endif
160 
161 #if ENABLE(TOUCH_EVENTS) // Android
isTouchEvent() const162 bool Event::isTouchEvent() const
163 {
164     return false;
165 }
166 #endif
167 
storesResultAsString() const168 bool Event::storesResultAsString() const
169 {
170     return false;
171 }
172 
storeResult(const String &)173 void Event::storeResult(const String&)
174 {
175 }
176 
setTarget(PassRefPtr<EventTarget> target)177 void Event::setTarget(PassRefPtr<EventTarget> target)
178 {
179     m_target = target;
180     if (m_target)
181         receivedTarget();
182 }
183 
receivedTarget()184 void Event::receivedTarget()
185 {
186 }
187 
setUnderlyingEvent(PassRefPtr<Event> ue)188 void Event::setUnderlyingEvent(PassRefPtr<Event> ue)
189 {
190     // Prohibit creation of a cycle -- just do nothing in that case.
191     for (Event* e = ue.get(); e; e = e->underlyingEvent())
192         if (e == this)
193             return;
194     m_underlyingEvent = ue;
195 }
196 
197 } // namespace WebCore
198