Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: Source/core/events/UIEvent.h

Issue 1160753005: Implement UIEvent.sourceDevice (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Change unittest Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
11 * 11 *
12 * This library is distributed in the hope that it will be useful, 12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details. 15 * Library General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Library General Public License 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 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, 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA. 20 * Boston, MA 02110-1301, USA.
21 * 21 *
22 */ 22 */
23 23
24 #ifndef UIEvent_h 24 #ifndef UIEvent_h
25 #define UIEvent_h 25 #define UIEvent_h
26 26
27 #include "core/CoreExport.h" 27 #include "core/CoreExport.h"
28 #include "core/events/Event.h" 28 #include "core/events/Event.h"
29 #include "core/events/EventDispatchMediator.h" 29 #include "core/events/EventDispatchMediator.h"
30 #include "core/events/InputDevice.h"
30 #include "core/events/UIEventInit.h" 31 #include "core/events/UIEventInit.h"
31 #include "core/frame/DOMWindow.h" 32 #include "core/frame/DOMWindow.h"
32 33
34 #include <stdlib.h>
tdresser 2015/06/01 17:36:46 What's stdlib being used for?
lanwei 2015/06/02 14:08:30 Done.
35
33 namespace blink { 36 namespace blink {
34 37
35 // FIXME: Get rid of this typedef. 38 // FIXME: Get rid of this typedef.
36 typedef DOMWindow AbstractView; 39 typedef DOMWindow AbstractView;
37 40
38 class CORE_EXPORT UIEvent : public Event { 41 class CORE_EXPORT UIEvent : public Event {
39 DEFINE_WRAPPERTYPEINFO(); 42 DEFINE_WRAPPERTYPEINFO();
40 public: 43 public:
41 static PassRefPtrWillBeRawPtr<UIEvent> create() 44 static PassRefPtrWillBeRawPtr<UIEvent> create()
42 { 45 {
43 return adoptRefWillBeNoop(new UIEvent); 46 return adoptRefWillBeNoop(new UIEvent);
44 } 47 }
45 static PassRefPtrWillBeRawPtr<UIEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view, int deta il) 48 static PassRefPtrWillBeRawPtr<UIEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> view, int deta il)
46 { 49 {
47 return adoptRefWillBeNoop(new UIEvent(type, canBubble, cancelable, view, detail)); 50 return adoptRefWillBeNoop(new UIEvent(type, canBubble, cancelable, view, detail));
48 } 51 }
49 static PassRefPtrWillBeRawPtr<UIEvent> create(const AtomicString& type, cons t UIEventInit& initializer) 52 static PassRefPtrWillBeRawPtr<UIEvent> create(const AtomicString& type, cons t UIEventInit& initializer)
50 { 53 {
51 return adoptRefWillBeNoop(new UIEvent(type, initializer)); 54 return adoptRefWillBeNoop(new UIEvent(type, initializer));
52 } 55 }
53 virtual ~UIEvent(); 56 virtual ~UIEvent();
54 57
55 void initUIEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, int detail); 58 void initUIEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView>, int detail);
56 59
57 AbstractView* view() const { return m_view.get(); } 60 AbstractView* view() const { return m_view.get(); }
58 int detail() const { return m_detail; } 61 int detail() const { return m_detail; }
62 InputDevice* sourceDevice() const
63 {
64 return m_sourceDevice ? m_sourceDevice.get() : InputDevice::create().get ();
65 }
59 66
60 virtual const AtomicString& interfaceName() const override; 67 virtual const AtomicString& interfaceName() const override;
61 virtual bool isUIEvent() const override final; 68 virtual bool isUIEvent() const override final;
62 69
63 virtual int keyCode() const; 70 virtual int keyCode() const;
64 virtual int charCode() const; 71 virtual int charCode() const;
65 72
66 virtual int layerX(); 73 virtual int layerX();
67 virtual int layerY(); 74 virtual int layerY();
68 75
69 virtual int pageX() const; 76 virtual int pageX() const;
70 virtual int pageY() const; 77 virtual int pageY() const;
71 78
72 virtual int which() const; 79 virtual int which() const;
73 80
74 DECLARE_VIRTUAL_TRACE(); 81 DECLARE_VIRTUAL_TRACE();
75 82
76 protected: 83 protected:
77 UIEvent(); 84 UIEvent();
78 UIEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPt rWillBeRawPtr<AbstractView>, int detail); 85 UIEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPt rWillBeRawPtr<AbstractView>, int detail);
79 UIEvent(const AtomicString&, const UIEventInit&); 86 UIEvent(const AtomicString&, const UIEventInit&);
80 87
81 private: 88 private:
82 RefPtrWillBeMember<AbstractView> m_view; 89 RefPtrWillBeMember<AbstractView> m_view;
83 int m_detail; 90 int m_detail;
91 RefPtrWillBeMember<InputDevice> m_sourceDevice;
84 }; 92 };
85 93
86 } // namespace blink 94 } // namespace blink
87 95
88 #endif // UIEvent_h 96 #endif // UIEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698