return CGSizeMake(floorToDevicePixel(contentSize.width, deviceScaleFactor), floorToDevicePixel(contentSize.height, deviceScaleFactor));
}
+- (UIView *)_currentContentView
+{
+ return _customContentView ? _customContentView.get() : _contentView.get();
+}
+
- (void)_setHasCustomContentView:(BOOL)pageHasCustomContentView loadedMIMEType:(const WTF::String&)mimeType
{
if (pageHasCustomContentView) {
static CGFloat contentZoomScale(WKWebView* webView)
{
- UIView *zoomView;
- if (webView->_customContentView)
- zoomView = webView->_customContentView.get();
- else
- zoomView = webView->_contentView.get();
-
- CGFloat scale = [[zoomView layer] affineTransform].a;
+ CGFloat scale = [[webView._currentContentView layer] affineTransform].a;
ASSERT(scale == [webView->_scrollView zoomScale]);
return scale;
}
{
// FIMXE: Some of this could be shared with _scrollToRect.
const double visibleRectScaleChange = contentZoomScale(self) / scale;
- const WebCore::FloatRect visibleRect([self convertRect:self.bounds toView:_contentView.get()]);
+ const WebCore::FloatRect visibleRect([self convertRect:self.bounds toView:self._currentContentView]);
const WebCore::FloatRect unobscuredRect([self _contentRectForUserInteraction]);
const WebCore::FloatSize topLeftObscuredInsetAfterZoom((unobscuredRect.minXMinYCorner() - visibleRect.minXMinYCorner()) * visibleRectScaleChange);
{
WebCore::FloatRect unobscuredContentRect([self _contentRectForUserInteraction]);
WebCore::FloatPoint unobscuredContentOffset = unobscuredContentRect.location();
- WebCore::FloatSize contentSize([_contentView bounds].size);
+ WebCore::FloatSize contentSize([self._currentContentView bounds].size);
// Center the target rect in the scroll view.
// If the target doesn't fit in the scroll view, center on the gesture location instead.
UIEdgeInsets obscuredInsets = _obscuredInsets;
obscuredInsets.bottom = std::max(_obscuredInsets.bottom, _inputViewBounds.size.height);
CGRect unobscuredRect = UIEdgeInsetsInsetRect(self.bounds, obscuredInsets);
- return [self convertRect:unobscuredRect toView:_contentView.get()];
+ return [self convertRect:unobscuredRect toView:self._currentContentView];
}
- (void)_updateVisibleContentRects