Use container instead of parent for tooltip/popover auto-placement calcs

Fixes #14561.

CC: @fat for review