RESOLVED FIXED 127721
Copy relevant code from the iOS version of WKView to WKWebView
https://bugs.webkit.org/show_bug.cgi?id=127721
Summary Copy relevant code from the iOS version of WKView to WKWebView
Anders Carlsson
Reported 2014-01-27 16:05:07 PST
Copy relevant code from the iOS version of WKView to WKWebView
Attachments
Patch (10.66 KB, patch)
2014-01-27 16:05 PST, Anders Carlsson
mitz: review+
Anders Carlsson
Comment 1 2014-01-27 16:05:59 PST
mitz
Comment 2 2014-01-27 16:15:42 PST
Comment on attachment 222377 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=222377&action=review > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:43 > +#endif > + > +#if PLATFORM(IOS) Not necessary > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:96 > + [_contentView setDelegate:self]; > + [_contentView layer].anchorPoint = CGPointZero; > + [_contentView setFrame:bounds]; > + [_scrollView addSubview:_contentView.get()]; Please use property syntax here. > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:99 > + [_viewportHandler setDelegate:self]; And here. > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:113 > +#pragma mark iOS specific methods iOS-specific > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:141 > + return [_contentView browsingContextController]; And here. > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:174 > + CGFloat zoomScale = [_scrollView zoomScale]; > + CGSize contentsSizeInScrollViewCoordinates = CGSizeMake(newSize.width * zoomScale, newSize.height * zoomScale); > + [_scrollView setContentSize:contentsSizeInScrollViewCoordinates]; > + > + [_viewportHandler update:^{ > + [_viewportHandler setDocumentBounds:{CGPointZero, newSize}]; > + }]; > +} > + > +- (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView > +{ > + _userHasChangedPageScale = NO; > + > + WKContentType contentType = [_contentView contentType]; > + [_viewportHandler update:^{ > + [_viewportHandler clearWebKitViewportConfigurationFlags]; > + struct _UIWebViewportConfiguration configuration = standardViewportConfiguration; > + > + if (contentType == PlainText) { > + CGFloat screenWidth = [[UIScreen mainScreen] bounds].size.width; > + configuration.size.width = screenWidth; > + } else if (contentType == WKContentType::Image) > + configuration.minimumScale = 0.01; > + > + [_viewportHandler resetViewportConfiguration:&configuration]; > + }]; > +} And here. > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:181 > + configuration.size = CGSizeMake(320.0, UIWebViewportGrowsAndShrinksToFitHeight); No need for .0 > Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:193 > + [_viewportHandler update:^{ > + [_viewportHandler applyWebKitViewportArgumentsSize:newSize > + initialScale:initialScale > + minimumScale:minimumScale > + maximumScale:maximumScale > + allowsUserScaling:allowsUserScaling]; Please fix the weird indentation.
Anders Carlsson
Comment 3 2014-01-27 16:20:19 PST
Note You need to log in before you can comment on or make changes to this bug.