Sheet style: optimize getting styles for a range.

Add fast pre-optimization to bring down the number of entries before
we start messing with hashes.  Fixes #699045.