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

Unified Diff: Source/core/svg/SVGElement.h

Issue 406843002: Optimize hasTagName when called on an HTMLElement / SVGElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/svg/SVGElement.h
diff --git a/Source/core/svg/SVGElement.h b/Source/core/svg/SVGElement.h
index 15380169fc72810aed98c77177c501102b9ddc73..fd95c19b67d17ea85eb5caae5ad6d3e06b47519e 100644
--- a/Source/core/svg/SVGElement.h
+++ b/Source/core/svg/SVGElement.h
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
* Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
- * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2014 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -22,7 +22,7 @@
#ifndef SVGElement_h
#define SVGElement_h
-#include "core/SVGElementTypeHelpers.h"
+#include "core/SVGNames.h"
#include "core/dom/Element.h"
#include "core/svg/SVGAnimatedString.h"
#include "core/svg/SVGParsingError.h"
@@ -44,6 +44,7 @@ class SVGElement;
class SVGElementRareData;
class SVGFitToViewBox;
class SVGSVGElement;
+class SVGUseElement;
void mapAttributeToCSSProperty(HashMap<StringImpl*, CSSPropertyID>* propertyNameToIdMap, const QualifiedName& attrName);
@@ -60,6 +61,8 @@ public:
bool isOutermostSVGSVGElement() const;
+ bool hasTagName(const SVGQualifiedName& name) const { return hasLocalName(name.localName()); }
+
virtual String title() const OVERRIDE;
bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEmpty(); }
static bool isAnimatableCSSProperty(const QualifiedName&);
@@ -260,8 +263,16 @@ struct SVGAttributeHashTranslator {
DEFINE_ELEMENT_TYPE_CASTS(SVGElement, isSVGElement());
-template <> inline bool isElementOfType<const SVGElement>(const Node& node) { return node.isSVGElement(); }
+template <typename T> bool isElementOfType(const SVGElement&);
+template <> inline bool isElementOfType<const SVGElement>(const SVGElement&) { return true; }
+
+inline bool Node::hasTagName(const SVGQualifiedName& name) const
+{
+ return isSVGElement() && toSVGElement(*this).hasTagName(name);
+}
}
+#include "core/SVGElementTypeHelpers.h"
+
#endif
« no previous file with comments | « Source/core/rendering/compositing/CompositedLayerMapping.cpp ('k') | Source/core/xml/parser/XMLDocumentParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698