[webkit-reviews] review granted: [Bug 127721] Copy relevant code from the iOS version of WKView to WKWebView : [Attachment 222377] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Jan 27 16:18:16 PST 2014
mitz at webkit.org <mitz at webkit.org> has granted Anders Carlsson
<andersca at apple.com>'s request for review:
Bug 127721: Copy relevant code from the iOS version of WKView to WKWebView
https://bugs.webkit.org/show_bug.cgi?id=127721
Attachment 222377: Patch
https://bugs.webkit.org/attachment.cgi?id=222377&action=review
------- Additional Comments from mitz at webkit.org <mitz at webkit.org>
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.
More information about the webkit-reviews
mailing list