void SVGRootInlineBox::layoutCharactersInTextBoxes(InlineFlowBox* start, SVGTextLayoutEngine& characterLayout) { for (InlineBox* child = start->firstChild(); child; child = child->nextOnLine()) { if (child->isSVGInlineTextBox()) { ASSERT(child->renderer().isSVGInlineText()); characterLayout.layoutInlineTextBox(toSVGInlineTextBox(child)); } else { // Skip generated content. Node* node = child->renderer().node(); if (!node) continue; SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child); bool isTextPath = isSVGTextPathElement(*node); if (isTextPath) { // Build text chunks for all <textPath> children, using the line layout algorithm. // This is needeed as text-anchor is just an additional startOffset for text paths. SVGTextLayoutEngine lineLayout(characterLayout.layoutAttributes()); layoutCharactersInTextBoxes(flowBox, lineLayout); characterLayout.beginTextPathLayout(&child->renderer(), lineLayout); } layoutCharactersInTextBoxes(flowBox, characterLayout); if (isTextPath) characterLayout.endTextPathLayout(); } } }
void SVGTextLayoutEngine::layoutCharactersInTextBoxes(InlineFlowBox* start) { bool textLengthSpacingInEffect = m_textLengthSpacingInEffect || definesTextLengthWithSpacing(start); TemporaryChange<bool> textLengthSpacingScope(m_textLengthSpacingInEffect, textLengthSpacingInEffect); for (InlineBox* child = start->firstChild(); child; child = child->nextOnLine()) { if (child->isSVGInlineTextBox()) { ASSERT(child->layoutObject().isSVGInlineText()); layoutInlineTextBox(toSVGInlineTextBox(child)); } else { // Skip generated content. Node* node = child->layoutObject().node(); if (!node) continue; SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child); bool isTextPath = isSVGTextPathElement(*node); if (isTextPath) beginTextPathLayout(flowBox); layoutCharactersInTextBoxes(flowBox); if (isTextPath) endTextPathLayout(); } } }
bool SVGTSpanElement::rendererIsNeeded(const RenderStyle& style) { if (parentNode() && (isSVGAElement(*parentNode()) #if ENABLE(SVG_FONTS) || isSVGAltGlyphElement(*parentNode()) #endif || isSVGTextElement(*parentNode()) || isSVGTextPathElement(*parentNode()) || isSVGTSpanElement(*parentNode()))) return Element::rendererIsNeeded(style); return false; }