From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/svg/SVGFELightElement.cpp | 80 +++++++++----------------------- 1 file changed, 21 insertions(+), 59 deletions(-) (limited to 'Source/WebCore/svg/SVGFELightElement.cpp') diff --git a/Source/WebCore/svg/SVGFELightElement.cpp b/Source/WebCore/svg/SVGFELightElement.cpp index dc56f36ae..9a85b408b 100644 --- a/Source/WebCore/svg/SVGFELightElement.cpp +++ b/Source/WebCore/svg/SVGFELightElement.cpp @@ -20,17 +20,16 @@ */ #include "config.h" - -#if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFELightElement.h" -#include "Attribute.h" #include "ElementIterator.h" #include "RenderObject.h" #include "RenderSVGResource.h" -#include "SVGElementInstance.h" #include "SVGFEDiffuseLightingElement.h" +#include "SVGFEDistantLightElement.h" +#include "SVGFEPointLightElement.h" #include "SVGFESpecularLightingElement.h" +#include "SVGFESpotLightElement.h" #include "SVGFilterElement.h" #include "SVGFilterPrimitiveStandardAttributes.h" #include "SVGNames.h" @@ -72,13 +71,13 @@ SVGFELightElement::SVGFELightElement(const QualifiedName& tagName, Document& doc SVGFELightElement* SVGFELightElement::findLightElement(const SVGElement* svgElement) { for (auto& child : childrenOfType(*svgElement)) { - if (isSVGFEDistantLightElement(child) || isSVGFEPointLightElement(child) || isSVGFESpotLightElement(child)) + if (is(child) || is(child) || is(child)) return static_cast(const_cast(&child)); } return nullptr; } -PassRefPtr SVGFELightElement::findLightSource(const SVGElement* svgElement) +RefPtr SVGFELightElement::findLightSource(const SVGElement* svgElement) { SVGFELightElement* lightNode = findLightElement(svgElement); if (!lightNode) @@ -86,31 +85,8 @@ PassRefPtr SVGFELightElement::findLightSource(const SVGElement* svg return lightNode->lightSource(); } -bool SVGFELightElement::isSupportedAttribute(const QualifiedName& attrName) -{ - DEFINE_STATIC_LOCAL(HashSet, supportedAttributes, ()); - if (supportedAttributes.isEmpty()) { - supportedAttributes.add(SVGNames::azimuthAttr); - supportedAttributes.add(SVGNames::elevationAttr); - supportedAttributes.add(SVGNames::xAttr); - supportedAttributes.add(SVGNames::yAttr); - supportedAttributes.add(SVGNames::zAttr); - supportedAttributes.add(SVGNames::pointsAtXAttr); - supportedAttributes.add(SVGNames::pointsAtYAttr); - supportedAttributes.add(SVGNames::pointsAtZAttr); - supportedAttributes.add(SVGNames::specularExponentAttr); - supportedAttributes.add(SVGNames::limitingConeAngleAttr); - } - return supportedAttributes.contains(attrName); -} - void SVGFELightElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { - if (!isSupportedAttribute(name)) { - SVGElement::parseAttribute(name, value); - return; - } - if (name == SVGNames::azimuthAttr) { setAzimuthBaseValue(value.toFloat()); return; @@ -161,48 +137,36 @@ void SVGFELightElement::parseAttribute(const QualifiedName& name, const AtomicSt return; } - ASSERT_NOT_REACHED(); + SVGElement::parseAttribute(name, value); } void SVGFELightElement::svgAttributeChanged(const QualifiedName& attrName) { - if (!isSupportedAttribute(attrName)) { - SVGElement::svgAttributeChanged(attrName); - return; - } + if (attrName == SVGNames::azimuthAttr || attrName == SVGNames::elevationAttr + || attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || attrName == SVGNames::zAttr + || attrName == SVGNames::pointsAtXAttr || attrName == SVGNames::pointsAtYAttr || attrName == SVGNames::pointsAtZAttr + || attrName == SVGNames::specularExponentAttr || attrName == SVGNames::limitingConeAngleAttr) { - SVGElementInstance::InvalidationGuard invalidationGuard(this); - - if (attrName == SVGNames::azimuthAttr - || attrName == SVGNames::elevationAttr - || attrName == SVGNames::xAttr - || attrName == SVGNames::yAttr - || attrName == SVGNames::zAttr - || attrName == SVGNames::pointsAtXAttr - || attrName == SVGNames::pointsAtYAttr - || attrName == SVGNames::pointsAtZAttr - || attrName == SVGNames::specularExponentAttr - || attrName == SVGNames::limitingConeAngleAttr) { - ContainerNode* parent = parentNode(); + auto* parent = parentElement(); if (!parent) return; - RenderObject* renderer = parent->renderer(); + auto* renderer = parent->renderer(); if (!renderer || !renderer->isSVGResourceFilterPrimitive()) return; - if (parent->hasTagName(SVGNames::feDiffuseLightingTag)) { - SVGFEDiffuseLightingElement* diffuseLighting = static_cast(parent); - diffuseLighting->lightElementAttributeChanged(this, attrName); - return; - } else if (parent->hasTagName(SVGNames::feSpecularLightingTag)) { - SVGFESpecularLightingElement* specularLighting = static_cast(parent); - specularLighting->lightElementAttributeChanged(this, attrName); - return; + if (is(*parent)) { + InstanceInvalidationGuard guard(*this); + downcast(*parent).lightElementAttributeChanged(this, attrName); + } else if (is(*parent)) { + InstanceInvalidationGuard guard(*this); + downcast(*parent).lightElementAttributeChanged(this, attrName); } + + return; } - ASSERT_NOT_REACHED(); + SVGElement::svgAttributeChanged(attrName); } void SVGFELightElement::childrenChanged(const ChildChange& change) @@ -220,5 +184,3 @@ void SVGFELightElement::childrenChanged(const ChildChange& change) } } - -#endif // ENABLE(SVG) -- cgit v1.2.1