SVGFontFaceFormatElement.cpp [plain text]
#include "config.h"
#if ENABLE(SVG_FONTS)
#include "SVGFontFaceFormatElement.h"
#include "SVGFontFaceElement.h"
#include "SVGNames.h"
namespace WebCore {
using namespace SVGNames;
inline SVGFontFaceFormatElement::SVGFontFaceFormatElement(const QualifiedName& tagName, Document* document)
: SVGElement(tagName, document)
{
ASSERT(hasTagName(font_face_formatTag));
}
PassRefPtr<SVGFontFaceFormatElement> SVGFontFaceFormatElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new SVGFontFaceFormatElement(tagName, document));
}
void SVGFontFaceFormatElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
if (!parentNode() || !parentNode()->hasTagName(font_face_uriTag))
return;
ContainerNode* ancestor = parentNode()->parentNode();
if (!ancestor || !ancestor->hasTagName(font_face_srcTag))
return;
ancestor = ancestor->parentNode();
if (ancestor && ancestor->hasTagName(font_faceTag))
static_cast<SVGFontFaceElement*>(ancestor)->rebuildFontFace();
}
}
#endif // ENABLE(SVG_FONTS)