Title: [164522] trunk/Source/WebKit2
- Revision
- 164522
- Author
- m...@apple.com
- Date
- 2014-02-21 19:15:47 -0800 (Fri, 21 Feb 2014)
Log Message
Made WKWebView implement all WKContentViewDelegate methods.
Reviewed by Anders Carlsson.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView takeViewSnapshotForContentView:]): Moved from WKViewIOS.mm.
* UIProcess/API/ios/WKContentView.h: Made all protocol methods required.
* UIProcess/API/ios/WKViewIOS.mm:
(-[WKView _commonInitializationWithContextRef:pageGroupRef:relatedToPage:]): Removed code
to set self as the delegate on the content view.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (164521 => 164522)
--- trunk/Source/WebKit2/ChangeLog 2014-02-22 03:14:13 UTC (rev 164521)
+++ trunk/Source/WebKit2/ChangeLog 2014-02-22 03:15:47 UTC (rev 164522)
@@ -1,3 +1,16 @@
+2014-02-21 Dan Bernstein <m...@apple.com>
+
+ Made WKWebView implement all WKContentViewDelegate methods.
+
+ Reviewed by Anders Carlsson.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView takeViewSnapshotForContentView:]): Moved from WKViewIOS.mm.
+ * UIProcess/API/ios/WKContentView.h: Made all protocol methods required.
+ * UIProcess/API/ios/WKViewIOS.mm:
+ (-[WKView _commonInitializationWithContextRef:pageGroupRef:relatedToPage:]): Removed code
+ to set self as the delegate on the content view.
+
2014-02-21 Sam Weinig <s...@webkit.org>
<rdar://problem/16073882> Please add _AbandonCoalition key to plugin XPC service Info.plist
@@ -2,3 +15,3 @@
- Anders Carlsson.
+ Reviewed by Anders Carlsson.
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (164521 => 164522)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2014-02-22 03:14:13 UTC (rev 164521)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2014-02-22 03:15:47 UTC (rev 164522)
@@ -336,6 +336,16 @@
}
+- (RetainPtr<CGImageRef>)takeViewSnapshotForContentView:(WKContentView *)contentView
+{
+ // FIXME: We should be able to use acquire an IOSurface directly, instead of going to CGImage here and back in ViewSnapshotStore.
+ UIGraphicsBeginImageContextWithOptions(self.bounds.size, YES, self.window.screen.scale);
+ [self drawViewHierarchyInRect:[self bounds] afterScreenUpdates:NO];
+ UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
+ UIGraphicsEndImageContext();
+ return image.CGImage;
+}
+
#pragma mark - UIScrollViewDelegate
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h (164521 => 164522)
--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h 2014-02-22 03:14:13 UTC (rev 164521)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.h 2014-02-22 03:15:47 UTC (rev 164522)
@@ -40,7 +40,6 @@
}
@protocol WKContentViewDelegate <NSObject>
-@optional
- (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView;
- (void)contentView:(WKContentView *)contentView didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction;
Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm (164521 => 164522)
--- trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm 2014-02-22 03:14:13 UTC (rev 164521)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm 2014-02-22 03:15:47 UTC (rev 164522)
@@ -43,7 +43,7 @@
using namespace WebKit;
-@interface WKView () <UIScrollViewDelegate, WKContentViewDelegate>
+@interface WKView () <UIScrollViewDelegate>
@end
@interface UIScrollView (UIScrollViewInternal)
@@ -147,32 +147,6 @@
return _allowsBackForwardNavigationGestures;
}
-#pragma mark WKContentViewDelegate
-
-- (void)contentViewDidCommitLoadForMainFrame:(WKContentView *)contentView
-{
- _isWaitingForNewLayerTreeAfterDidCommitLoad = YES;
-}
-
-- (void)contentView:(WKContentView *)contentView didCommitLayerTree:(const RemoteLayerTreeTransaction&)layerTreeTransaction
-{
- [_scrollView setMinimumZoomScale:layerTreeTransaction.minimumScaleFactor()];
- [_scrollView setMaximumZoomScale:layerTreeTransaction.maximumScaleFactor()];
- [_scrollView setZoomEnabled:layerTreeTransaction.allowsUserScaling()];
- if (![_scrollView isZooming] && ![_scrollView isZoomBouncing])
- [_scrollView setZoomScale:layerTreeTransaction.pageScaleFactor()];
-
- if (_gestureController)
- _gestureController->setRenderTreeSize(layerTreeTransaction.renderTreeSize());
-
- if (_isWaitingForNewLayerTreeAfterDidCommitLoad) {
- UIEdgeInsets inset = [_scrollView contentInset];
- [_scrollView setContentOffset:CGPointMake(-inset.left, -inset.top)];
- _isWaitingForNewLayerTreeAfterDidCommitLoad = NO;
- }
- [self _updateVisibleContentRects];
-}
-
#pragma mark - UIScrollViewDelegate
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
@@ -256,7 +230,6 @@
_contentView = adoptNS([[WKContentView alloc] initWithFrame:bounds context:*toImpl(contextRef) configuration:std::move(webPageConfiguration)]);
- [_contentView setDelegate:self];
[[_contentView layer] setAnchorPoint:CGPointZero];
[_contentView setFrame:bounds];
[_scrollView addSubview:_contentView.get()];
@@ -293,16 +266,6 @@
[_contentView didUpdateVisibleRect:visibleRectInContentCoordinates unobscuredRect:unobscuredRectInContentCoordinates scale:scaleFactor];
}
-- (RetainPtr<CGImageRef>)takeViewSnapshotForContentView:(WKContentView *)contentView
-{
- // FIXME: We should be able to use acquire an IOSurface directly, instead of going to CGImage here and back in ViewSnapshotStore.
- UIGraphicsBeginImageContextWithOptions(self.bounds.size, YES, self.window.screen.scale);
- [self drawViewHierarchyInRect:[self bounds] afterScreenUpdates:NO];
- UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- return image.CGImage;
-}
-
- (void)_keyboardChangedWithInfo:(NSDictionary *)keyboardInfo adjustScrollView:(BOOL)adjustScrollView
{
// FIXME: We will also need to adjust the unobscured rect by taking into account the keyboard rect and the obscured insets.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes