void SVGRootInlineBox::computePerCharacterLayoutInformation() { RenderSVGText* textRoot = toRenderSVGText(&blockFlow()); ASSERT(textRoot); Vector<SVGTextLayoutAttributes*>& layoutAttributes = textRoot->layoutAttributes(); if (layoutAttributes.isEmpty()) return; if (textRoot->needsReordering()) reorderValueLists(layoutAttributes); // Perform SVG text layout phase two (see SVGTextLayoutEngine for details). SVGTextLayoutEngine characterLayout(layoutAttributes); layoutCharactersInTextBoxes(this, characterLayout); // Perform SVG text layout phase three (see SVGTextChunkBuilder for details). characterLayout.finishLayout(); // Perform SVG text layout phase four // Position & resize all SVGInlineText/FlowBoxes in the inline box tree, resize the root box as well as the RenderSVGText parent block. FloatRect childRect; layoutChildBoxes(this, &childRect); layoutRootBox(childRect); }
void RenderSVGInline::removeChild(RenderObject* child) { RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor(this); if (!textRenderer) { RenderInline::removeChild(child); return; } Vector<SVGTextLayoutAttributes*, 2> affectedAttributes; textRenderer->subtreeChildWillBeRemoved(child, affectedAttributes); RenderInline::removeChild(child); textRenderer->subtreeChildWasRemoved(affectedAttributes); }
static void writeRenderSVGTextBox(TextStream& ts, const RenderSVGText& text) { SVGRootInlineBox* box = toSVGRootInlineBox(text.firstRootBox()); if (!box) return; ts << " " << enclosingIntRect(FloatRect(text.location(), FloatSize(box->logicalWidth(), box->logicalHeight()))); // FIXME: Remove this hack, once the new text layout engine is completly landed. We want to preserve the old layout test results for now. ts << " contains 1 chunk(s)"; if (text.parent() && (text.parent()->style()->visitedDependentColor(CSSPropertyColor) != text.style()->visitedDependentColor(CSSPropertyColor))) writeNameValuePair(ts, "color", text.resolveColor(CSSPropertyColor).nameForRenderTreeAsText()); }
void write(TextStream& ts, const RenderSVGText& text, int indent) { writeIndent(ts, indent); ts << text.renderName(); if (text.element()) { String tagName = getTagName(static_cast<SVGStyledElement*>(text.element())); if (!tagName.isEmpty()) ts << " {" << tagName << "}"; } ts << text << "\n"; for (RenderObject* child = text.firstChild(); child; child = child->nextSibling()) write(ts, *child, indent + 1); }
static inline SVGRootInlineBox* rootInlineBoxForTextContentElement(const SVGTextContentElement* element) { RenderObject* object = element->renderer(); if (!object || !object->isSVGText() || object->isText()) return 0; RenderSVGText* svgText = static_cast<RenderSVGText*>(object); // Find root inline box SVGRootInlineBox* rootBox = static_cast<SVGRootInlineBox*>(svgText->firstRootBox()); if (!rootBox) { // Layout is not sync yet! element->document()->updateLayoutIgnorePendingStylesheets(); rootBox = static_cast<SVGRootInlineBox*>(svgText->firstRootBox()); } ASSERT(rootBox); return rootBox; }
static inline void updatePositioningValuesInRenderer(RenderObject* renderer) { RenderSVGText* textRenderer = 0; if (renderer->isSVGText()) textRenderer = toRenderSVGText(renderer); else { // Locate RenderSVGText parent renderer. RenderObject* parent = renderer->parent(); while (parent && !parent->isSVGText()) parent = parent->parent(); if (parent) { ASSERT(parent->isSVGText()); textRenderer = toRenderSVGText(parent); } } if (!textRenderer) return; textRenderer->setNeedsPositioningValuesUpdate(); }