SVGStopElement.cpp [plain text]
#include "config.h"
#if SVG_SUPPORT
#include "Attr.h"
#include "Document.h"
#include <kcanvas/device/KRenderingPaintServerGradient.h>
#include "SVGNames.h"
#include "SVGHelper.h"
#include "SVGRenderStyle.h"
#include "SVGStopElement.h"
#include "SVGAnimatedNumber.h"
#include "SVGDOMImplementation.h"
using namespace WebCore;
SVGStopElement::SVGStopElement(const QualifiedName& tagName, Document *doc) : SVGStyledElement(tagName, doc)
{
}
SVGStopElement::~SVGStopElement()
{
}
SVGAnimatedNumber *SVGStopElement::offset() const
{
return lazy_create<SVGAnimatedNumber>(m_offset, this);
}
void SVGStopElement::parseMappedAttribute(MappedAttribute *attr)
{
const String& value = attr->value();
if (attr->name() == SVGNames::offsetAttr) {
if(value.endsWith("%"))
offset()->setBaseVal(value.deprecatedString().left(value.length() - 1).toDouble() / 100.);
else
offset()->setBaseVal(value.deprecatedString().toDouble());
} else
SVGStyledElement::parseMappedAttribute(attr);
if (!ownerDocument()->parsing() && attached()) {
recalcStyle(Force);
SVGStyledElement *parentStyled = static_cast<SVGStyledElement *>(parentNode());
if(parentStyled)
parentStyled->notifyAttributeChange();
}
}
#endif // SVG_SUPPORT