Prevent text selection divs from overflowing page boundries

This fixes [bug 837462](https://bugzilla.mozilla.org/show_bug.cgi?id=837462).
Unfortunately this fix "breaks" text selection and search in some documents (from what I've seen mostly PDFs in Asian languages), but this should be fixed when the font support in pdf.js improves further.