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 SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start, FloatRect* childRect) { for (InlineBox* child = start->firstChild(); child; child = child->nextOnLine()) { FloatRect boxRect; if (child->isSVGInlineTextBox()) { ASSERT(child->renderer().isSVGInlineText()); SVGInlineTextBox* textBox = toSVGInlineTextBox(child); boxRect = textBox->calculateBoundaries(); textBox->setX(boxRect.x()); textBox->setY(boxRect.y()); textBox->setLogicalWidth(boxRect.width()); textBox->setLogicalHeight(boxRect.height()); } else { // Skip generated content. if (!child->renderer().node()) continue; ASSERT_WITH_SECURITY_IMPLICATION(child->isInlineFlowBox()); SVGInlineFlowBox* flowBox = toSVGInlineFlowBox(child); layoutChildBoxes(flowBox); boxRect = flowBox->calculateBoundaries(); flowBox->setX(boxRect.x()); flowBox->setY(boxRect.y()); flowBox->setLogicalWidth(boxRect.width()); flowBox->setLogicalHeight(boxRect.height()); } if (childRect) childRect->unite(boxRect); } }
void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start) { for (InlineBox* child = start->firstChild(); child; child = child->nextOnLine()) { if (child->isSVGInlineTextBox()) { ASSERT(child->renderer()); ASSERT(child->renderer()->isSVGInlineText()); SVGInlineTextBox* textBox = static_cast<SVGInlineTextBox*>(child); IntRect boxRect = textBox->calculateBoundaries(); textBox->setX(boxRect.x()); textBox->setY(boxRect.y()); textBox->setLogicalWidth(boxRect.width()); textBox->setLogicalHeight(boxRect.height()); } else { ASSERT(child->isInlineFlowBox()); // Skip generated content. if (!child->renderer()->node()) continue; SVGInlineFlowBox* flowBox = static_cast<SVGInlineFlowBox*>(child); layoutChildBoxes(flowBox); IntRect boxRect = flowBox->calculateBoundaries(); flowBox->setX(boxRect.x()); flowBox->setY(boxRect.y()); flowBox->setLogicalWidth(boxRect.width()); flowBox->setLogicalHeight(boxRect.height()); } } }
void SVGRootInlineBox::layoutChildBoxes(InlineFlowBox* start, FloatRect* childRect) { for (InlineBox* child = start->firstChild(); child; child = child->nextOnLine()) { FloatRect boxRect; if (is<SVGInlineTextBox>(*child)) { ASSERT(is<RenderSVGInlineText>(child->renderer())); auto& textBox = downcast<SVGInlineTextBox>(*child); boxRect = textBox.calculateBoundaries(); textBox.setX(boxRect.x()); textBox.setY(boxRect.y()); textBox.setLogicalWidth(boxRect.width()); textBox.setLogicalHeight(boxRect.height()); } else { // Skip generated content. if (!child->renderer().node()) continue; auto& flowBox = downcast<SVGInlineFlowBox>(*child); layoutChildBoxes(&flowBox); boxRect = flowBox.calculateBoundaries(); flowBox.setX(boxRect.x()); flowBox.setY(boxRect.y()); flowBox.setLogicalWidth(boxRect.width()); flowBox.setLogicalHeight(boxRect.height()); } if (childRect) childRect->unite(boxRect); } }
void SVGRootInlineBox::computePerCharacterLayoutInformation() { // Perform SVG text layout phase two (see SVGTextLayoutEngine for details). SVGTextLayoutEngine characterLayout; 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. layoutChildBoxes(this); layoutRootBox(); }