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

Side by Side Diff: third_party/WebKit/Source/core/events/KeyboardEvent.h

Issue 2290313002: Remove PlatformKeyboardEvent (Closed)
Patch Set: One more fix Created 4 years, 3 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, 2007, 2008 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
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 KeyboardEvent_h 24 #ifndef KeyboardEvent_h
25 #define KeyboardEvent_h 25 #define KeyboardEvent_h
26 26
27 #include "core/CoreExport.h" 27 #include "core/CoreExport.h"
28 #include "core/events/KeyboardEventInit.h" 28 #include "core/events/KeyboardEventInit.h"
29 #include "core/events/UIEventWithKeyState.h" 29 #include "core/events/UIEventWithKeyState.h"
30 #include "public/platform/WebInputEvent.h"
30 #include <memory> 31 #include <memory>
31 32
32 namespace blink { 33 namespace blink {
33 34
34 class EventDispatcher; 35 class EventDispatcher;
35 class PlatformKeyboardEvent;
36 36
37 class CORE_EXPORT KeyboardEvent final : public UIEventWithKeyState { 37 class CORE_EXPORT KeyboardEvent final : public UIEventWithKeyState {
38 DEFINE_WRAPPERTYPEINFO(); 38 DEFINE_WRAPPERTYPEINFO();
39 public: 39 public:
40 enum KeyLocationCode { 40 enum KeyLocationCode {
41 kDomKeyLocationStandard = 0x00, 41 kDomKeyLocationStandard = 0x00,
42 kDomKeyLocationLeft = 0x01, 42 kDomKeyLocationLeft = 0x01,
43 kDomKeyLocationRight = 0x02, 43 kDomKeyLocationRight = 0x02,
44 kDomKeyLocationNumpad = 0x03 44 kDomKeyLocationNumpad = 0x03
45 }; 45 };
46 46
47 static KeyboardEvent* create() 47 static KeyboardEvent* create()
48 { 48 {
49 return new KeyboardEvent; 49 return new KeyboardEvent;
50 } 50 }
51 51
52 static KeyboardEvent* create(const PlatformKeyboardEvent& platformEvent, Abs tractView* view) 52 static KeyboardEvent* create(const WebKeyboardEvent& webEvent, AbstractView* view)
53 { 53 {
54 return new KeyboardEvent(platformEvent, view); 54 return new KeyboardEvent(webEvent, view);
55 } 55 }
56 56
57 static KeyboardEvent* create(ScriptState*, const AtomicString& type, const K eyboardEventInit&); 57 static KeyboardEvent* create(ScriptState*, const AtomicString& type, const K eyboardEventInit&);
58 58
59 static KeyboardEvent* create(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, const String& code, const String& key, unsigned location, 59 static KeyboardEvent* create(const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view, const String& code, const String& key, unsigned location,
60 PlatformEvent::Modifiers modifiers, double platformTimeStamp) 60 PlatformEvent::Modifiers modifiers, double platformTimeStamp)
61 { 61 {
62 return new KeyboardEvent(type, canBubble, cancelable, view, code, key, l ocation, 62 return new KeyboardEvent(type, canBubble, cancelable, view, code, key, l ocation,
63 modifiers, platformTimeStamp); 63 modifiers, platformTimeStamp);
64 } 64 }
65 65
66 ~KeyboardEvent() override; 66 ~KeyboardEvent() override;
67 67
68 void initKeyboardEvent(ScriptState*, const AtomicString& type, bool canBubbl e, bool cancelable, AbstractView*, 68 void initKeyboardEvent(ScriptState*, const AtomicString& type, bool canBubbl e, bool cancelable, AbstractView*,
69 const String& keyIdentifier, unsigned location, 69 const String& keyIdentifier, unsigned location,
70 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); 70 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
71 71
72 const String& code() const { return m_code; } 72 const String& code() const { return m_code; }
73 const String& key() const { return m_key; } 73 const String& key() const { return m_key; }
74 74
75 unsigned location() const { return m_location; } 75 unsigned location() const { return m_location; }
76 76
77 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } 77 const WebKeyboardEvent* keyEvent() const { return m_keyEvent.get(); }
78 78
79 int keyCode() const; // key code for keydown and keyup, character for keypre ss 79 int keyCode() const; // key code for keydown and keyup, character for keypre ss
80 int charCode() const; // character code for keypress, 0 for keydown and keyu p 80 int charCode() const; // character code for keypress, 0 for keydown and keyu p
81 bool repeat() const { return modifiers() & PlatformEvent::IsAutoRepeat; } 81 bool repeat() const { return modifiers() & PlatformEvent::IsAutoRepeat; }
82 82
83 const AtomicString& interfaceName() const override; 83 const AtomicString& interfaceName() const override;
84 bool isKeyboardEvent() const override; 84 bool isKeyboardEvent() const override;
85 int which() const override; 85 int which() const override;
86 86
87 DECLARE_VIRTUAL_TRACE(); 87 DECLARE_VIRTUAL_TRACE();
88 88
89 private: 89 private:
90 KeyboardEvent(); 90 KeyboardEvent();
91 KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*); 91 KeyboardEvent(const WebKeyboardEvent&, AbstractView*);
92 KeyboardEvent(const AtomicString&, const KeyboardEventInit&); 92 KeyboardEvent(const AtomicString&, const KeyboardEventInit&);
93 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs tractView*, 93 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs tractView*,
94 const String& code, const String& key, unsigned location, 94 const String& code, const String& key, unsigned location,
95 PlatformEvent::Modifiers, double platformTimeStamp); 95 PlatformEvent::Modifiers, double platformTimeStamp);
96 96
97 void initLocationModifiers(unsigned location); 97 void initLocationModifiers(unsigned location);
98 98
99 std::unique_ptr<PlatformKeyboardEvent> m_keyEvent; 99 std::unique_ptr<WebKeyboardEvent> m_keyEvent;
100 String m_code; 100 String m_code;
101 String m_key; 101 String m_key;
102 unsigned m_location; 102 unsigned m_location;
103 }; 103 };
104 104
105 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent); 105 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent);
106 106
107 } // namespace blink 107 } // namespace blink
108 108
109 #endif // KeyboardEvent_h 109 #endif // KeyboardEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698