Viewport: better estimate ios viewport size with keyboard.

Refs #310 and #318.