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 <wtf/IsoMallocInlines.h>
namespace WebCore {
WTF_MAKE_ISO_ALLOCATED_IMPL(RenderSVGTextPath);
RenderSVGTextPath::RenderSVGTextPath(SVGTextPathElement& element, RenderStyle&& style)
: RenderSVGInline(element, WTFMove(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 path = pathFromGraphicsElement(&pathElement);
path.transform(pathElement.animatedLocalTransform());
return path;
}
float RenderSVGTextPath::startOffset() const
{
return textPathElement().startOffset().valueAsPercentage();
}
bool RenderSVGTextPath::exactAlignment() const
{
return textPathElement().spacing() == SVGTextPathSpacingExact;
}
bool RenderSVGTextPath::stretchMethod() const
{
return textPathElement().method() == SVGTextPathMethodStretch;
}
}