OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 { | 154 { |
155 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isShadowRoot()); | 155 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isShadowRoot()); |
156 return static_cast<const ShadowRoot*>(node); | 156 return static_cast<const ShadowRoot*>(node); |
157 } | 157 } |
158 | 158 |
159 inline ShadowRoot* toShadowRoot(Node* node) | 159 inline ShadowRoot* toShadowRoot(Node* node) |
160 { | 160 { |
161 return const_cast<ShadowRoot*>(toShadowRoot(static_cast<const Node*>(node)))
; | 161 return const_cast<ShadowRoot*>(toShadowRoot(static_cast<const Node*>(node)))
; |
162 } | 162 } |
163 | 163 |
| 164 inline const ShadowRoot& toShadowRoot(const Node& node) |
| 165 { |
| 166 ASSERT_WITH_SECURITY_IMPLICATION(node.isShadowRoot()); |
| 167 return static_cast<const ShadowRoot&>(node); |
| 168 } |
| 169 |
164 inline const ShadowRoot* toShadowRoot(const TreeScope* treeScope) | 170 inline const ShadowRoot* toShadowRoot(const TreeScope* treeScope) |
165 { | 171 { |
166 ASSERT_WITH_SECURITY_IMPLICATION(!treeScope || (treeScope->rootNode() && tre
eScope->rootNode()->isShadowRoot())); | 172 ASSERT_WITH_SECURITY_IMPLICATION(!treeScope || (treeScope->rootNode() && tre
eScope->rootNode()->isShadowRoot())); |
167 return static_cast<const ShadowRoot*>(treeScope); | 173 return static_cast<const ShadowRoot*>(treeScope); |
168 } | 174 } |
169 | 175 |
170 inline ShadowRoot* toShadowRoot(TreeScope* treeScope) | 176 inline ShadowRoot* toShadowRoot(TreeScope* treeScope) |
171 { | 177 { |
172 return const_cast<ShadowRoot*>(toShadowRoot(static_cast<const TreeScope*>(tr
eeScope))); | 178 return const_cast<ShadowRoot*>(toShadowRoot(static_cast<const TreeScope*>(tr
eeScope))); |
173 } | 179 } |
174 | 180 |
175 inline ShadowRoot& toShadowRoot(TreeScope& treeScope) | 181 inline ShadowRoot& toShadowRoot(TreeScope& treeScope) |
176 { | 182 { |
177 ASSERT_WITH_SECURITY_IMPLICATION(treeScope.rootNode() && treeScope.rootNode(
)->isShadowRoot()); | 183 ASSERT_WITH_SECURITY_IMPLICATION(treeScope.rootNode() && treeScope.rootNode(
)->isShadowRoot()); |
178 return static_cast<ShadowRoot&>(treeScope); | 184 return static_cast<ShadowRoot&>(treeScope); |
179 } | 185 } |
180 | 186 |
181 } // namespace | 187 } // namespace |
182 | 188 |
183 #endif | 189 #endif |
OLD | NEW |