path find_innermost_scroll (box b, path p) { // Given a box b and a logical path p, this routine returns // the longest box path sp such that b[sp] is a scroll node path bp; while (true) { bool found= false; bp= b->find_box_path (p, found); if (found) break; p= path_up (p); if (is_nil (p)) return path (); } bp= path_up (bp); path cp, sp; while (!is_nil (bp)) { if (b->get_type () == SCROLL_BOX) sp= reverse (cp); b = b[bp->item]; cp= path (bp->item, cp); bp= bp->next; } if (is_nil (sp)) return sp; else return sp * 0; }