Calculate the width and height of node