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; }
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; }
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); }
float RenderSVGTextPath::startOffset() const { return toSVGTextPathElement(node())->startOffset()->currentValue()->valueAsPercentage(); }
SVGTextPathElement& RenderSVGTextPath::textPathElement() const { return toSVGTextPathElement(RenderSVGInline::graphicsElement()); }
bool RenderSVGTextPath::stretchMethod() const { return toSVGTextPathElement(element())->method() == SVGTextPathMethodStretch; }
bool RenderSVGTextPath::exactAlignment() const { return toSVGTextPathElement(element())->spacing() == SVGTextPathSpacingExact; }
float RenderSVGTextPath::startOffset() const { return toSVGTextPathElement(element())->startOffset().valueAsPercentage(); }