This source file includes following definitions.
- isChildAllowed
- layoutPath
- startOffset
#include "config.h"
#include "core/rendering/svg/RenderSVGTextPath.h"
#include "SVGNames.h"
#include "core/rendering/svg/SVGPathData.h"
#include "core/rendering/svg/SVGRenderSupport.h"
#include "core/svg/SVGPathElement.h"
#include "core/svg/SVGTextPathElement.h"
namespace WebCore {
RenderSVGTextPath::RenderSVGTextPath(Element* element)
: RenderSVGInline(element)
{
}
bool RenderSVGTextPath::isChildAllowed(RenderObject* child, RenderStyle*) const
{
if (child->isText())
return SVGRenderSupport::isRenderableTextNode(child);
#if ENABLE(SVG_FONTS)
ASSERT(child->node());
if (isSVGAltGlyphElement(*child->node()))
return false;
#endif
return child->isSVGInline() && !child->isSVGTextPath();
}
Path RenderSVGTextPath::layoutPath() const
{
SVGTextPathElement* textPathElement = toSVGTextPathElement(node());
Element* targetElement = SVGURIReference::targetElementFromIRIString(textPathElement->href()->currentValue()->value(), textPathElement->document());
if (!isSVGPathElement(targetElement))
return Path();
SVGPathElement& pathElement = toSVGPathElement(*targetElement);
Path pathData;
updatePathFromGraphicsElement(&pathElement, pathData);
pathData.transform(pathElement.animatedLocalTransform());
return pathData;
}
float RenderSVGTextPath::startOffset() const
{
return toSVGTextPathElement(node())->startOffset()->currentValue()->valueAsPercentage();
}
}