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

Side by Side Diff: Source/core/svg/SVGElement.h

Issue 403343005: Make manual isSVG*Element() helpers as efficient as the generated ones (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix macro name Created 6 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGAnimateElement.cpp ('k') | Source/core/svg/SVGFELightElement.h » ('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) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2009, 2014 Apple Inc. All rights reserved. 4 * Copyright (C) 2009, 2014 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 DEFINE_ELEMENT_TYPE_CASTS(SVGElement, isSVGElement()); 264 DEFINE_ELEMENT_TYPE_CASTS(SVGElement, isSVGElement());
265 265
266 template <typename T> bool isElementOfType(const SVGElement&); 266 template <typename T> bool isElementOfType(const SVGElement&);
267 template <> inline bool isElementOfType<const SVGElement>(const SVGElement&) { r eturn true; } 267 template <> inline bool isElementOfType<const SVGElement>(const SVGElement&) { r eturn true; }
268 268
269 inline bool Node::hasTagName(const SVGQualifiedName& name) const 269 inline bool Node::hasTagName(const SVGQualifiedName& name) const
270 { 270 {
271 return isSVGElement() && toSVGElement(*this).hasTagName(name); 271 return isSVGElement() && toSVGElement(*this).hasTagName(name);
272 } 272 }
273 273
274 // This requires isSVG*Element(const SVGElement&).
275 #define DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType) \
276 inline bool is##thisType(const thisType* element); \
277 inline bool is##thisType(const thisType& element); \
278 inline bool is##thisType(const SVGElement* element) { return element && is## thisType(*element); } \
279 inline bool is##thisType(const Node& node) { return node.isSVGElement() ? is ##thisType(toSVGElement(node)) : false; } \
280 inline bool is##thisType(const Node* node) { return node && is##thisType(*no de); } \
281 template<typename T> inline bool is##thisType(const PassRefPtr<T>& node) { r eturn is##thisType(node.get()); } \
282 template<typename T> inline bool is##thisType(const RefPtr<T>& node) { retur n is##thisType(node.get()); } \
283 template <> inline bool isElementOfType<const thisType>(const SVGElement& el ement) { return is##thisType(element); } \
284 DEFINE_ELEMENT_TYPE_CASTS_WITH_FUNCTION(thisType)
285
274 } 286 }
275 287
276 #include "core/SVGElementTypeHelpers.h" 288 #include "core/SVGElementTypeHelpers.h"
277 289
278 #endif 290 #endif
OLDNEW
« no previous file with comments | « Source/core/svg/SVGAnimateElement.cpp ('k') | Source/core/svg/SVGFELightElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698