RenderSVGTextPath.cpp [plain text]
#include "config.h"
#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(SVGTextPathElement& element, Ref<RenderStyle>&& style)
: RenderSVGInline(element, WTF::move(style))
{
}
SVGTextPathElement& RenderSVGTextPath::textPathElement() const
{
return downcast<SVGTextPathElement>(RenderSVGInline::graphicsElement());
}
Path RenderSVGTextPath::layoutPath() const
{
Element* targetElement = SVGURIReference::targetElementFromIRIString(textPathElement().href(), document());
if (!targetElement || !targetElement->hasTagName(SVGNames::pathTag))
return Path();
SVGPathElement& pathElement = downcast<SVGPathElement>(*targetElement);
Path pathData;
updatePathFromGraphicsElement(&pathElement, pathData);
pathData.transform(pathElement.animatedLocalTransform());
return pathData;
}
float RenderSVGTextPath::startOffset() const
{
return textPathElement().startOffset().valueAsPercentage();
}
bool RenderSVGTextPath::exactAlignment() const
{
return textPathElement().spacing() == SVGTextPathSpacingExact;
}
bool RenderSVGTextPath::stretchMethod() const
{
return textPathElement().method() == SVGTextPathMethodStretch;
}
}