Update thumbnail style only when visible

The method ```getVisibleElements()``` uses a linear search to find the first page and thumbnail in the visible range. It is called on every scroll event, so it can take a noticeable amount of time for the bottom pages of a very large document.
This PR replaces the linear search with a binary one (which needs O(log n) time).

A good test:
[3] [pdf](http://www.etsi.org/deliver/etsi_ts/151000_151099/15101001/10.03.00_60/ts_15101001v100300p.pdf) (5000+ pages)

A benchmark:
Scrolling through pages 5500 to 5515 of [3], using the ```↓``` key, Linux, Firefox Nightly 37.0a1, ```textLayer=off```
Before:
![linearsearch2](https://cloud.githubusercontent.com/assets/4624768/5571239/c6a01f66-8f8e-11e4-91af-b79fc2b00df2.png)
After:
![binarysearch2](https://cloud.githubusercontent.com/assets/4624768/5571240/ca4d0b74-8f8e-11e4-9493-b2de8375a63b.png)

(Admittedly, the document has to be very large to notice a difference, but it should be more pronounced on slow devices).