+2015-03-31 Timothy Horton <timothy_horton@apple.com>
+
+ [iOS] Rotating PDF in Safari scrolls to the wrong position
+ https://bugs.webkit.org/show_bug.cgi?id=143259
+ <rdar://problem/19872693>
+
+ Reviewed by Dan Bernstein.
+
+ * UIProcess/ios/WKPDFView.mm:
+ (-[WKPDFView web_setMinimumSize:]):
+ Maintan the relative top/left within the rescaled document.
+
2015-03-31 Chris Dumez <cdumez@apple.com>
[WK2][iOS] Extend ProcessThrottler use to the NetworkProcess
{
_minimumSize = size;
+ CGFloat oldDocumentLeftFraction = 0;
+ CGFloat oldDocumentTopFraction = 0;
+ CGSize contentSize = _scrollView.contentSize;
+ if (contentSize.width && contentSize.height) {
+ CGPoint contentOffset = _scrollView.contentOffset;
+ UIEdgeInsets contentInset = _scrollView.contentInset;
+ oldDocumentLeftFraction = (contentOffset.x + contentInset.left) / contentSize.width;
+ oldDocumentTopFraction = (contentOffset.y + contentInset.top) / contentSize.height;
+ }
+
[self _computePageAndDocumentFrames];
- [self _revalidateViews];
+
+ // FIXME: This dispatch_async is unnecessary except to work around rdar://problem/15035620.
+ // Once that is resolved, we should do the setContentOffset without the dispatch_async.
+ RetainPtr<WKPDFView> retainedSelf = self;
+ dispatch_async(dispatch_get_main_queue(), [retainedSelf, oldDocumentLeftFraction, oldDocumentTopFraction] {
+ CGSize contentSize = retainedSelf->_scrollView.contentSize;
+ UIEdgeInsets contentInset = retainedSelf->_scrollView.contentInset;
+ [retainedSelf->_scrollView setContentOffset:CGPointMake((oldDocumentLeftFraction * contentSize.width) - contentInset.left, (oldDocumentTopFraction * contentSize.height) - contentInset.top) animated:NO];
+
+ [retainedSelf _revalidateViews];
+ });
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView