Fix overlay height in iOS 8

In Safari (iOS 8.02) the virtual keyboard doesn't fire the window.resize
event - the keyboard covers the window (does not push it up) thus the
current way of calculating the keyboard height always yields a
wrong number.

This fix makes sure that the overlay height is only reduced if
the keyboard height is smaller than the window height.
However, since we cannot figure out the virtual keyboard height
(yet?), the bottom of the overlay becomes covered with the
keyboard and some text may not be visible.

Bug: 71725
Change-Id: I450ee2de9f672670135a65b69f15addb11ea1b35
Merge "Fix overlay height in iOS 8"