| OLD | NEW |
| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, unsigned location, |
| 74 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey
) | 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, location, |
| 77 ctrlKey, altKey, shiftKey, metaKey, altGraphKey)); | 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, bool altGraphKey
= false); | 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 unsigned location() const { return m_location; } | 87 unsigned location() const { return m_location; } |
| 88 | 88 |
| 89 bool getModifierState(const String& keyIdentifier) const; | 89 bool getModifierState(const String& keyIdentifier) const; |
| 90 | 90 |
| 91 bool altGraphKey() const { return m_altGraphKey; } | |
| 92 | |
| 93 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } | 91 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } |
| 94 | 92 |
| 95 virtual int keyCode() const OVERRIDE; // key code for keydown and keyup, cha
racter for keypress | 93 virtual int keyCode() const OVERRIDE; // key code for keydown and keyup, cha
racter for keypress |
| 96 virtual int charCode() const OVERRIDE; // character code for keypress, 0 for
keydown and keyup | 94 virtual int charCode() const OVERRIDE; // character code for keypress, 0 for
keydown and keyup |
| 97 bool repeat() const { return m_isAutoRepeat; } | 95 bool repeat() const { return m_isAutoRepeat; } |
| 98 | 96 |
| 99 virtual const AtomicString& interfaceName() const OVERRIDE; | 97 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 100 virtual bool isKeyboardEvent() const OVERRIDE; | 98 virtual bool isKeyboardEvent() const OVERRIDE; |
| 101 virtual int which() const OVERRIDE; | 99 virtual int which() const OVERRIDE; |
| 102 | 100 |
| 103 virtual void trace(Visitor*) OVERRIDE; | 101 virtual void trace(Visitor*) OVERRIDE; |
| 104 | 102 |
| 105 private: | 103 private: |
| 106 KeyboardEvent(); | 104 KeyboardEvent(); |
| 107 KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*); | 105 KeyboardEvent(const PlatformKeyboardEvent&, AbstractView*); |
| 108 KeyboardEvent(const AtomicString&, const KeyboardEventInit&); | 106 KeyboardEvent(const AtomicString&, const KeyboardEventInit&); |
| 109 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs
tractView*, | 107 KeyboardEvent(const AtomicString& type, bool canBubble, bool cancelable, Abs
tractView*, |
| 110 const String& keyIdentifier, unsigned location, | 108 const String& keyIdentifier, unsigned location, |
| 111 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey
); | 109 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); |
| 112 | 110 |
| 113 OwnPtr<PlatformKeyboardEvent> m_keyEvent; | 111 OwnPtr<PlatformKeyboardEvent> m_keyEvent; |
| 114 String m_keyIdentifier; | 112 String m_keyIdentifier; |
| 115 unsigned m_location; | 113 unsigned m_location; |
| 116 bool m_altGraphKey : 1; | |
| 117 bool m_isAutoRepeat : 1; | 114 bool m_isAutoRepeat : 1; |
| 118 }; | 115 }; |
| 119 | 116 |
| 120 class KeyboardEventDispatchMediator : public EventDispatchMediator { | 117 class KeyboardEventDispatchMediator : public EventDispatchMediator { |
| 121 public: | 118 public: |
| 122 static PassRefPtrWillBeRawPtr<KeyboardEventDispatchMediator> create(PassRefP
trWillBeRawPtr<KeyboardEvent>); | 119 static PassRefPtrWillBeRawPtr<KeyboardEventDispatchMediator> create(PassRefP
trWillBeRawPtr<KeyboardEvent>); |
| 123 private: | 120 private: |
| 124 explicit KeyboardEventDispatchMediator(PassRefPtrWillBeRawPtr<KeyboardEvent>
); | 121 explicit KeyboardEventDispatchMediator(PassRefPtrWillBeRawPtr<KeyboardEvent>
); |
| 125 virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; | 122 virtual bool dispatchEvent(EventDispatcher*) const OVERRIDE; |
| 126 }; | 123 }; |
| 127 | 124 |
| 128 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent); | 125 DEFINE_EVENT_TYPE_CASTS(KeyboardEvent); |
| 129 | 126 |
| 130 } // namespace blink | 127 } // namespace blink |
| 131 | 128 |
| 132 #endif // KeyboardEvent_h | 129 #endif // KeyboardEvent_h |
| OLD | NEW |