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

Unified Diff: Source/core/rendering/svg/RenderSVGTransformableContainer.cpp

Issue 191003007: Use isSVG*Element() helpers more in SVG code (Part 3) (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
Index: Source/core/rendering/svg/RenderSVGTransformableContainer.cpp
diff --git a/Source/core/rendering/svg/RenderSVGTransformableContainer.cpp b/Source/core/rendering/svg/RenderSVGTransformableContainer.cpp
index c55400cd13260b9cac3f6efe4f2b8717cf9afef4..f61bee495314b3c28ef4d48a80ec7fd1c4343f7c 100644
--- a/Source/core/rendering/svg/RenderSVGTransformableContainer.cpp
+++ b/Source/core/rendering/svg/RenderSVGTransformableContainer.cpp
@@ -49,7 +49,8 @@ static bool hasValidPredecessor(const Node* node)
bool RenderSVGTransformableContainer::isChildAllowed(RenderObject* child, RenderStyle* style) const
{
- if (element()->hasTagName(SVGNames::switchTag)) {
+ ASSERT(element());
+ if (isSVGSwitchElement(*element())) {
Node* node = child->node();
// Reject non-SVG/non-valid elements.
if (!node->isSVGElement() || !toSVGElement(node)->isValid())
@@ -57,10 +58,10 @@ bool RenderSVGTransformableContainer::isChildAllowed(RenderObject* child, Render
// Reject this child if it isn't the first valid node.
if (hasValidPredecessor(node))
return false;
- } else if (element()->hasTagName(SVGNames::aTag)) {
+ } else if (isSVGAElement(*element())) {
// http://www.w3.org/2003/01/REC-SVG11-20030114-errata#linking-text-environment
// The 'a' element may contain any element that its parent may contain, except itself.
- if (child->node()->hasTagName(SVGNames::aTag))
+ if (isSVGAElement(*child->node()))
return false;
if (parent() && parent()->isSVG())
return parent()->isChildAllowed(child, style);
@@ -71,16 +72,17 @@ bool RenderSVGTransformableContainer::isChildAllowed(RenderObject* child, Render
bool RenderSVGTransformableContainer::calculateLocalTransform()
{
SVGGraphicsElement* element = toSVGGraphicsElement(this->element());
+ ASSERT(element);
// If we're either the renderer for a <use> element, or for any <g> element inside the shadow
// tree, that was created during the use/symbol/svg expansion in SVGUseElement. These containers
// need to respect the translations induced by their corresponding use elements x/y attributes.
SVGUseElement* useElement = 0;
- if (element->hasTagName(SVGNames::useTag))
+ if (isSVGUseElement(*element)) {
useElement = toSVGUseElement(element);
- else if (element->isInShadowTree() && element->hasTagName(SVGNames::gTag)) {
+ } else if (element->isInShadowTree() && isSVGGElement(*element)) {
SVGElement* correspondingElement = element->correspondingElement();
- if (correspondingElement && correspondingElement->hasTagName(SVGNames::useTag))
+ if (isSVGUseElement(correspondingElement))
useElement = toSVGUseElement(correspondingElement);
}
« no previous file with comments | « Source/core/rendering/svg/RenderSVGTextPath.cpp ('k') | Source/core/rendering/svg/RenderSVGViewportContainer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698