PopupWidget: Make popups able to actually pop *up*, as well as sideways
Set config.position to 'above' to pop up, or to 'before' or 'after' to pop sideways.
config.align, as before, controls where the popup is positioned relative to the anchor.
If config.position is 'above' or 'below', the popup anchor points to the start edge
of $floatableContainer, as before; if it's 'before' or 'after', the anchor points
to the center of $floatableContainer.
PopupWidget.js:
- Add position setting
- Add anchor edge setting, and clean up this.anchor / this.anchored confusion
- Reword the positioning computations using near/far instead of left/right so they can be used for vertical as well as horizontal positioning and anchor alignment (needed if the anchor is on the left or right edge)
PopupWidget.less:
- Move some non-theme specific anchor styles here
- Add skeleton anchor styles for anchors on all four sides
{mediawiki,apex}/{widgets,tools}.less:
- Write anchor styles more concisely, and add styles for bottom/start/end anchors
- Only apply anchor margins when the anchor is on the top/bottom
Bug: T114612
Change-Id: I6f2d03ac83aa415fb28715c83337ce6c093c3ecd