SVGTextContentElement.cpp [plain text]
#include "config.h"
#if ENABLE(SVG)
#include "SVGTextContentElement.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "FloatPoint.h"
#include "FloatRect.h"
#include "SVGLength.h"
#include "SVGNames.h"
#include "XMLNames.h"
namespace WebCore {
SVGTextContentElement::SVGTextContentElement(const QualifiedName& tagName, Document* doc)
: SVGStyledElement(tagName, doc)
, SVGTests()
, SVGLangSpace()
, SVGExternalResourcesRequired()
, m_textLength(this, LengthModeWidth)
, m_lengthAdjust(0)
{
}
SVGTextContentElement::~SVGTextContentElement()
{
}
ANIMATED_PROPERTY_DEFINITIONS(SVGTextContentElement, SVGLength, Length, length, TextLength, textLength, SVGNames::textLengthAttr.localName(), m_textLength)
ANIMATED_PROPERTY_DEFINITIONS(SVGTextContentElement, int, Enumeration, enumeration, LengthAdjust, lengthAdjust, SVGNames::lengthAdjustAttr.localName(), m_lengthAdjust)
long SVGTextContentElement::getNumberOfChars() const
{
return 0;
}
float SVGTextContentElement::getComputedTextLength() const
{
return 0.0f;
}
float SVGTextContentElement::getSubStringLength(unsigned long charnum, unsigned long nchars, ExceptionCode&) const
{
return 0.0f;
}
FloatPoint SVGTextContentElement::getStartPositionOfChar(unsigned long charnum, ExceptionCode&) const
{
return FloatPoint();
}
FloatPoint SVGTextContentElement::getEndPositionOfChar(unsigned long charnum, ExceptionCode&) const
{
return FloatPoint();
}
FloatRect SVGTextContentElement::getExtentOfChar(unsigned long charnum, ExceptionCode&) const
{
return FloatRect();
}
float SVGTextContentElement::getRotationOfChar(unsigned long charnum, ExceptionCode&) const
{
return 0.0f;
}
long SVGTextContentElement::getCharNumAtPosition(const FloatPoint& point) const
{
return 0;
}
void SVGTextContentElement::selectSubString(unsigned long charnum, unsigned long nchars, ExceptionCode&) const
{
}
void SVGTextContentElement::parseMappedAttribute(MappedAttribute* attr)
{
if (attr->name() == SVGNames::textLengthAttr) {
setTextLengthBaseValue(SVGLength(this, LengthModeOther, attr->value()));
if (textLength().value() < 0.0)
document()->accessSVGExtensions()->reportError("A negative value for text attribute <textLength> is not allowed");
} else {
if (SVGTests::parseMappedAttribute(attr))
return;
if (SVGLangSpace::parseMappedAttribute(attr)) {
if (attr->name().matches(XMLNames::spaceAttr)) {
static const AtomicString preserveString("preserve");
if (attr->value() == preserveString)
addCSSProperty(attr, CSS_PROP_WHITE_SPACE, CSS_VAL_PRE);
else
addCSSProperty(attr, CSS_PROP_WHITE_SPACE, CSS_VAL_NOWRAP);
}
return;
}
if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
return;
SVGStyledElement::parseMappedAttribute(attr);
}
}
}
#endif // ENABLE(SVG)