improve size calc (consider padding and border)