Add destinationFrame property to WKNavigationAction
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Feb 2014 00:17:49 +0000 (00:17 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Feb 2014 00:17:49 +0000 (00:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=128700

Reviewed by Tim Horton.

* UIProcess/API/Cocoa/WKNavigationAction.h:
* UIProcess/API/Cocoa/WKNavigationAction.mm:
(-[WKNavigationAction destinationFrame]):
(-[WKNavigationAction setDestinationFrame:]):
* UIProcess/API/Cocoa/WKNavigationActionInternal.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::PolicyClient::decidePolicyForNavigationAction):

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.h
Source/WebKit2/UIProcess/API/Cocoa/WKNavigationAction.mm
Source/WebKit2/UIProcess/API/Cocoa/WKNavigationActionInternal.h
Source/WebKit2/UIProcess/Cocoa/NavigationState.mm

index d07ed94..2d0b9bd 100644 (file)
@@ -1,5 +1,20 @@
 2014-02-12  Anders Carlsson  <andersca@apple.com>
 
+        Add destinationFrame property to WKNavigationAction
+        https://bugs.webkit.org/show_bug.cgi?id=128700
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/API/Cocoa/WKNavigationAction.h:
+        * UIProcess/API/Cocoa/WKNavigationAction.mm:
+        (-[WKNavigationAction destinationFrame]):
+        (-[WKNavigationAction setDestinationFrame:]):
+        * UIProcess/API/Cocoa/WKNavigationActionInternal.h:
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::NavigationState::PolicyClient::decidePolicyForNavigationAction):
+
+2014-02-12  Anders Carlsson  <andersca@apple.com>
+
         Forward declare WKNavigation in WKNavigationDelegate.h
         https://bugs.webkit.org/show_bug.cgi?id=128699
 
index 1f47f18..52f51f3 100644 (file)
@@ -43,6 +43,7 @@ WK_API_CLASS
 @interface WKNavigationAction : NSObject
 
 @property (nonatomic, readonly) WKFrameInfo *sourceFrame;
+@property (nonatomic, readonly) WKFrameInfo *destinationFrame;
 
 @property (nonatomic, readonly) WKNavigationType navigationType;
 @property (nonatomic, readonly) NSURLRequest *request;
index fead51e..8a2fabc 100644 (file)
@@ -32,6 +32,7 @@
 
 @implementation WKNavigationAction {
     RetainPtr<WKFrameInfo> _sourceFrame;
+    RetainPtr<WKFrameInfo> _destinationFrame;
     RetainPtr<NSURLRequest> _request;
 }
 
     _sourceFrame = sourceFrame;
 }
 
+- (WKFrameInfo *)destinationFrame
+{
+    return _destinationFrame.get();
+}
+
+- (void)setDestinationFrame:(WKFrameInfo *)destinationFrame
+{
+    _destinationFrame = destinationFrame;
+}
+
 - (NSURLRequest *)request
 {
     return _request.get();
index 96a218e..f4b3e53 100644 (file)
@@ -30,6 +30,7 @@
 @interface WKNavigationAction ()
 
 @property (nonatomic, readwrite, strong) WKFrameInfo *sourceFrame;
+@property (nonatomic, readwrite, strong) WKFrameInfo *destinationFrame;
 
 @property (nonatomic, readwrite) WKNavigationType navigationType;
 @property (nonatomic, readwrite, copy) NSURLRequest *request;
index d649886..0623792 100644 (file)
@@ -143,9 +143,14 @@ void NavigationState::PolicyClient::decidePolicyForNavigationAction(WebPageProxy
     // FIXME: Set up the navigation action object.
     auto navigationAction = adoptNS([[WKNavigationAction alloc] init]);
 
+    if (destinationFrame)
+        [navigationAction setDestinationFrame:adoptNS([[WKFrameInfo alloc] initWithWebFrameProxy:*destinationFrame]).get()];
+
     if (sourceFrame) {
-        auto frameInfo = adoptNS([[WKFrameInfo alloc] initWithWebFrameProxy:*sourceFrame]);
-        [navigationAction setSourceFrame:frameInfo.get()];
+        if (sourceFrame == destinationFrame)
+            [navigationAction setSourceFrame:[navigationAction destinationFrame]];
+        else
+            [navigationAction setDestinationFrame:adoptNS([[WKFrameInfo alloc] initWithWebFrameProxy:*sourceFrame]).get()];
     }
 
     [navigationAction setNavigationType:toWKNavigationType(navigationActionData.navigationType)];