This source file includes following definitions.
- m_points
- isSupportedAttribute
- parseAttribute
- svgAttributeChanged
#include "config.h"
#include "core/svg/SVGPolyElement.h"
#include "core/dom/Document.h"
#include "core/rendering/svg/RenderSVGResource.h"
#include "core/svg/SVGAnimatedPointList.h"
#include "core/svg/SVGElementInstance.h"
#include "core/svg/SVGParserUtilities.h"
namespace WebCore {
SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document)
: SVGGeometryElement(tagName, document)
, m_points(SVGAnimatedPointList::create(this, SVGNames::pointsAttr, SVGPointList::create()))
{
addToPropertyMap(m_points);
}
bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName)
{
DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
if (supportedAttributes.isEmpty()) {
supportedAttributes.add(SVGNames::pointsAttr);
}
return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
}
void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (!isSupportedAttribute(name)) {
SVGGeometryElement::parseAttribute(name, value);
return;
}
if (name == SVGNames::pointsAttr) {
SVGParsingError parseError = NoError;
m_points->setBaseValueAsString(value, parseError);
reportAttributeParsingError(parseError, name, value);
return;
}
ASSERT_NOT_REACHED();
}
void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName)
{
if (!isSupportedAttribute(attrName)) {
SVGGeometryElement::svgAttributeChanged(attrName);
return;
}
SVGElementInstance::InvalidationGuard invalidationGuard(this);
RenderSVGShape* renderer = toRenderSVGShape(this->renderer());
if (!renderer)
return;
if (attrName == SVGNames::pointsAttr) {
renderer->setNeedsShapeUpdate();
RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
return;
}
ASSERT_NOT_REACHED();
}
}