SVGTitleElement.cpp [plain text]
#include "config.h"
#include "SVGTitleElement.h"
#include "Document.h"
#include "SVGNames.h"
namespace WebCore {
inline SVGTitleElement::SVGTitleElement(const QualifiedName& tagName, Document& document)
: SVGElement(tagName, document)
{
ASSERT(hasTagName(SVGNames::titleTag));
}
Ref<SVGTitleElement> SVGTitleElement::create(const QualifiedName& tagName, Document& document)
{
return adoptRef(*new SVGTitleElement(tagName, document));
}
Node::InsertionNotificationRequest SVGTitleElement::insertedInto(ContainerNode& rootParent)
{
SVGElement::insertedInto(rootParent);
if (!rootParent.inDocument())
return InsertionDone;
if (firstChild() && document().isSVGDocument()) {
document().setTitleElement(StringWithDirection(textContent(), LTR), this);
}
return InsertionDone;
}
void SVGTitleElement::removedFrom(ContainerNode& rootParent)
{
SVGElement::removedFrom(rootParent);
if (rootParent.inDocument() && document().isSVGDocument())
document().removeTitle(this);
}
void SVGTitleElement::childrenChanged(const ChildChange& change)
{
SVGElement::childrenChanged(change);
if (inDocument() && document().isSVGDocument()) {
document().setTitleElement(StringWithDirection(textContent(), LTR), this);
}
}
}