Title: [150205] trunk/Source/WebKit/mac
Revision
150205
Author
m...@apple.com
Date
2013-05-16 13:50:06 -0700 (Thu, 16 May 2013)

Log Message

-webView:updateHistoryTitle:forURL: does not pass a frame to the delegate
https://bugs.webkit.org/show_bug.cgi?id=116243

Reviewed by Anders Carlsson.

Added a WebFrame parameter to the delegate method.

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::setTitle): Pass the frame to the delegate. Maintain
compatibility with clients that implement the old delegate method that
doesn’t take a frame.
* WebView/WebDelegateImplementationCaching.h:
(WebHistoryDelegateImplementationCache): Added a field to cache the
implementation of the old delegate method.
* WebView/WebHistoryDelegate.h: Changed the signature of the delegate method.
* WebView/WebView.mm:
(-[WebView _cacheHistoryDelegateImplementations]): Cache the implementation
of the new delegate method, but also check for the old one.

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (150204 => 150205)


--- trunk/Source/WebKit/mac/ChangeLog	2013-05-16 20:23:09 UTC (rev 150204)
+++ trunk/Source/WebKit/mac/ChangeLog	2013-05-16 20:50:06 UTC (rev 150205)
@@ -1,3 +1,24 @@
+2013-05-16  Dan Bernstein  <m...@apple.com>
+
+        -webView:updateHistoryTitle:forURL: does not pass a frame to the delegate
+        https://bugs.webkit.org/show_bug.cgi?id=116243
+
+        Reviewed by Anders Carlsson.
+
+        Added a WebFrame parameter to the delegate method.
+
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::setTitle): Pass the frame to the delegate. Maintain
+        compatibility with clients that implement the old delegate method that
+        doesn’t take a frame.
+        * WebView/WebDelegateImplementationCaching.h:
+        (WebHistoryDelegateImplementationCache): Added a field to cache the
+        implementation of the old delegate method.
+        * WebView/WebHistoryDelegate.h: Changed the signature of the delegate method.
+        * WebView/WebView.mm:
+        (-[WebView _cacheHistoryDelegateImplementations]): Cache the implementation
+        of the new delegate method, but also check for the old one.
+
 2013-05-16  Simon Fraser  <simon.fra...@apple.com>
 
         Re-land r150168 with some OS version guards.

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (150204 => 150205)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2013-05-16 20:23:09 UTC (rev 150204)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2013-05-16 20:50:06 UTC (rev 150205)
@@ -1173,11 +1173,12 @@
     
     if ([view historyDelegate]) {
         WebHistoryDelegateImplementationCache* implementations = WebViewGetHistoryDelegateImplementations(view);
-        if (!implementations->setTitleFunc)
-            return;
-            
         // FIXME: use direction of title.
-        CallHistoryDelegate(implementations->setTitleFunc, view, @selector(webView:updateHistoryTitle:forURL:), (NSString *)title.string(), (NSString *)url);
+        if (implementations->setTitleFunc)
+            CallHistoryDelegate(implementations->setTitleFunc, view, @selector(webView:updateHistoryTitle:forURL:inFrame:), (NSString *)title.string(), (NSString *)url, m_webFrame.get());
+        else if (implementations->deprecatedSetTitleFunc)
+            CallHistoryDelegate(implementations->deprecatedSetTitleFunc, view, @selector(webView:updateHistoryTitle:forURL:), (NSString *)title.string(), (NSString *)url);
+
         return;
     }
     

Modified: trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h (150204 => 150205)


--- trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h	2013-05-16 20:23:09 UTC (rev 150204)
+++ trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h	2013-05-16 20:50:06 UTC (rev 150205)
@@ -101,6 +101,7 @@
     IMP navigatedFunc;
     IMP clientRedirectFunc;
     IMP serverRedirectFunc;
+    IMP deprecatedSetTitleFunc;
     IMP setTitleFunc;
     IMP populateVisitedLinksFunc;
 };

Modified: trunk/Source/WebKit/mac/WebView/WebHistoryDelegate.h (150204 => 150205)


--- trunk/Source/WebKit/mac/WebView/WebHistoryDelegate.h	2013-05-16 20:23:09 UTC (rev 150204)
+++ trunk/Source/WebKit/mac/WebView/WebHistoryDelegate.h	2013-05-16 20:50:06 UTC (rev 150205)
@@ -37,7 +37,7 @@
 
 - (void)webView:(WebView *)webView didPerformServerRedirectFromURL:(NSString *)sourceURL toURL:(NSString *)destinationURL inFrame:(WebFrame *)webFrame;
 
-- (void)webView:(WebView *)webView updateHistoryTitle:(NSString *)title forURL:(NSString *)url;
+- (void)webView:(WebView *)webView updateHistoryTitle:(NSString *)title forURL:(NSString *)url inFrame:(WebFrame *)webFrame;
 
 - (void)populateVisitedLinksForWebView:(WebView *)webView;
 

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (150204 => 150205)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2013-05-16 20:23:09 UTC (rev 150204)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2013-05-16 20:50:06 UTC (rev 150205)
@@ -1720,7 +1720,8 @@
     cache->navigatedFunc = getMethod(delegate, @selector(webView:didNavigateWithNavigationData:inFrame:));
     cache->clientRedirectFunc = getMethod(delegate, @selector(webView:didPerformClientRedirectFromURL:toURL:inFrame:));
     cache->serverRedirectFunc = getMethod(delegate, @selector(webView:didPerformServerRedirectFromURL:toURL:inFrame:));
-    cache->setTitleFunc = getMethod(delegate, @selector(webView:updateHistoryTitle:forURL:));
+    cache->deprecatedSetTitleFunc = getMethod(delegate, @selector(webView:updateHistoryTitle:forURL:));
+    cache->setTitleFunc = getMethod(delegate, @selector(webView:updateHistoryTitle:forURL:inFrame:));
     cache->populateVisitedLinksFunc = getMethod(delegate, @selector(populateVisitedLinksForWebView:));
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to