This source file includes following definitions.
- SVGURIReference
- create
- setGlyphRef
- glyphRef
- setFormat
- format
- createRenderer
- hasValidGlyphElements
#include "config.h"
#if ENABLE(SVG_FONTS)
#include "core/svg/SVGAltGlyphElement.h"
#include "SVGNames.h"
#include "XLinkNames.h"
#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
#include "core/dom/ExceptionCode.h"
#include "core/rendering/svg/RenderSVGTSpan.h"
#include "core/svg/SVGAltGlyphDefElement.h"
namespace WebCore {
inline SVGAltGlyphElement::SVGAltGlyphElement(Document& document)
: SVGTextPositioningElement(SVGNames::altGlyphTag, document)
, SVGURIReference(this)
{
ScriptWrappable::init(this);
}
PassRefPtr<SVGAltGlyphElement> SVGAltGlyphElement::create(Document& document)
{
return adoptRef(new SVGAltGlyphElement(document));
}
void SVGAltGlyphElement::setGlyphRef(const AtomicString&, ExceptionState& exceptionState)
{
exceptionState.throwDOMException(NoModificationAllowedError, ExceptionMessages::readOnly());
}
const AtomicString& SVGAltGlyphElement::glyphRef() const
{
return fastGetAttribute(SVGNames::glyphRefAttr);
}
void SVGAltGlyphElement::setFormat(const AtomicString&, ExceptionState& exceptionState)
{
exceptionState.throwDOMException(NoModificationAllowedError, ExceptionMessages::readOnly());
}
const AtomicString& SVGAltGlyphElement::format() const
{
return fastGetAttribute(SVGNames::formatAttr);
}
RenderObject* SVGAltGlyphElement::createRenderer(RenderStyle*)
{
return new RenderSVGTSpan(this);
}
bool SVGAltGlyphElement::hasValidGlyphElements(Vector<AtomicString>& glyphNames) const
{
AtomicString target;
Element* element = targetElementFromIRIString(getAttribute(XLinkNames::hrefAttr), document(), &target);
if (!element)
return false;
if (isSVGGlyphElement(*element)) {
glyphNames.append(target);
return true;
}
if (isSVGAltGlyphDefElement(*element) && toSVGAltGlyphDefElement(*element).hasValidGlyphElements(glyphNames))
return true;
return false;
}
}
#endif