summaryrefslogtreecommitdiff
path: root/Source/WebCore/svg/SVGCursorElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/svg/SVGCursorElement.cpp')
-rw-r--r--Source/WebCore/svg/SVGCursorElement.cpp85
1 files changed, 41 insertions, 44 deletions
diff --git a/Source/WebCore/svg/SVGCursorElement.cpp b/Source/WebCore/svg/SVGCursorElement.cpp
index 1c62ef4c3..28938d75c 100644
--- a/Source/WebCore/svg/SVGCursorElement.cpp
+++ b/Source/WebCore/svg/SVGCursorElement.cpp
@@ -19,15 +19,14 @@
*/
#include "config.h"
-
-#if ENABLE(SVG)
#include "SVGCursorElement.h"
-#include "Attr.h"
+#include "CSSCursorImageValue.h"
#include "Document.h"
-#include "SVGElementInstance.h"
#include "SVGNames.h"
+#include "SVGStringList.h"
#include "XLinkNames.h"
+#include <wtf/NeverDestroyed.h>
namespace WebCore {
@@ -54,65 +53,55 @@ inline SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document
registerAnimatedPropertiesForSVGCursorElement();
}
-PassRefPtr<SVGCursorElement> SVGCursorElement::create(const QualifiedName& tagName, Document& document)
+Ref<SVGCursorElement> SVGCursorElement::create(const QualifiedName& tagName, Document& document)
{
- return adoptRef(new SVGCursorElement(tagName, document));
+ return adoptRef(*new SVGCursorElement(tagName, document));
}
SVGCursorElement::~SVGCursorElement()
{
- HashSet<SVGElement*>::iterator end = m_clients.end();
- for (HashSet<SVGElement*>::iterator it = m_clients.begin(); it != end; ++it)
- (*it)->cursorElementRemoved();
+ for (auto& client : m_clients)
+ client->cursorElementRemoved(*this);
}
bool SVGCursorElement::isSupportedAttribute(const QualifiedName& attrName)
{
- DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
- if (supportedAttributes.isEmpty()) {
+ static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
+ if (supportedAttributes.get().isEmpty()) {
SVGTests::addSupportedAttributes(supportedAttributes);
SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
SVGURIReference::addSupportedAttributes(supportedAttributes);
- supportedAttributes.add(SVGNames::xAttr);
- supportedAttributes.add(SVGNames::yAttr);
+ supportedAttributes.get().add(SVGNames::xAttr);
+ supportedAttributes.get().add(SVGNames::yAttr);
}
- return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
+ return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
void SVGCursorElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
SVGParsingError parseError = NoError;
- if (!isSupportedAttribute(name))
- SVGElement::parseAttribute(name, value);
- else if (name == SVGNames::xAttr)
- setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
+ if (name == SVGNames::xAttr)
+ setXBaseValue(SVGLengthValue::construct(LengthModeWidth, value, parseError));
else if (name == SVGNames::yAttr)
- setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
- else if (SVGTests::parseAttribute(name, value)
- || SVGExternalResourcesRequired::parseAttribute(name, value)
- || SVGURIReference::parseAttribute(name, value)) {
- } else
- ASSERT_NOT_REACHED();
-
+ setYBaseValue(SVGLengthValue::construct(LengthModeHeight, value, parseError));
+
reportAttributeParsingError(parseError, name, value);
-}
-void SVGCursorElement::addClient(SVGElement* element)
-{
- m_clients.add(element);
- element->setCursorElement(this);
+ SVGElement::parseAttribute(name, value);
+ SVGTests::parseAttribute(name, value);
+ SVGExternalResourcesRequired::parseAttribute(name, value);
+ SVGURIReference::parseAttribute(name, value);
}
-void SVGCursorElement::removeClient(SVGElement* element)
+void SVGCursorElement::addClient(CSSCursorImageValue& value)
{
- if (m_clients.remove(element))
- element->cursorElementRemoved();
+ m_clients.add(&value);
}
-void SVGCursorElement::removeReferencedElement(SVGElement* element)
+void SVGCursorElement::removeClient(CSSCursorImageValue& value)
{
- m_clients.remove(element);
+ m_clients.remove(&value);
}
void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName)
@@ -122,14 +111,9 @@ void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName)
return;
}
- SVGElementInstance::InvalidationGuard invalidationGuard(this);
-
- // Any change of a cursor specific attribute triggers this recalc.
- HashSet<SVGElement*>::const_iterator it = m_clients.begin();
- HashSet<SVGElement*>::const_iterator end = m_clients.end();
-
- for (; it != end; ++it)
- (*it)->setNeedsStyleRecalc();
+ InstanceInvalidationGuard guard(*this);
+ for (auto& client : m_clients)
+ client->cursorElementChanged(*this);
}
void SVGCursorElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const
@@ -139,6 +123,19 @@ void SVGCursorElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const
addSubresourceURL(urls, document().completeURL(href()));
}
+Ref<SVGStringList> SVGCursorElement::requiredFeatures()
+{
+ return SVGTests::requiredFeatures(*this);
}
-#endif // ENABLE(SVG)
+Ref<SVGStringList> SVGCursorElement::requiredExtensions()
+{
+ return SVGTests::requiredExtensions(*this);
+}
+
+Ref<SVGStringList> SVGCursorElement::systemLanguage()
+{
+ return SVGTests::systemLanguage(*this);
+}
+
+}