mozilla/pdf.js — pull request #4034 by Snuffleupagus (2013-12-14 22:45:26+00:00)
Title: Fix setScale regression that affects exiting Presentation Mode on narrow window widths

On narrow window widths, the zoom value will not be reset properly when exiting Presentation Mode.
* __Before__ entering Presentation Mode:
![before](https://f.cloud.github.com/assets/2692120/1749369/40c7c092-650f-11e3-9c9c-f3f39e9f8231.png)
* __After__ entering and then exiting Presentation Mode:
![after](https://f.cloud.github.com/assets/2692120/1749371/5316dcec-650f-11e3-8a5a-e9aaec810e83.png)

I have bisected this, and found that this regressed in #3787 (meaning it's my fault).
After looking into this, the only working solution unfortunately seems to be to revert the changes made in #3787. Given that other PRs have touched the `setScale` code in the meantime, just backing out the offending commit isn't possible. Hence I've manually extracted the necessary code into a new function.