diff options
Diffstat (limited to 'Source/WebCore/svg/SVGStopElement.cpp')
-rw-r--r-- | Source/WebCore/svg/SVGStopElement.cpp | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/Source/WebCore/svg/SVGStopElement.cpp b/Source/WebCore/svg/SVGStopElement.cpp index 54f91936d..acf73a848 100644 --- a/Source/WebCore/svg/SVGStopElement.cpp +++ b/Source/WebCore/svg/SVGStopElement.cpp @@ -19,15 +19,11 @@ */ #include "config.h" - -#if ENABLE(SVG) #include "SVGStopElement.h" -#include "Attribute.h" #include "Document.h" #include "RenderSVGGradientStop.h" #include "RenderSVGResource.h" -#include "SVGElementInstance.h" #include "SVGGradientElement.h" #include "SVGNames.h" @@ -49,26 +45,13 @@ inline SVGStopElement::SVGStopElement(const QualifiedName& tagName, Document& do registerAnimatedPropertiesForSVGStopElement(); } -PassRefPtr<SVGStopElement> SVGStopElement::create(const QualifiedName& tagName, Document& document) -{ - return adoptRef(new SVGStopElement(tagName, document)); -} - -bool SVGStopElement::isSupportedAttribute(const QualifiedName& attrName) +Ref<SVGStopElement> SVGStopElement::create(const QualifiedName& tagName, Document& document) { - DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); - if (supportedAttributes.isEmpty()) - supportedAttributes.add(SVGNames::offsetAttr); - return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); + return adoptRef(*new SVGStopElement(tagName, document)); } void SVGStopElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { - if (!isSupportedAttribute(name)) { - SVGElement::parseAttribute(name, value); - return; - } - if (name == SVGNames::offsetAttr) { if (value.endsWith('%')) setOffsetBaseValue(value.string().left(value.length() - 1).toFloat() / 100.0f); @@ -77,30 +60,25 @@ void SVGStopElement::parseAttribute(const QualifiedName& name, const AtomicStrin return; } - ASSERT_NOT_REACHED(); + SVGElement::parseAttribute(name, value); } void SVGStopElement::svgAttributeChanged(const QualifiedName& attrName) { - if (!isSupportedAttribute(attrName)) { - SVGElement::svgAttributeChanged(attrName); - return; - } - - SVGElementInstance::InvalidationGuard invalidationGuard(this); - if (attrName == SVGNames::offsetAttr) { - if (auto renderer = this->renderer()) + if (auto renderer = this->renderer()) { + InstanceInvalidationGuard guard(*this); RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer); + } return; } - ASSERT_NOT_REACHED(); + SVGElement::svgAttributeChanged(attrName); } -RenderPtr<RenderElement> SVGStopElement::createElementRenderer(PassRef<RenderStyle> style) +RenderPtr<RenderElement> SVGStopElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) { - return createRenderer<RenderSVGGradientStop>(*this, std::move(style)); + return createRenderer<RenderSVGGradientStop>(*this, WTFMove(style)); } bool SVGStopElement::rendererIsNeeded(const RenderStyle&) @@ -110,7 +88,7 @@ bool SVGStopElement::rendererIsNeeded(const RenderStyle&) Color SVGStopElement::stopColorIncludingOpacity() const { - RenderStyle* style = renderer() ? &renderer()->style() : nullptr; + auto* style = renderer() ? &renderer()->style() : nullptr; // FIXME: This check for null style exists to address Bug WK 90814, a rare crash condition in // which the renderer or style is null. This entire class is scheduled for removal (Bug WK 86941) // and we will tolerate this null check until then. @@ -122,5 +100,3 @@ Color SVGStopElement::stopColorIncludingOpacity() const } } - -#endif // ENABLE(SVG) |