InlineBox* InlineBox::prevLeafChild() const { InlineBox* leaf = 0; for (InlineBox* box = prevOnLine(); box && !leaf; box = box->prevOnLine()) leaf = box->isLeaf() ? box : toInlineFlowBox(box)->lastLeafChild(); if (!leaf && parent()) leaf = parent()->prevLeafChild(); return leaf; }
InlineBox* InlineBox::nextLeafChild() const { InlineBox* leaf = 0; for (InlineBox* box = nextOnLine(); box && !leaf; box = box->nextOnLine()) leaf = box->isLeaf() ? box : toInlineFlowBox(box)->firstLeafChild(); if (!leaf && parent()) leaf = parent()->nextLeafChild(); return leaf; }