diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-08-25 19:20:41 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:30:55 +0000 |
commit | 6882a04fb36642862b11efe514251d32070c3d65 (patch) | |
tree | b7959826000b061fd5ccc7512035c7478742f7b0 /Source/WebCore/svg/SVGClipPathElement.cpp | |
parent | ab6df191029eeeb0b0f16f127d553265659f739e (diff) | |
download | qtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz |
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebCore/svg/SVGClipPathElement.cpp')
-rw-r--r-- | Source/WebCore/svg/SVGClipPathElement.cpp | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/Source/WebCore/svg/SVGClipPathElement.cpp b/Source/WebCore/svg/SVGClipPathElement.cpp index b09b9a029..2094b6b95 100644 --- a/Source/WebCore/svg/SVGClipPathElement.cpp +++ b/Source/WebCore/svg/SVGClipPathElement.cpp @@ -20,17 +20,14 @@ */ #include "config.h" - -#if ENABLE(SVG) #include "SVGClipPathElement.h" -#include "Attribute.h" #include "Document.h" #include "RenderSVGResourceClipper.h" -#include "SVGElementInstance.h" #include "SVGNames.h" #include "SVGTransformList.h" #include "StyleResolver.h" +#include <wtf/NeverDestroyed.h> namespace WebCore { @@ -44,7 +41,7 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGClipPathElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Document* document) +inline SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Document& document) : SVGGraphicsElement(tagName, document) , m_clipPathUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) { @@ -52,42 +49,33 @@ inline SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Docu registerAnimatedPropertiesForSVGClipPathElement(); } -PassRefPtr<SVGClipPathElement> SVGClipPathElement::create(const QualifiedName& tagName, Document* document) +Ref<SVGClipPathElement> SVGClipPathElement::create(const QualifiedName& tagName, Document& document) { - return adoptRef(new SVGClipPathElement(tagName, document)); + return adoptRef(*new SVGClipPathElement(tagName, document)); } bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName) { - DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); - if (supportedAttributes.isEmpty()) { + static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes; + if (supportedAttributes.get().isEmpty()) { SVGLangSpace::addSupportedAttributes(supportedAttributes); SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); - supportedAttributes.add(SVGNames::clipPathUnitsAttr); + supportedAttributes.get().add(SVGNames::clipPathUnitsAttr); } - return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); + return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); } void SVGClipPathElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { - if (!isSupportedAttribute(name)) { - SVGGraphicsElement::parseAttribute(name, value); - return; - } - if (name == SVGNames::clipPathUnitsAttr) { - SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); + auto propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); if (propertyValue > 0) setClipPathUnitsBaseValue(propertyValue); return; } - if (SVGLangSpace::parseAttribute(name, value)) - return; - if (SVGExternalResourcesRequired::parseAttribute(name, value)) - return; - - ASSERT_NOT_REACHED(); + SVGGraphicsElement::parseAttribute(name, value); + SVGExternalResourcesRequired::parseAttribute(name, value); } void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) @@ -97,28 +85,26 @@ void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) return; } - SVGElementInstance::InvalidationGuard invalidationGuard(this); + InstanceInvalidationGuard guard(*this); if (RenderObject* object = renderer()) - object->setNeedsLayout(true); + object->setNeedsLayout(); } -void SVGClipPathElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) +void SVGClipPathElement::childrenChanged(const ChildChange& change) { - SVGGraphicsElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); + SVGGraphicsElement::childrenChanged(change); - if (changedByParser) + if (change.source == ChildChangeSourceParser) return; if (RenderObject* object = renderer()) - object->setNeedsLayout(true); + object->setNeedsLayout(); } -RenderObject* SVGClipPathElement::createRenderer(RenderArena* arena, RenderStyle*) +RenderPtr<RenderElement> SVGClipPathElement::createElementRenderer(Ref<RenderStyle>&& style, const RenderTreePosition&) { - return new (arena) RenderSVGResourceClipper(this); + return createRenderer<RenderSVGResourceClipper>(*this, WTFMove(style)); } } - -#endif // ENABLE(SVG) |