| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 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. | |
| 29 */ | |
| 30 | |
| 31 #ifndef WebDOMEvent_h | |
| 32 #define WebDOMEvent_h | |
| 33 | |
| 34 #include "../platform/WebCommon.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 | |
| 43 namespace blink { | |
| 44 | |
| 45 class Event; | |
| 46 | |
| 47 class WebDOMEvent { | |
| 48 public: | |
| 49 enum PhaseType { | |
| 50 CapturingPhase = 1, | |
| 51 AtTarget = 2, | |
| 52 BubblingPhase = 3 | |
| 53 }; | |
| 54 | |
| 55 ~WebDOMEvent() { reset(); } | |
| 56 | |
| 57 WebDOMEvent() { } | |
| 58 WebDOMEvent(const WebDOMEvent& other) { assign(other); } | |
| 59 WebDOMEvent& operator=(const WebDOMEvent& e) | |
| 60 { | |
| 61 assign(e); | |
| 62 return *this; | |
| 63 } | |
| 64 | |
| 65 BLINK_EXPORT void reset(); | |
| 66 BLINK_EXPORT void assign(const WebDOMEvent&); | |
| 67 | |
| 68 bool isNull() const { return m_private.isNull(); } | |
| 69 | |
| 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 isWheelEvent() const; | |
| 87 BLINK_EXPORT bool isBeforeTextInsertedEvent() const; | |
| 88 BLINK_EXPORT bool isPageTransitionEvent() const; | |
| 89 BLINK_EXPORT bool isPopStateEvent() const; | |
| 90 BLINK_EXPORT bool isProgressEvent() const; | |
| 91 | |
| 92 #if BLINK_IMPLEMENTATION | |
| 93 WebDOMEvent(const PassRefPtr<Event>&); | |
| 94 operator PassRefPtr<Event>() const; | |
| 95 #endif | |
| 96 | |
| 97 template<typename T> T to() | |
| 98 { | |
| 99 T res; | |
| 100 res.WebDOMEvent::assign(*this); | |
| 101 return res; | |
| 102 } | |
| 103 | |
| 104 template<typename T> const T toConst() const | |
| 105 { | |
| 106 T res; | |
| 107 res.WebDOMEvent::assign(*this); | |
| 108 return res; | |
| 109 } | |
| 110 | |
| 111 protected: | |
| 112 #if BLINK_IMPLEMENTATION | |
| 113 void assign(const PassRefPtr<Event>&); | |
| 114 | |
| 115 template<typename T> T* unwrap() | |
| 116 { | |
| 117 return static_cast<T*>(m_private.get()); | |
| 118 } | |
| 119 | |
| 120 template<typename T> const T* constUnwrap() const | |
| 121 { | |
| 122 return static_cast<const T*>(m_private.get()); | |
| 123 } | |
| 124 #endif | |
| 125 | |
| 126 WebPrivatePtr<Event> m_private; | |
| 127 }; | |
| 128 | |
| 129 } // namespace blink | |
| 130 | |
| 131 #endif | |
| OLD | NEW |