Fix mw.viewport.isElementInViewport with scrolled page
With a scrolled page the function would return false since it assumed that
getBoundingClientRect returns the offset when in reality it returns the offset
relative to the window viewport.
This implementation keeps the ability to specify custom viewport rects. If we
wanted to just rely on the window viewport the implementation could be changed
with getBoundingClientRect to be much simpler.
Bug: T129466
Change-Id: I56142fbd1177fe47171a1874f73b7a8359c282ee