Fix context menu position for small inline nodes

The context menu was being positioned incorrectly for small inline
nodes, such as references or small templates. This fix moves the context
to the bottom, as well as placing it on the right or left in LTR and RTL
directions respectively.

Change-Id: I55de2a6464d0544e32118bf95dbb85c33354f025
Merge "Fix context menu position for small inline nodes"