Commit 2a943cc0 authored by beidson@apple.com's avatar beidson@apple.com

Send title changes to the global history delegate.

<rdar://problem/7285293> and https://webkit.org/b/29904

Reviewed by Darin Adler.

WebKit/mac: 

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::setTitle):
* WebView/WebDelegateImplementationCaching.h:
* WebView/WebHistoryDelegate.h:
* WebView/WebView.mm:
(-[WebView _cacheHistoryDelegateImplementations]):

WebKitTools: 

* DumpRenderTree/mac/HistoryDelegate.mm:
(-[HistoryDelegate webView:updateHistoryTitle:forURL:]):

LayoutTests: 

* http/tests/globalhistory/history-delegate-basic-title-expected.txt: Added.
* http/tests/globalhistory/history-delegate-basic-title.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49277 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2b13706d
2009-10-07 Brady Eidson <beidson@apple.com>
Reviewed by Darin Adler.
Send title changes to the global history delegate.
<rdar://problem/7285293> and https://webkit.org/b/29904
* http/tests/globalhistory/history-delegate-basic-title-expected.txt: Added.
* http/tests/globalhistory/history-delegate-basic-title.html: Added.
2009-10-07 Evan Martin <evan@chromium.org>
Reviewed by Adam Roben.
......
WebView navigated to url "http://127.0.0.1:8000/globalhistory/history-delegate-basic-title.html" with title "" with HTTP equivalent method "GET". The navigation was successful and was not a client redirect.
WebView updated the title for history URL "http://127.0.0.1:8000/globalhistory/history-delegate-basic-title.html" to "Test Title 1".
WebView updated the title for history URL "http://127.0.0.1:8000/globalhistory/history-delegate-basic-title.html" to "Test Title 2".
This test sees if the history delegate is notified of title changes.
<html>
<head>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
</script>
<title>Test Title 1</title>
</head>
<body>
This test sees if the history delegate is notified of title changes.
</body>
<script>
document.title = "Test Title 2";
</script>
</html>
2009-10-07 Brady Eidson <beidson@apple.com>
Reviewed by Darin Adler.
Send title changes to the global history delegate.
<rdar://problem/7285293> and https://webkit.org/b/29904
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::setTitle):
* WebView/WebDelegateImplementationCaching.h:
* WebView/WebHistoryDelegate.h:
* WebView/WebView.mm:
(-[WebView _cacheHistoryDelegateImplementations]):
2009-10-07 Darin Adler <darin@apple.com>
Reviewed by John Sullivan.
......
......@@ -1064,15 +1064,25 @@ PassRefPtr<DocumentLoader> WebFrameLoaderClient::createDocumentLoader(const Reso
return loader.release();
}
// FIXME: <rdar://problem/4880065> - Push Global History into WebCore
// Once that task is complete, this will go away
void WebFrameLoaderClient::setTitle(const String& title, const KURL& URL)
void WebFrameLoaderClient::setTitle(const String& title, const KURL& url)
{
NSURL* nsURL = URL;
WebView* view = getWebView(m_webFrame.get());
if ([view historyDelegate]) {
WebHistoryDelegateImplementationCache* implementations = WebViewGetHistoryDelegateImplementations(view);
if (!implementations->setTitleFunc)
return;
CallHistoryDelegate(implementations->setTitleFunc, view, @selector(webView:updateHistoryTitle:forURL:), (NSString *)title, (NSString *)url);
return;
}
NSURL* nsURL = url;
nsURL = [nsURL _webkit_canonicalize];
if(!nsURL)
return;
NSString *titleNSString = title;
[[[WebHistory optionalSharedHistory] itemForURL:nsURL] setTitle:titleNSString];
}
......
......@@ -85,6 +85,7 @@ struct WebHistoryDelegateImplementationCache {
IMP navigatedFunc;
IMP clientRedirectFunc;
IMP serverRedirectFunc;
IMP setTitleFunc;
};
WebResourceDelegateImplementationCache* WebViewGetResourceLoadDelegateImplementations(WebView *);
......
......@@ -37,4 +37,6 @@
- (void)webView:(WebView *)webView didPerformServerRedirectFromURL:(NSString *)sourceURL toURL:(NSString *)destinationURL inFrame:(WebFrame *)webFrame;
- (void)webView:(WebView *)webView updateHistoryTitle:(NSString *)title forURL:(NSString *)url;
@end
......@@ -1420,6 +1420,7 @@ static inline IMP getMethod(id o, SEL s)
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:));
}
- (id)_policyDelegateForwarder
......
2009-10-07 Brady Eidson <beidson@apple.com>
Reviewed by Darin Adler.
Send title changes to the global history delegate.
<rdar://problem/7285293> and https://webkit.org/b/29904
* DumpRenderTree/mac/HistoryDelegate.mm:
(-[HistoryDelegate webView:updateHistoryTitle:forURL:]):
2009-10-07 Adam Barth <abarth@webkit.org>
Unreviewed. Remove some folks from committers.py who were listed on
......
......@@ -66,4 +66,9 @@
printf("WebView performed a server redirect from \"%s\" to \"%s\".\n", [[source _drt_descriptionSuitableForTestResult] UTF8String], [[dest _drt_descriptionSuitableForTestResult] UTF8String]);
}
- (void)webView:(WebView *)webView updateHistoryTitle:(NSString *)title forURL:(NSString *)url
{
printf("WebView updated the title for history URL \"%s\" to \"%s\".\n", [[[NSURL URLWithString:url]_drt_descriptionSuitableForTestResult] UTF8String], [title UTF8String]);
}
@end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment