Upstream version 11.40.277.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 }
39
40 UIEvent::UIEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, PassRefPtrWillBeRawPtr<AbstractView> viewArg, int detailArg)
41     : Event(eventType, canBubbleArg, cancelableArg)
42     , m_view(viewArg)
43     , m_detail(detailArg)
44 {
45 }
46
47 UIEvent::UIEvent(const AtomicString& eventType, const UIEventInit& initializer)
48     : Event(eventType, initializer)
49     , m_view(initializer.view)
50     , m_detail(initializer.detail)
51 {
52 }
53
54 UIEvent::~UIEvent()
55 {
56 }
57
58 void UIEvent::initUIEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, PassRefPtrWillBeRawPtr<AbstractView> viewArg, int detailArg)
59 {
60     if (dispatched())
61         return;
62
63     initEvent(typeArg, canBubbleArg, cancelableArg);
64
65     m_view = viewArg;
66     m_detail = detailArg;
67 }
68
69 bool UIEvent::isUIEvent() const
70 {
71     return true;
72 }
73
74 const AtomicString& UIEvent::interfaceName() const
75 {
76     return EventNames::UIEvent;
77 }
78
79 int UIEvent::keyCode() const
80 {
81     return 0;
82 }
83
84 int UIEvent::charCode() const
85 {
86     return 0;
87 }
88
89 int UIEvent::layerX()
90 {
91     return 0;
92 }
93
94 int UIEvent::layerY()
95 {
96     return 0;
97 }
98
99 int UIEvent::pageX() const
100 {
101     return 0;
102 }
103
104 int UIEvent::pageY() const
105 {
106     return 0;
107 }
108
109 int UIEvent::which() const
110 {
111     return 0;
112 }
113
114 void UIEvent::trace(Visitor* visitor)
115 {
116     visitor->trace(m_view);
117     Event::trace(visitor);
118 }
119
120 } // namespace blink