Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / events / UIEvent.cpp
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 "core/events/UIEvent.h"
25
26
27 namespace blink {
28
29 UIEventInit::UIEventInit()
30     : view(nullptr)
31     , detail(0)
32 {
33 }
34
35 UIEvent::UIEvent()
36     : m_detail(0)
37 {
38     ScriptWrappable::init(this);
39 }
40
41 UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, PassRefPtrWillBeRawPtr<AbstractView> viewArg, int detailArg)
42     : Event(eventType, canBubbleArg, cancelableArg)
43     , m_view(viewArg)
44     , m_detail(detailArg)
45 {
46     ScriptWrappable::init(this);
47 }
48
49 UIEvent::UIEvent(const AtomicString& eventType, const UIEventInit& initializer)
50     : Event(eventType, initializer)
51     , m_view(initializer.view)
52     , m_detail(initializer.detail)
53 {
54     ScriptWrappable::init(this);
55 }
56
57 UIEvent::~UIEvent()
58 {
59 }
60
61 void UIEvent::initUIEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, PassRefPtrWillBeRawPtr<AbstractView> viewArg, int detailArg)
62 {
63     if (dispatched())
64         return;
65
66     initEvent(typeArg, canBubbleArg, cancelableArg);
67
68     m_view = viewArg;
69     m_detail = detailArg;
70 }
71
72 bool UIEvent::isUIEvent() const
73 {
74     return true;
75 }
76
77 const AtomicString& UIEvent::interfaceName() const
78 {
79     return EventNames::UIEvent;
80 }
81
82 int UIEvent::keyCode() const
83 {
84     return 0;
85 }
86
87 int UIEvent::charCode() const
88 {
89     return 0;
90 }
91
92 int UIEvent::layerX()
93 {
94     return 0;
95 }
96
97 int UIEvent::layerY()
98 {
99     return 0;
100 }
101
102 int UIEvent::pageX() const
103 {
104     return 0;
105 }
106
107 int UIEvent::pageY() const
108 {
109     return 0;
110 }
111
112 int UIEvent::which() const
113 {
114     return 0;
115 }
116
117 void UIEvent::trace(Visitor* visitor)
118 {
119     visitor->trace(m_view);
120     Event::trace(visitor);
121 }
122
123 } // namespace blink