| 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 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 "../../../../public/platform/WebCommon.h" | 34 #include "../../../../public/platform/WebCommon.h" |
| 35 #include "../../../../public/platform/WebPrivatePtr.h" |
| 35 #include "../../../../public/platform/WebString.h" | 36 #include "../../../../public/platform/WebString.h" |
| 36 #include "WebNode.h" | 37 #include "WebNode.h" |
| 37 | 38 |
| 38 namespace WebCore { class Event; } | 39 namespace WebCore { class Event; } |
| 39 #if WEBKIT_IMPLEMENTATION | 40 #if WEBKIT_IMPLEMENTATION |
| 40 namespace WTF { template <typename T> class PassRefPtr; } | 41 namespace WTF { template <typename T> class PassRefPtr; } |
| 41 #endif | 42 #endif |
| 42 | 43 |
| 43 namespace WebKit { | 44 namespace WebKit { |
| 44 | 45 |
| 45 class WebDOMEvent { | 46 class WebDOMEvent { |
| 46 public: | 47 public: |
| 47 enum PhaseType { | 48 enum PhaseType { |
| 48 CapturingPhase = 1, | 49 CapturingPhase = 1, |
| 49 AtTarget = 2, | 50 AtTarget = 2, |
| 50 BubblingPhase = 3 | 51 BubblingPhase = 3 |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 ~WebDOMEvent() { reset(); } | 54 ~WebDOMEvent() { reset(); } |
| 54 | 55 |
| 55 WebDOMEvent() : m_private(0) { } | 56 WebDOMEvent() { } |
| 56 WebDOMEvent(const WebDOMEvent& e) : m_private(0) { assign(e); } | 57 WebDOMEvent(const WebDOMEvent& other) { assign(other); } |
| 57 WebDOMEvent& operator=(const WebDOMEvent& e) | 58 WebDOMEvent& operator=(const WebDOMEvent& e) |
| 58 { | 59 { |
| 59 assign(e); | 60 assign(e); |
| 60 return *this; | 61 return *this; |
| 61 } | 62 } |
| 62 | 63 |
| 63 WEBKIT_EXPORT void reset(); | 64 WEBKIT_EXPORT void reset(); |
| 64 WEBKIT_EXPORT void assign(const WebDOMEvent&); | 65 WEBKIT_EXPORT void assign(const WebDOMEvent&); |
| 65 | 66 |
| 66 bool isNull() const { return !m_private; } | 67 bool isNull() const { return m_private.isNull(); } |
| 67 | 68 |
| 68 WEBKIT_EXPORT WebString type() const; | 69 WEBKIT_EXPORT WebString type() const; |
| 69 WEBKIT_EXPORT WebNode target() const; | 70 WEBKIT_EXPORT WebNode target() const; |
| 70 WEBKIT_EXPORT WebNode currentTarget() const; | 71 WEBKIT_EXPORT WebNode currentTarget() const; |
| 71 | 72 |
| 72 WEBKIT_EXPORT PhaseType eventPhase() const; | 73 WEBKIT_EXPORT PhaseType eventPhase() const; |
| 73 WEBKIT_EXPORT bool bubbles() const; | 74 WEBKIT_EXPORT bool bubbles() const; |
| 74 WEBKIT_EXPORT bool cancelable() const; | 75 WEBKIT_EXPORT bool cancelable() const; |
| 75 | 76 |
| 76 WEBKIT_EXPORT bool isUIEvent() const; | 77 WEBKIT_EXPORT bool isUIEvent() const; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 105 | 106 |
| 106 template<typename T> const T toConst() const | 107 template<typename T> const T toConst() const |
| 107 { | 108 { |
| 108 T res; | 109 T res; |
| 109 res.WebDOMEvent::assign(*this); | 110 res.WebDOMEvent::assign(*this); |
| 110 return res; | 111 return res; |
| 111 } | 112 } |
| 112 | 113 |
| 113 protected: | 114 protected: |
| 114 typedef WebCore::Event WebDOMEventPrivate; | 115 typedef WebCore::Event WebDOMEventPrivate; |
| 115 void assign(WebDOMEventPrivate*); | 116 #if WEBKIT_IMPLEMENTATION |
| 116 WebDOMEventPrivate* m_private; | 117 void assign(const WTF::PassRefPtr<WebDOMEventPrivate>&); |
| 117 | 118 |
| 118 template<typename T> T* unwrap() | 119 template<typename T> T* unwrap() |
| 119 { | 120 { |
| 120 return static_cast<T*>(m_private); | 121 return static_cast<T*>(m_private.get()); |
| 121 } | 122 } |
| 122 | 123 |
| 123 template<typename T> const T* constUnwrap() const | 124 template<typename T> const T* constUnwrap() const |
| 124 { | 125 { |
| 125 return static_cast<const T*>(m_private); | 126 return static_cast<const T*>(m_private.get()); |
| 126 } | 127 } |
| 128 #endif |
| 129 |
| 130 WebPrivatePtr<WebDOMEventPrivate> m_private; |
| 127 }; | 131 }; |
| 128 | 132 |
| 129 } // namespace WebKit | 133 } // namespace WebKit |
| 130 | 134 |
| 131 #endif | 135 #endif |
| OLD | NEW |