float LayoutSVGTextPath::calculateStartOffset(float pathLength) const
{
    const SVGLength& startOffset = *toSVGTextPathElement(node())->startOffset()->currentValue();
    float textPathStartOffset = startOffset.valueAsPercentage();
    if (startOffset.typeWithCalcResolved() == CSSPrimitiveValue::UnitType::Percentage)
        textPathStartOffset *= pathLength;

    return textPathStartOffset;
}
예제 #2
0
Path LayoutSVGTextPath::layoutPath() const
{
    SVGTextPathElement* textPathElement = toSVGTextPathElement(node());
    Element* targetElement = SVGURIReference::targetElementFromIRIString(textPathElement->href()->currentValue()->value(), textPathElement->treeScope());
    if (!isSVGPathElement(targetElement))
        return Path();

    SVGPathElement& pathElement = toSVGPathElement(*targetElement);
    Path pathData = pathElement.asPath();

    // Spec:  The transform attribute on the referenced 'path' element represents a
    // supplemental transformation relative to the current user coordinate system for
    // the current 'text' element, including any adjustments to the current user coordinate
    // system due to a possible transform attribute on the current 'text' element.
    // http://www.w3.org/TR/SVG/text.html#TextPathElement
    pathData.transform(pathElement.calculateAnimatedLocalTransform());
    return pathData;
}
예제 #3
0
Path RenderSVGTextPath::layoutPath() const
{
    SVGTextPathElement* textPathElement = toSVGTextPathElement(element());
    Element* targetElement = SVGURIReference::targetElementFromIRIString(textPathElement->href(), &textPathElement->document());
    if (!targetElement || !targetElement->hasTagName(SVGNames::pathTag))
        return Path();
    
    SVGPathElement* pathElement = toSVGPathElement(targetElement);
    
    Path pathData;
    updatePathFromGraphicsElement(pathElement, pathData);

    // Spec:  The transform attribute on the referenced 'path' element represents a
    // supplemental transformation relative to the current user coordinate system for
    // the current 'text' element, including any adjustments to the current user coordinate
    // system due to a possible transform attribute on the current 'text' element.
    // http://www.w3.org/TR/SVG/text.html#TextPathElement
    pathData.transform(pathElement->animatedLocalTransform());
    return pathData;
}
std::unique_ptr<PathPositionMapper> LayoutSVGTextPath::layoutPath() const
{
    const SVGTextPathElement& textPathElement = toSVGTextPathElement(*node());
    Element* targetElement = SVGURIReference::targetElementFromIRIString(
        textPathElement.hrefString(), treeScopeForIdResolution(textPathElement));

    if (!isSVGPathElement(targetElement))
        return nullptr;

    SVGPathElement& pathElement = toSVGPathElement(*targetElement);
    Path pathData = pathElement.asPath();
    if (pathData.isEmpty())
        return nullptr;

    // Spec:  The transform attribute on the referenced 'path' element represents a
    // supplemental transformation relative to the current user coordinate system for
    // the current 'text' element, including any adjustments to the current user coordinate
    // system due to a possible transform attribute on the current 'text' element.
    // http://www.w3.org/TR/SVG/text.html#TextPathElement
    pathData.transform(pathElement.calculateAnimatedLocalTransform());

    return PathPositionMapper::create(pathData);
}
예제 #5
0
float RenderSVGTextPath::startOffset() const
{
    return toSVGTextPathElement(node())->startOffset()->currentValue()->valueAsPercentage();
}
예제 #6
0
SVGTextPathElement& RenderSVGTextPath::textPathElement() const
{
    return toSVGTextPathElement(RenderSVGInline::graphicsElement());
}
예제 #7
0
bool RenderSVGTextPath::stretchMethod() const
{
    return toSVGTextPathElement(element())->method() == SVGTextPathMethodStretch;
}
예제 #8
0
bool RenderSVGTextPath::exactAlignment() const
{
    return toSVGTextPathElement(element())->spacing() == SVGTextPathSpacingExact;
}
예제 #9
0
float RenderSVGTextPath::startOffset() const
{
    return toSVGTextPathElement(element())->startOffset().valueAsPercentage();
}