refactor some positioning/viewport calculations

1) don't recalculate the viewport size in `onViewportResized` in Dialog, take it from event data
2) round to full pixels in `utils.Dom.calculatePosition` (`getBoundingClientRect` returns floats)