Refactor in FindBoundary to allow easier skipping of leaves in the loop. Differential Revision: https://phabricator.services.mozilla.com/D168445