Failing test and fix for bug in [UIScrollView scrollViewToVisible:animated:]

The symptom I experienced was that, when trying to tap on a button that was partially outside the bounds of the scroll view, the scroll view would mistakenly scroll the button completely offscreen - leaving it untappable.

The algorithm previously converted all coordinates to be relative to the window so that they could be compared consistently. That seems correct. However, I saw two problems in the code. First, the calculation of the new x and y content offset values seemed wrong. Second, that offset then went through another conversion from window -> view coordinates - which seemed wrong to me.

I added a failing UI test that you can check out.
It's possible that my fix may have regressed some scenario that the original author had in mind, but it did fix my new UI test and did not introduce failures into any of the preexisting tests.