| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebNode_h | 31 #ifndef WebNode_h |
| 32 #define WebNode_h | 32 #define WebNode_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" | 36 #include "../platform/WebString.h" |
| 37 #include "WebExceptionCode.h" | 37 #include "WebExceptionCode.h" |
| 38 | 38 |
| 39 namespace WebCore { class Node; } | 39 namespace blink { class Node; } |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 class WebDOMEvent; | 42 class WebDOMEvent; |
| 43 class WebDOMEventListener; | 43 class WebDOMEventListener; |
| 44 class WebDOMEventListenerPrivate; | 44 class WebDOMEventListenerPrivate; |
| 45 class WebDocument; | 45 class WebDocument; |
| 46 class WebElement; | 46 class WebElement; |
| 47 class WebElementCollection; | 47 class WebElementCollection; |
| 48 class WebNodeList; | 48 class WebNodeList; |
| 49 class WebPluginContainer; | 49 class WebPluginContainer; |
| 50 | 50 |
| 51 // Provides access to some properties of a DOM node. | 51 // Provides access to some properties of a DOM node. |
| 52 // Note that the class design requires that neither this class nor any of its su
bclasses have any virtual | 52 // Note that the class design requires that neither this class nor any of its su
bclasses have any virtual |
| 53 // methods (other than the destructor), so that it is possible to safely static_
cast an instance of one | 53 // methods (other than the destructor), so that it is possible to safely static_
cast an instance of one |
| 54 // class to the appropriate subclass based on the actual type of the wrapped Web
Core::Node. For the same | 54 // class to the appropriate subclass based on the actual type of the wrapped bli
nk::Node. For the same |
| 55 // reason, subclasses must not add any additional data members. | 55 // reason, subclasses must not add any additional data members. |
| 56 class WebNode { | 56 class WebNode { |
| 57 public: | 57 public: |
| 58 virtual ~WebNode() { reset(); } | 58 virtual ~WebNode() { reset(); } |
| 59 | 59 |
| 60 WebNode() { } | 60 WebNode() { } |
| 61 WebNode(const WebNode& n) { assign(n); } | 61 WebNode(const WebNode& n) { assign(n); } |
| 62 WebNode& operator=(const WebNode& n) | 62 WebNode& operator=(const WebNode& n) |
| 63 { | 63 { |
| 64 assign(n); | 64 assign(n); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 } | 135 } |
| 136 | 136 |
| 137 template<typename T> const T toConst() const | 137 template<typename T> const T toConst() const |
| 138 { | 138 { |
| 139 T res; | 139 T res; |
| 140 res.WebNode::assign(*this); | 140 res.WebNode::assign(*this); |
| 141 return res; | 141 return res; |
| 142 } | 142 } |
| 143 | 143 |
| 144 #if BLINK_IMPLEMENTATION | 144 #if BLINK_IMPLEMENTATION |
| 145 WebNode(const PassRefPtrWillBeRawPtr<WebCore::Node>&); | 145 WebNode(const PassRefPtrWillBeRawPtr<blink::Node>&); |
| 146 WebNode& operator=(const PassRefPtrWillBeRawPtr<WebCore::Node>&); | 146 WebNode& operator=(const PassRefPtrWillBeRawPtr<blink::Node>&); |
| 147 operator PassRefPtrWillBeRawPtr<WebCore::Node>() const; | 147 operator PassRefPtrWillBeRawPtr<blink::Node>() const; |
| 148 #endif | 148 #endif |
| 149 | 149 |
| 150 #if BLINK_IMPLEMENTATION | 150 #if BLINK_IMPLEMENTATION |
| 151 template<typename T> T* unwrap() | 151 template<typename T> T* unwrap() |
| 152 { | 152 { |
| 153 return static_cast<T*>(m_private.get()); | 153 return static_cast<T*>(m_private.get()); |
| 154 } | 154 } |
| 155 | 155 |
| 156 template<typename T> const T* constUnwrap() const | 156 template<typename T> const T* constUnwrap() const |
| 157 { | 157 { |
| 158 return static_cast<const T*>(m_private.get()); | 158 return static_cast<const T*>(m_private.get()); |
| 159 } | 159 } |
| 160 #endif | 160 #endif |
| 161 | 161 |
| 162 protected: | 162 protected: |
| 163 WebPrivatePtr<WebCore::Node> m_private; | 163 WebPrivatePtr<blink::Node> m_private; |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 inline bool operator==(const WebNode& a, const WebNode& b) | 166 inline bool operator==(const WebNode& a, const WebNode& b) |
| 167 { | 167 { |
| 168 return a.equals(b); | 168 return a.equals(b); |
| 169 } | 169 } |
| 170 | 170 |
| 171 inline bool operator!=(const WebNode& a, const WebNode& b) | 171 inline bool operator!=(const WebNode& a, const WebNode& b) |
| 172 { | 172 { |
| 173 return !(a == b); | 173 return !(a == b); |
| 174 } | 174 } |
| 175 | 175 |
| 176 inline bool operator<(const WebNode& a, const WebNode& b) | 176 inline bool operator<(const WebNode& a, const WebNode& b) |
| 177 { | 177 { |
| 178 return a.lessThan(b); | 178 return a.lessThan(b); |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace blink | 181 } // namespace blink |
| 182 | 182 |
| 183 #endif | 183 #endif |
| OLD | NEW |