Fix margin bug.

Getting the direction of margins should be based on the direction of the
component's parent, not its children.