| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebDOMEvent_h | 31 #ifndef WebDOMEvent_h |
| 32 #define WebDOMEvent_h | 32 #define WebDOMEvent_h |
| 33 | 33 |
| 34 #include "../platform/WebCommon.h" | 34 #include "../platform/WebCommon.h" |
| 35 #include "../platform/WebPrivatePtr.h" | 35 #include "../platform/WebPrivatePtr.h" |
| 36 #include "../platform/WebString.h" | |
| 37 #include "WebNode.h" | |
| 38 | |
| 39 #if BLINK_IMPLEMENTATION | |
| 40 namespace WTF { template <typename T> class PassRefPtr; } | |
| 41 #endif | |
| 42 | 36 |
| 43 namespace blink { | 37 namespace blink { |
| 44 | 38 |
| 45 class Event; | 39 class Event; |
| 46 | 40 |
| 47 class WebDOMEvent { | 41 class WebDOMEvent { |
| 48 public: | 42 public: |
| 49 enum PhaseType { | |
| 50 CapturingPhase = 1, | |
| 51 AtTarget = 2, | |
| 52 BubblingPhase = 3 | |
| 53 }; | |
| 54 | |
| 55 ~WebDOMEvent() { reset(); } | 43 ~WebDOMEvent() { reset(); } |
| 56 | 44 |
| 57 WebDOMEvent() { } | 45 WebDOMEvent() { } |
| 58 WebDOMEvent(const WebDOMEvent& other) { assign(other); } | 46 WebDOMEvent(const WebDOMEvent& other) { assign(other); } |
| 59 WebDOMEvent& operator=(const WebDOMEvent& e) | 47 WebDOMEvent& operator=(const WebDOMEvent& e) |
| 60 { | 48 { |
| 61 assign(e); | 49 assign(e); |
| 62 return *this; | 50 return *this; |
| 63 } | 51 } |
| 64 | 52 |
| 65 BLINK_EXPORT void reset(); | 53 BLINK_EXPORT void reset(); |
| 66 BLINK_EXPORT void assign(const WebDOMEvent&); | 54 BLINK_EXPORT void assign(const WebDOMEvent&); |
| 67 | 55 |
| 68 bool isNull() const { return m_private.isNull(); } | 56 bool isNull() const { return m_private.isNull(); } |
| 69 | 57 |
| 70 BLINK_EXPORT WebString type() const; | |
| 71 BLINK_EXPORT WebNode target() const; | |
| 72 BLINK_EXPORT WebNode currentTarget() const; | |
| 73 | |
| 74 BLINK_EXPORT PhaseType eventPhase() const; | |
| 75 BLINK_EXPORT bool bubbles() const; | |
| 76 BLINK_EXPORT bool cancelable() const; | |
| 77 | |
| 78 BLINK_EXPORT bool isUIEvent() const; | |
| 79 BLINK_EXPORT bool isMouseEvent() const; | |
| 80 BLINK_EXPORT bool isMutationEvent() const; | |
| 81 BLINK_EXPORT bool isKeyboardEvent() const; | |
| 82 BLINK_EXPORT bool isTextEvent() const; | |
| 83 BLINK_EXPORT bool isCompositionEvent() const; | |
| 84 BLINK_EXPORT bool isDragEvent() const; | |
| 85 BLINK_EXPORT bool isClipboardEvent() const; | |
| 86 BLINK_EXPORT bool isMessageEvent() const; | |
| 87 BLINK_EXPORT bool isWheelEvent() const; | |
| 88 BLINK_EXPORT bool isBeforeTextInsertedEvent() const; | |
| 89 BLINK_EXPORT bool isPageTransitionEvent() const; | |
| 90 BLINK_EXPORT bool isPopStateEvent() const; | |
| 91 BLINK_EXPORT bool isProgressEvent() const; | |
| 92 BLINK_EXPORT bool isXMLHttpRequestProgressEvent() const; | |
| 93 | |
| 94 #if BLINK_IMPLEMENTATION | 58 #if BLINK_IMPLEMENTATION |
| 95 WebDOMEvent(const PassRefPtrWillBeRawPtr<Event>&); | 59 WebDOMEvent(const PassRefPtrWillBeRawPtr<Event>&); |
| 96 operator PassRefPtrWillBeRawPtr<Event>() const; | 60 operator PassRefPtrWillBeRawPtr<Event>() const; |
| 97 #endif | 61 #endif |
| 98 | 62 |
| 99 template<typename T> T to() | 63 template<typename T> T to() |
| 100 { | 64 { |
| 101 T res; | 65 T res; |
| 102 res.WebDOMEvent::assign(*this); | 66 res.WebDOMEvent::assign(*this); |
| 103 return res; | 67 return res; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 124 return static_cast<const T*>(m_private.get()); | 88 return static_cast<const T*>(m_private.get()); |
| 125 } | 89 } |
| 126 #endif | 90 #endif |
| 127 | 91 |
| 128 WebPrivatePtr<Event> m_private; | 92 WebPrivatePtr<Event> m_private; |
| 129 }; | 93 }; |
| 130 | 94 |
| 131 } // namespace blink | 95 } // namespace blink |
| 132 | 96 |
| 133 #endif | 97 #endif |
| OLD | NEW |