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

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

Issue 663523002: Adding support for DOM3 KeyboardEvents Code in KeyboardEvents (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated unittest to use different urls and destructor to register same url again Created 5 years, 11 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.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 { 63 {
64 return adoptRefWillBeNoop(new KeyboardEvent(platformEvent, view)); 64 return adoptRefWillBeNoop(new KeyboardEvent(platformEvent, view));
65 } 65 }
66 66
67 static PassRefPtrWillBeRawPtr<KeyboardEvent> create(const AtomicString& type , const KeyboardEventInit& initializer) 67 static PassRefPtrWillBeRawPtr<KeyboardEvent> create(const AtomicString& type , const KeyboardEventInit& initializer)
68 { 68 {
69 return adoptRefWillBeNoop(new KeyboardEvent(type, initializer)); 69 return adoptRefWillBeNoop(new KeyboardEvent(type, initializer));
70 } 70 }
71 71
72 static PassRefPtrWillBeRawPtr<KeyboardEvent> create(const AtomicString& type , bool canBubble, bool cancelable, AbstractView* view, 72 static PassRefPtrWillBeRawPtr<KeyboardEvent> create(const AtomicString& type , bool canBubble, bool cancelable, AbstractView* view,
73 const String& keyIdentifier, unsigned location, 73 const String& keyIdentifier, const String& code, unsigned location,
74 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) 74 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
75 { 75 {
76 return adoptRefWillBeNoop(new KeyboardEvent(type, canBubble, cancelable, view, keyIdentifier, location, 76 return adoptRefWillBeNoop(new KeyboardEvent(type, canBubble, cancelable, view, keyIdentifier, code, location,
77 ctrlKey, altKey, shiftKey, metaKey)); 77 ctrlKey, altKey, shiftKey, metaKey));
78 } 78 }
79 79
80 virtual ~KeyboardEvent(); 80 virtual ~KeyboardEvent();
81 81
82 void initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancel able, AbstractView*, 82 void initKeyboardEvent(const AtomicString& type, bool canBubble, bool cancel able, AbstractView*,
83 const String& keyIdentifier, unsigned location, 83 const String& keyIdentifier, unsigned location,
84 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); 84 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
85 85
86 const String& keyIdentifier() const { return m_keyIdentifier; } 86 const String& keyIdentifier() const { return m_keyIdentifier; }
87 const String& code() const { return m_code; }
88
87 unsigned location() const { return m_location; } 89 unsigned location() const { return m_location; }
88 90
89 bool getModifierState(const String& keyIdentifier) const; 91 bool getModifierState(const String& keyIdentifier) const;
90 92
91 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } 93 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); }
92 94
93 virtual int keyCode() const override; // key code for keydown and keyup, cha racter for keypress 95 virtual int keyCode() const override; // key code for keydown and keyup, cha racter for keypress
94 virtual int charCode() const override; // character code for keypress, 0 for keydown and keyup 96 virtual int charCode() const override; // character code for keypress, 0 for keydown and keyup
95 bool repeat() const { return m_isAutoRepeat; } 97 bool repeat() const { return m_isAutoRepeat; }
96 98
97 virtual const AtomicString& interfaceName() const override; 99 virtual const AtomicString& interfaceName() const override;
98 virtual bool isKeyboardEvent() const override; 100 virtual bool isKeyboardEvent() const override;
99 virtual int which() const override; 101 virtual int which() const override;
100 102
101 virtual void trace(Visitor*) override; 103 virtual void trace(Visitor*) override;
102 104
103 private: 105 private:
104 KeyboardEvent(); 106 KeyboardEvent();
105 KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*); 107 KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*);
106 KeyboardEvent(const AtomicString&, const KeyboardEventInit&); 108 KeyboardEvent(const AtomicString&, const KeyboardEventInit&);
107 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs tractView*, 109 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs tractView*,
108 const String& keyIdentifier, unsigned location, 110 const String& keyIdentifier, const String& code, unsigned location,
109 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); 111 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
110 112
111 OwnPtr<PlatformKeyboardEvent> m_keyEvent; 113 OwnPtr<PlatformKeyboardEvent> m_keyEvent;
112 String m_keyIdentifier; 114 String m_keyIdentifier;
115 String m_code;
113 unsigned m_location; 116 unsigned m_location;
114 bool m_isAutoRepeat : 1; 117 bool m_isAutoRepeat : 1;
115 }; 118 };
116 119
117 class KeyboardEventDispatchMediator : public EventDispatchMediator { 120 class KeyboardEventDispatchMediator : public EventDispatchMediator {
118 public: 121 public:
119 static PassRefPtrWillBeRawPtr<KeyboardEventDispatchMediator> create(PassRefP trWillBeRawPtr<KeyboardEvent>); 122 static PassRefPtrWillBeRawPtr<KeyboardEventDispatchMediator> create(PassRefP trWillBeRawPtr<KeyboardEvent>);
120 private: 123 private:
121 explicit KeyboardEventDispatchMediator(PassRefPtrWillBeRawPtr<KeyboardEvent> ); 124 explicit KeyboardEventDispatchMediator(PassRefPtrWillBeRawPtr<KeyboardEvent> );
122 virtual bool dispatchEvent(EventDispatcher&) const override; 125 virtual bool dispatchEvent(EventDispatcher&) const override;
123 }; 126 };
124 127
125 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent); 128 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent);
126 129
127 } // namespace blink 130 } // namespace blink
128 131
129 #endif // KeyboardEvent_h 132 #endif // KeyboardEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698