Position tooltips in the visible area (#15129).

Based on Mika's reverted patch, with additional fix and test for
regression "an empty tooltip appears while the application is
initializing".

Change-Id: I8237fc9340265708a05a7576a5d9e8e374dc1fea