Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Side by Side Diff: Source/core/dom/shadow/ShadowRoot.h

Issue 49613005: Have TreeScrope::adoptIfNeeded() take a reference instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/TreeScopeAdopter.cpp ('k') | Source/core/html/HTMLTemplateElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 { 159 {
160 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isShadowRoot()); 160 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isShadowRoot());
161 return static_cast<const ShadowRoot*>(node); 161 return static_cast<const ShadowRoot*>(node);
162 } 162 }
163 163
164 inline ShadowRoot* toShadowRoot(Node* node) 164 inline ShadowRoot* toShadowRoot(Node* node)
165 { 165 {
166 return const_cast<ShadowRoot*>(toShadowRoot(static_cast<const Node*>(node))) ; 166 return const_cast<ShadowRoot*>(toShadowRoot(static_cast<const Node*>(node))) ;
167 } 167 }
168 168
169 inline ShadowRoot& toShadowRoot(Node& node)
170 {
171 ASSERT_WITH_SECURITY_IMPLICATION(node.isShadowRoot());
172 return static_cast<ShadowRoot&>(node);
173 }
174
169 inline const ShadowRoot& toShadowRoot(const Node& node) 175 inline const ShadowRoot& toShadowRoot(const Node& node)
170 { 176 {
171 ASSERT_WITH_SECURITY_IMPLICATION(node.isShadowRoot()); 177 ASSERT_WITH_SECURITY_IMPLICATION(node.isShadowRoot());
172 return static_cast<const ShadowRoot&>(node); 178 return static_cast<const ShadowRoot&>(node);
173 } 179 }
174 180
175 inline const ShadowRoot* toShadowRoot(const TreeScope* treeScope) 181 inline const ShadowRoot* toShadowRoot(const TreeScope* treeScope)
176 { 182 {
177 ASSERT_WITH_SECURITY_IMPLICATION(!treeScope || (treeScope->rootNode() && tre eScope->rootNode()->isShadowRoot())); 183 ASSERT_WITH_SECURITY_IMPLICATION(!treeScope || (treeScope->rootNode() && tre eScope->rootNode()->isShadowRoot()));
178 return static_cast<const ShadowRoot*>(treeScope); 184 return static_cast<const ShadowRoot*>(treeScope);
179 } 185 }
180 186
181 inline ShadowRoot* toShadowRoot(TreeScope* treeScope) 187 inline ShadowRoot* toShadowRoot(TreeScope* treeScope)
182 { 188 {
183 return const_cast<ShadowRoot*>(toShadowRoot(static_cast<const TreeScope*>(tr eeScope))); 189 return const_cast<ShadowRoot*>(toShadowRoot(static_cast<const TreeScope*>(tr eeScope)));
184 } 190 }
185 191
186 inline ShadowRoot& toShadowRoot(TreeScope& treeScope) 192 inline ShadowRoot& toShadowRoot(TreeScope& treeScope)
187 { 193 {
188 ASSERT_WITH_SECURITY_IMPLICATION(treeScope.rootNode() && treeScope.rootNode( )->isShadowRoot()); 194 ASSERT_WITH_SECURITY_IMPLICATION(treeScope.rootNode() && treeScope.rootNode( )->isShadowRoot());
189 return static_cast<ShadowRoot&>(treeScope); 195 return static_cast<ShadowRoot&>(treeScope);
190 } 196 }
191 197
192 } // namespace 198 } // namespace
193 199
194 #endif 200 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/TreeScopeAdopter.cpp ('k') | Source/core/html/HTMLTemplateElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698