HomePhabricator

PopupWidget: Position anchor relative to popup, not popup relative to anchor

Authored by Catrope on Feb 28 2017, 6:40 PM.

Description

PopupWidget: Position anchor relative to popup, not popup relative to anchor

Also don't use margins to adjust the position for anchor placement and
dodging edges, but instead modify FloatableElement's position calculations
(which have been factored out into a separate method).

What's nice about this approach, though, is that this lets us use
FloatableElement's "before" positioning for backwards popups
(which initially positions them too far away but then corrects for that),
and that the margin corrections on the anchor for e.g. inset icons
on PopupButtonWidgets are now separate from the positioning corrections for
the whole popup, so these adjustments can be applied directly on the anchor
without @noflip and work in RTL.

Bug: T73644
Change-Id: I37f06ae7b81dc79dc3f8507299ca6fbb1b0e3c45