Take elements outline into account

/cc @arikon @unlok