Move the snapshot layer contents SPI to the web view
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Jun 2015 22:29:51 +0000 (22:29 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Jun 2015 22:29:51 +0000 (22:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145771

Reviewed by Geoffrey Garen.

We need to potentially ask the web page to take a snapshot of the current item,
so move the SPI to WKWebView and name it appropriately.

* UIProcess/API/Cocoa/WKBackForwardListItem.mm:
(-[WKBackForwardListItem _snapshotLayerContents]): Deleted.
* UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h: Removed.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _snapshotLayerContentsForBackForwardListItem:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185331 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardListItem.mm
Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardListItemInternal.h
Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h [deleted file]
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

index f131c90..5ac5e39 100644 (file)
@@ -1,3 +1,21 @@
+2015-06-08  Anders Carlsson  <andersca@apple.com>
+
+        Move the snapshot layer contents SPI to the web view
+        https://bugs.webkit.org/show_bug.cgi?id=145771
+
+        Reviewed by Geoffrey Garen.
+
+        We need to potentially ask the web page to take a snapshot of the current item,
+        so move the SPI to WKWebView and name it appropriately.
+
+        * UIProcess/API/Cocoa/WKBackForwardListItem.mm:
+        (-[WKBackForwardListItem _snapshotLayerContents]): Deleted.
+        * UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h: Removed.
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _snapshotLayerContentsForBackForwardListItem:]):
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2015-06-08  Brady Eidson  <beidson@apple.com>
 
         Completely remove all IDB properties/constructors when it is disabled at runtime.
index b6fdbc3..121ad90 100644 (file)
@@ -75,20 +75,4 @@ using namespace WebKit;
 
 @end
 
-@implementation WKBackForwardListItem (WKPrivate)
-
-#if PLATFORM(IOS)
-
-- (id)_snapshotLayerContents
-{
-    if (auto* viewSnapshot = _item->snapshot())
-        return viewSnapshot->asLayerContents();
-
-    return nil;
-}
-
-#endif
-
-@end
-
 #endif // WK_API_ENABLED
index 3e9c0ae..eb79a95 100644 (file)
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import "WKBackForwardListItemPrivate.h"
+#import "WKBackForwardListItem.h"
 
 #if WK_API_ENABLED
 
diff --git a/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h b/Source/WebKit2/UIProcess/API/Cocoa/WKBackForwardListItemPrivate.h
deleted file mode 100644 (file)
index 70ce167..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <WebKit/WKBackForwardList.h>
-
-#if WK_API_ENABLED
-
-WK_ASSUME_NONNULL_BEGIN
-
-@interface WKBackForwardListItem (WKPrivate)
-
-#if TARGET_OS_IPHONE
-
-@property (WK_NULLABLE_PROPERTY nonatomic, readonly, strong) id _snapshotLayerContents WK_AVAILABLE(NA, WK_IOS_TBA);
-
-#endif
-
-@end
-
-WK_ASSUME_NONNULL_END
-
-#endif
index 60ee010..9cc7928 100644 (file)
@@ -1938,6 +1938,17 @@ static int32_t activeOrientation(WKWebView *webView)
     }];
 }
 
+- (id)_snapshotLayerContentsForBackForwardListItem:(WKBackForwardListItem *)item
+{
+    if (_page->backForwardList().currentItem() == &item._item)
+        _page->recordNavigationSnapshot(*_page->backForwardList().currentItem());
+
+    if (auto* viewSnapshot = item._item.snapshot())
+        return viewSnapshot->asLayerContents();
+
+    return nil;
+}
+
 #endif
 
 - (void)_didRelaunchProcess
index f876a2c..18f02d2 100644 (file)
@@ -160,6 +160,8 @@ WK_EXTERN NSString * const _WKShouldOpenExternalURLsKey WK_AVAILABLE(WK_MAC_TBA,
 
 - (void)_becomeFirstResponderWithSelectionMovingForward:(BOOL)selectingForward completionHandler:(void (^)(BOOL didBecomeFirstResponder))completionHandler WK_AVAILABLE(NA, WK_IOS_TBA);
 
+- (id)_snapshotLayerContentsForBackForwardListItem:(WKBackForwardListItem *)item WK_AVAILABLE(NA, WK_IOS_TBA);
+
 #else
 @property (readonly) NSColor *_pageExtendedBackgroundColor;
 @property (nonatomic, setter=_setDrawsTransparentBackground:) BOOL _drawsTransparentBackground;
index 6c5590e..2fdb51d 100644 (file)
                1A1D8BA11731A36300141DA4 /* LocalStorageDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1D8B9F1731A36300141DA4 /* LocalStorageDatabase.cpp */; };
                1A1D8BA21731A36300141DA4 /* LocalStorageDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1D8BA01731A36300141DA4 /* LocalStorageDatabase.h */; };
                1A1DC340196346D700FF7059 /* LegacySessionStateCoding.h in Headers */ = {isa = PBXBuildFile; fileRef = 31607F3819627002009B87DA /* LegacySessionStateCoding.h */; };
-               1A1E01E91B1FBB7900973E1F /* WKBackForwardListItemPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1E01E81B1FBB7900973E1F /* WKBackForwardListItemPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1A1E093318861D3800D2DC49 /* WebProgressTrackerClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1E093118861D3800D2DC49 /* WebProgressTrackerClient.cpp */; };
                1A1E093418861D3800D2DC49 /* WebProgressTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1E093218861D3800D2DC49 /* WebProgressTrackerClient.h */; };
                1A1EC69E1872092100B951F0 /* ImportanceAssertion.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A1EC69D1872092100B951F0 /* ImportanceAssertion.h */; };
                1A1D2117191D996C0001619F /* MigrateHeadersFromWebKitLegacy.make */ = {isa = PBXFileReference; lastKnownFileType = text; name = MigrateHeadersFromWebKitLegacy.make; path = mac/MigrateHeadersFromWebKitLegacy.make; sourceTree = "<group>"; };
                1A1D8B9F1731A36300141DA4 /* LocalStorageDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocalStorageDatabase.cpp; sourceTree = "<group>"; };
                1A1D8BA01731A36300141DA4 /* LocalStorageDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalStorageDatabase.h; sourceTree = "<group>"; };
-               1A1E01E81B1FBB7900973E1F /* WKBackForwardListItemPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBackForwardListItemPrivate.h; sourceTree = "<group>"; };
                1A1E093118861D3800D2DC49 /* WebProgressTrackerClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProgressTrackerClient.cpp; sourceTree = "<group>"; };
                1A1E093218861D3800D2DC49 /* WebProgressTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProgressTrackerClient.h; sourceTree = "<group>"; };
                1A1EC69D1872092100B951F0 /* ImportanceAssertion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImportanceAssertion.h; sourceTree = "<group>"; };
                                37C4C08518149C5B003688B9 /* WKBackForwardListItem.h */,
                                37C4C08418149C5B003688B9 /* WKBackForwardListItem.mm */,
                                37C4C08818149F23003688B9 /* WKBackForwardListItemInternal.h */,
-                               1A1E01E81B1FBB7900973E1F /* WKBackForwardListItemPrivate.h */,
                                1A9F28101958F478008CAC72 /* WKBackForwardListPrivate.h */,
                                1AF4592D19464B2000F9D4A2 /* WKError.h */,
                                1AF4592C19464B2000F9D4A2 /* WKError.mm */,
                                33367630130C9998006C9DE2 /* WebResourceCacheManager.h in Headers */,
                                33367656130C9ECA006C9DE2 /* WebResourceCacheManagerMessages.h in Headers */,
                                33367636130C99B2006C9DE2 /* WebResourceCacheManagerProxy.h in Headers */,
-                               1A1E01E91B1FBB7900973E1F /* WKBackForwardListItemPrivate.h in Headers */,
                                33367658130C9ECB006C9DE2 /* WebResourceCacheManagerProxyMessages.h in Headers */,
                                510AFFBA16542048001BA05E /* WebResourceLoader.h in Headers */,
                                51F060E01654317F00F3281B /* WebResourceLoaderMessages.h in Headers */,