RenderSVGTextPath.cpp [plain text]
#include "config.h"
#if ENABLE(SVG)
#include "RenderSVGTextPath.h"
#include "FloatQuad.h"
#include "RenderBlock.h"
#include "SVGInlineTextBox.h"
#include "SVGNames.h"
#include "SVGPathData.h"
#include "SVGPathElement.h"
#include "SVGRootInlineBox.h"
#include "SVGTextPathElement.h"
#include "SVGTransformList.h"
namespace WebCore {
RenderSVGTextPath::RenderSVGTextPath(Node* n)
: RenderSVGInline(n)
, m_startOffset(0)
, m_exactAlignment(true)
, m_stretchMethod(false)
{
}
Path RenderSVGTextPath::layoutPath() const
{
SVGTextPathElement* textPathElement = static_cast<SVGTextPathElement*>(node());
Element* targetElement = SVGURIReference::targetElementFromIRIString(textPathElement->href(), textPathElement->document());
if (!targetElement || !targetElement->hasTagName(SVGNames::pathTag))
return Path();
SVGPathElement* pathElement = static_cast<SVGPathElement*>(targetElement);
Path pathData;
updatePathFromGraphicsElement(pathElement, pathData);
pathData.transform(pathElement->animatedLocalTransform());
return pathData;
}
float RenderSVGTextPath::startOffset() const
{
return static_cast<SVGTextPathElement*>(node())->startOffset().valueAsPercentage();
}
bool RenderSVGTextPath::exactAlignment() const
{
return static_cast<SVGTextPathElement*>(node())->spacing() == SVGTextPathSpacingExact;
}
bool RenderSVGTextPath::stretchMethod() const
{
return static_cast<SVGTextPathElement*>(node())->method() == SVGTextPathMethodStretch;
}
}
#endif // ENABLE(SVG)