SVGTitleElement.cpp [plain text]
#include "config.h"
#if ENABLE(SVG)
#include "SVGTitleElement.h"
#include "Document.h"
#include "SVGNames.h"
namespace WebCore {
inline SVGTitleElement::SVGTitleElement(const QualifiedName& tagName, Document* document)
: SVGStyledElement(tagName, document)
{
ASSERT(hasTagName(SVGNames::titleTag));
}
PassRefPtr<SVGTitleElement> SVGTitleElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new SVGTitleElement(tagName, document));
}
Node::InsertionNotificationRequest SVGTitleElement::insertedInto(Node* rootParent)
{
SVGStyledElement::insertedInto(rootParent);
if (!rootParent->inDocument())
return InsertionDone;
if (firstChild())
document()->setTitleElement(StringWithDirection(textContent(), LTR), this);
return InsertionDone;
}
void SVGTitleElement::removedFrom(Node* rootParent)
{
SVGElement::removedFrom(rootParent);
if (rootParent->inDocument())
document()->removeTitle(this);
}
void SVGTitleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
if (inDocument())
document()->setTitleElement(StringWithDirection(textContent(), LTR), this);
}
}
#endif // ENABLE(SVG)