This source file includes following definitions.
- SVGFitToViewBox
- create
- isSupportedAttribute
- parseAttribute
- svgAttributeChanged
- selfHasRelativeLengths
- createRenderer
#include "config.h"
#include "core/svg/SVGSymbolElement.h"
#include "SVGNames.h"
#include "core/rendering/svg/RenderSVGHiddenContainer.h"
#include "core/svg/SVGElementInstance.h"
namespace WebCore {
inline SVGSymbolElement::SVGSymbolElement(Document& document)
: SVGElement(SVGNames::symbolTag, document)
, SVGFitToViewBox(this)
{
ScriptWrappable::init(this);
}
PassRefPtr<SVGSymbolElement> SVGSymbolElement::create(Document& document)
{
return adoptRef(new SVGSymbolElement(document));
}
bool SVGSymbolElement::isSupportedAttribute(const QualifiedName& attrName)
{
DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
if (supportedAttributes.isEmpty())
SVGFitToViewBox::addSupportedAttributes(supportedAttributes);
return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
}
void SVGSymbolElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (!isSupportedAttribute(name)) {
SVGElement::parseAttribute(name, value);
return;
}
SVGParsingError parseError = NoError;
if (SVGFitToViewBox::parseAttribute(name, value, document(), parseError)) {
} else {
ASSERT_NOT_REACHED();
}
reportAttributeParsingError(parseError, name, value);
}
void SVGSymbolElement::svgAttributeChanged(const QualifiedName& attrName)
{
if (!isSupportedAttribute(attrName)) {
SVGElement::svgAttributeChanged(attrName);
return;
}
SVGElementInstance::InvalidationGuard invalidationGuard(this);
if (attrName == SVGNames::viewBoxAttr)
updateRelativeLengthsInformation();
}
bool SVGSymbolElement::selfHasRelativeLengths() const
{
return hasAttribute(SVGNames::viewBoxAttr);
}
RenderObject* SVGSymbolElement::createRenderer(RenderStyle*)
{
return new RenderSVGHiddenContainer(this);
}
}