Fix a second infinite loop in CSSUtils.findSelectorAtDocumentPos(), caused
by cleanups in the fix for the earlier infinite loop bug. To keep loop
exit condition more precisely in sync with TokenUtils's logic for when to
stop advancing, create new TokenUtils methods for checking if at a stopping
point.
Code review: add formal type annotations. Fix a bunch of older incorrect
type annotations while I'm at it.
Merge pull request #9295 from adobe/pflynn/cssutil-infinite-loop2

Fix a second infinite loop in CSSUtils.findSelectorAtDocumentPos()