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

Unified Diff: Source/core/svg/SVGUseElement.cpp

Issue 190793011: Use isSVG*Element() helpers more in SVG code (Part 4) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/core/svg/SVGTextPositioningElement.cpp ('k') | Source/core/svg/animation/SVGSMILElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGUseElement.cpp
diff --git a/Source/core/svg/SVGUseElement.cpp b/Source/core/svg/SVGUseElement.cpp
index 94bbc4f8fd2df22c4b4890f39baa722c1c27dff5..6135db12db673f5a251a44b6671e25cea82c851f 100644
--- a/Source/core/svg/SVGUseElement.cpp
+++ b/Source/core/svg/SVGUseElement.cpp
@@ -503,15 +503,15 @@ RenderObject* SVGUseElement::createRenderer(RenderStyle*)
return new RenderSVGTransformableContainer(this);
}
-static bool isDirectReference(const Node* node)
+static bool isDirectReference(const Node& node)
{
- return node->hasTagName(SVGNames::pathTag)
- || node->hasTagName(SVGNames::rectTag)
- || node->hasTagName(SVGNames::circleTag)
- || node->hasTagName(SVGNames::ellipseTag)
- || node->hasTagName(SVGNames::polygonTag)
- || node->hasTagName(SVGNames::polylineTag)
- || node->hasTagName(SVGNames::textTag);
+ return isSVGPathElement(node)
+ || isSVGRectElement(node)
+ || isSVGCircleElement(node)
+ || isSVGEllipseElement(node)
+ || isSVGPolygonElement(node)
+ || isSVGPolylineElement(node)
+ || isSVGTextElement(node);
}
void SVGUseElement::toClipPath(Path& path)
@@ -523,7 +523,7 @@ void SVGUseElement::toClipPath(Path& path)
return;
if (n->isSVGElement() && toSVGElement(n)->isSVGGraphicsElement()) {
- if (!isDirectReference(n)) {
+ if (!isDirectReference(*n)) {
// Spec: Indirect references are an error (14.3.5)
document().accessSVGExtensions().reportError("Not allowed to use indirect reference in <clip-path>");
} else {
@@ -542,7 +542,7 @@ RenderObject* SVGUseElement::rendererClipChild() const
if (!n)
return 0;
- if (n->isSVGElement() && isDirectReference(n))
+ if (n->isSVGElement() && isDirectReference(*n))
return toSVGElement(n)->renderer();
return 0;
@@ -734,7 +734,8 @@ void SVGUseElement::expandUseElementsInShadowTree(Node* element)
void SVGUseElement::expandSymbolElementsInShadowTree(Node* element)
{
- if (element->hasTagName(SVGNames::symbolTag)) {
+ ASSERT(element);
+ if (isSVGSymbolElement(*element)) {
// Spec: The referenced 'symbol' and its contents are deep-cloned into the generated tree,
// with the exception that the 'symbol' is replaced by an 'svg'. This generated 'svg' will
// always have explicit values for attributes width and height. If attributes width and/or
@@ -800,11 +801,11 @@ void SVGUseElement::associateInstancesWithShadowTreeElements(Node* target, SVGEl
return;
SVGElement* originalElement = targetInstance->correspondingElement();
-
- if (originalElement->hasTagName(SVGNames::useTag)) {
+ ASSERT(originalElement);
+ if (isSVGUseElement(*originalElement)) {
// <use> gets replaced by <g>
ASSERT(AtomicString(target->nodeName()) == SVGNames::gTag);
- } else if (originalElement->hasTagName(SVGNames::symbolTag)) {
+ } else if (isSVGSymbolElement(*originalElement)) {
// <symbol> gets replaced by <svg>
ASSERT(AtomicString(target->nodeName()) == SVGNames::svgTag);
} else {
« no previous file with comments | « Source/core/svg/SVGTextPositioningElement.cpp ('k') | Source/core/svg/animation/SVGSMILElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698