// Execute a query in "spatial" order starting at |queryRoot|. This means // walking the lines boxes in the order they would get painted. static void spatialQuery(LayoutObject* queryRoot, QueryData* queryData, ProcessTextFragmentCallback fragmentCallback) { Vector<SVGInlineTextBox*> textBoxes; collectTextBoxesInFlowBox(flowBoxForLayoutObject(queryRoot), textBoxes); // Loop over all text boxes for (const SVGInlineTextBox* textBox : textBoxes) { if (queryTextBox(queryData, textBox, fragmentCallback)) return; } }
void SVGTextQuery::collectTextBoxesInFlowBox(InlineFlowBox* flowBox) { if (!flowBox) return; for (InlineBox* child = flowBox->firstChild(); child; child = child->nextOnLine()) { if (child->isInlineFlowBox()) { // Skip generated content. if (!child->renderer()->node()) continue; collectTextBoxesInFlowBox(toInlineFlowBox(child)); continue; } if (child->isSVGInlineTextBox()) m_textBoxes.append(toSVGInlineTextBox(child)); } }
static void collectTextBoxesInFlowBox(InlineFlowBox* flowBox, Vector<SVGInlineTextBox*>& textBoxes) { if (!flowBox) return; for (InlineBox* child = flowBox->firstChild(); child; child = child->nextOnLine()) { if (child->isInlineFlowBox()) { // Skip generated content. if (!child->layoutObject().node()) continue; collectTextBoxesInFlowBox(toInlineFlowBox(child), textBoxes); continue; } if (child->isSVGInlineTextBox()) textBoxes.append(toSVGInlineTextBox(child)); } }
SVGTextQuery::SVGTextQuery(RenderObject* renderer) { collectTextBoxesInFlowBox(flowBoxForRenderer(renderer)); }