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 blink { class Node; } | 39 namespace blink { |
40 | 40 |
41 namespace blink { | 41 class Node; |
42 class WebDOMEvent; | 42 class WebDOMEvent; |
43 class WebDocument; | 43 class WebDocument; |
44 class WebElement; | 44 class WebElement; |
45 class WebElementCollection; | 45 class WebElementCollection; |
46 class WebNodeList; | 46 class WebNodeList; |
47 class WebPluginContainer; | 47 class WebPluginContainer; |
48 | 48 |
49 // Provides access to some properties of a DOM node. | 49 // Provides access to some properties of a DOM node. |
50 // Note that the class design requires that neither this class nor any of its su
bclasses have any virtual | 50 // Note that the class design requires that neither this class nor any of its su
bclasses have any virtual |
51 // methods (other than the destructor), so that it is possible to safely static_
cast an instance of one | 51 // methods (other than the destructor), so that it is possible to safely static_
cast an instance of one |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 133 } |
134 | 134 |
135 template<typename T> const T toConst() const | 135 template<typename T> const T toConst() const |
136 { | 136 { |
137 T res; | 137 T res; |
138 res.WebNode::assign(*this); | 138 res.WebNode::assign(*this); |
139 return res; | 139 return res; |
140 } | 140 } |
141 | 141 |
142 #if BLINK_IMPLEMENTATION | 142 #if BLINK_IMPLEMENTATION |
143 WebNode(const PassRefPtrWillBeRawPtr<blink::Node>&); | 143 WebNode(const PassRefPtrWillBeRawPtr<Node>&); |
144 WebNode& operator=(const PassRefPtrWillBeRawPtr<blink::Node>&); | 144 WebNode& operator=(const PassRefPtrWillBeRawPtr<Node>&); |
145 operator PassRefPtrWillBeRawPtr<blink::Node>() const; | 145 operator PassRefPtrWillBeRawPtr<Node>() const; |
146 #endif | 146 #endif |
147 | 147 |
148 #if BLINK_IMPLEMENTATION | 148 #if BLINK_IMPLEMENTATION |
149 template<typename T> T* unwrap() | 149 template<typename T> T* unwrap() |
150 { | 150 { |
151 return static_cast<T*>(m_private.get()); | 151 return static_cast<T*>(m_private.get()); |
152 } | 152 } |
153 | 153 |
154 template<typename T> const T* constUnwrap() const | 154 template<typename T> const T* constUnwrap() const |
155 { | 155 { |
156 return static_cast<const T*>(m_private.get()); | 156 return static_cast<const T*>(m_private.get()); |
157 } | 157 } |
158 #endif | 158 #endif |
159 | 159 |
160 protected: | 160 protected: |
161 WebPrivatePtr<blink::Node> m_private; | 161 WebPrivatePtr<Node> m_private; |
162 }; | 162 }; |
163 | 163 |
164 inline bool operator==(const WebNode& a, const WebNode& b) | 164 inline bool operator==(const WebNode& a, const WebNode& b) |
165 { | 165 { |
166 return a.equals(b); | 166 return a.equals(b); |
167 } | 167 } |
168 | 168 |
169 inline bool operator!=(const WebNode& a, const WebNode& b) | 169 inline bool operator!=(const WebNode& a, const WebNode& b) |
170 { | 170 { |
171 return !(a == b); | 171 return !(a == b); |
172 } | 172 } |
173 | 173 |
174 inline bool operator<(const WebNode& a, const WebNode& b) | 174 inline bool operator<(const WebNode& a, const WebNode& b) |
175 { | 175 { |
176 return a.lessThan(b); | 176 return a.lessThan(b); |
177 } | 177 } |
178 | 178 |
179 } // namespace blink | 179 } // namespace blink |
180 | 180 |
181 #endif | 181 #endif |
OLD | NEW |