Port totalHeight() to v3 branch