Revert "Popup: Moving function fitSegmentInsideSegment into the popup prototype."

This reverts commit 01b35afb2c2201bb441a7a4adadd225679fb75e9.
Revert "Popup: Factor our width constraint code for reuse."

This reverts commit 3636c70ffd1e168c6a087420273cbb3556e514ef.