static inline bool findPreviousAndNextAttributes(LayoutSVGText* root, LayoutSVGInlineText* locateElement, SVGTextLayoutAttributes*& previous, SVGTextLayoutAttributes*& next) { ASSERT(root); ASSERT(locateElement); bool stopAfterNext = false; LayoutObject* current = root->firstChild(); while (current) { if (current->isSVGInlineText()) { LayoutSVGInlineText* text = toLayoutSVGInlineText(current); if (locateElement != text) { if (stopAfterNext) { next = text->layoutAttributes(); return true; } previous = text->layoutAttributes(); } else { stopAfterNext = true; } } else if (current->isSVGInline()) { // Descend into text content (if possible). if (LayoutObject* child = toLayoutSVGInline(current)->firstChild()) { current = child; continue; } } current = current->nextInPreOrderAfterChildren(root); } return false; }
static void walkTree(LayoutSVGText* start, LayoutSVGInlineText* stopAtLeaf, MeasureTextData* data) { LayoutObject* child = start->firstChild(); while (child) { if (child->isSVGInlineText()) { LayoutSVGInlineText* text = toLayoutSVGInlineText(child); measureTextLayoutObject(text, data, !stopAtLeaf || stopAtLeaf == text); if (stopAtLeaf && stopAtLeaf == text) return; } else if (child->isSVGInline()) { // Visit children of text content elements. if (LayoutObject* inlineChild = toLayoutSVGInline(child)->firstChild()) { child = inlineChild; continue; } } child = child->nextInPreOrderAfterChildren(start); } }