Fix tooltip positioning with regards to viewports

The getPosition function was simplified with a new function,
getViewportBounds, was added to specifically
tackle the cases where we’re looking for the viewport bounds.

‘absolute’ and ‘fixed’ tooltips are now matched against the screen
where other ones are made to fit inside the viewport element.
I didn't have them at first, but it made the 'test' script complain that the number of whitespaces should be 8 and not 6 (because it was going to the next curly brace)