Smarter setting of the "gravity" of tooltips
This adjusts the position of the tooltip depending on what is the
position of the related revision bar in the plot, and on the
size of the contents of the tooltip.
Among other things this makes the tooltip be displayed below
the revision plot if the tooltip would not be entirely visible
if it was displayed above the plot.
Also now it is checked if there is enough space on the left and right
side of the browser window to display the tooltip centered horizontally.
If not, this adjusts the horizontal position of the tooltip so that
it does not get shown outside of the window.
The latter in particular improves displaying of longer edit
summaries in RTL mode. Apparently LTR-centered browsers took care
of not showing the tooltip outside the right edge of the window
but in the case of left edge the tooltip could run outside of the window
leaving a part of summary not visible to the user without scrolling.