Commit c9bc8d37 authored by darin@apple.com's avatar darin@apple.com

WebCore:

        Reviewed by Sam.

        - fix http://bugs.webkit.org/show_bug.cgi?id=16770
          Acid3 expects :visited styled links to restyle on iframe load

        Disentangle global history updating from the back/forward history.
        There are many cases where we don't want to create a new back/forward
        item, but we do still want to add to the global history (used for visited
        link coloring) in those cases.

        Test: fast/history/subframe-is-visited.html

        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::updateGlobalHistory): Renamed from
        addHistoryForCurrentLocation and removed the back/forward handling.
        (WebCore::FrameLoader::updateHistoryForStandardLoad): Streamlined logic a
        bit. Replaced call to addHistoryForCurrentLocation with a call to
        addBackForwardItemClippedAtTarget. Added an unconditional call to
        updateGlobalHistory.
        (WebCore::FrameLoader::updateHistoryForClientRedirect): Added a FIXME;
        why doesn't this function update global history?
        (WebCore::FrameLoader::updateHistoryForBackForwardNavigation): Ditto.
        (WebCore::FrameLoader::updateHistoryForReload): Replaced the direct call
        the client with a call to the new updateGlobalHistory function.
        (WebCore::FrameLoader::updateHistoryForRedirectWithLockedHistory): Did
        the same changes as for updateHistoryForStandardLoad.
        * loader/FrameLoader.h: More of the same.

        * loader/FrameLoaderClient.h: Removed updateGlobalHistoryForReload and
        renamed updateGlobalHistoryForStandardLoad to updateGlobalHistory.

        * svg/graphics/SVGImageEmptyClients.h:
        (WebCore::SVGEmptyFrameLoaderClient::updateGlobalHistory): Updated to
        match the above.

WebKit/gtk:

        Reviewed by Sam.

        - remove separate client calls for "standard" and "reload' history

        * WebCoreSupport/FrameLoaderClientGtk.cpp:
        (WebKit::FrameLoaderClient::updateGlobalHistory):
        * WebCoreSupport/FrameLoaderClientGtk.h:

WebKit/mac:

        Reviewed by Sam.

        - remove separate client calls for "standard" and "reload' history

        * WebCoreSupport/WebFrameLoaderClient.h:
        * WebCoreSupport/WebFrameLoaderClient.mm:
        (WebFrameLoaderClient::updateGlobalHistory):

WebKit/qt:

        Reviewed by Sam.

        - remove separate client calls for "standard" and "reload' history

        * WebCoreSupport/FrameLoaderClientQt.cpp:
        (WebCore::FrameLoaderClientQt::updateGlobalHistory):
        * WebCoreSupport/FrameLoaderClientQt.h:

WebKit/win:

        Reviewed by Sam.

        - remove separate client calls for "standard" and "reload' history

        * WebFrame.cpp:
        (WebFrame::updateGlobalHistory):
        * WebFrame.h:

WebKit/wx:

        Reviewed by Sam.

        - remove separate client calls for "standard" and "reload' history

        * WebKitSupport/FrameLoaderClientWx.cpp:
        (WebCore::FrameLoaderClientWx::updateGlobalHistory):
        * WebKitSupport/FrameLoaderClientWx.h:

LayoutTests:

        Reviewed by Sam.

        - test for http://bugs.webkit.org/show_bug.cgi?id=16770
          Acid3 expects :visited styled links to restyle on iframe load

        * fast/history/resources/subframe.html: Added.
        * fast/history/subframe-is-visited-expected.txt: Added.
        * fast/history/subframe-is-visited.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@30549 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ec993bc0
2008-02-24 Darin Adler <darin@apple.com>
Reviewed by Sam.
- test for http://bugs.webkit.org/show_bug.cgi?id=16770
Acid3 expects :visited styled links to restyle on iframe load
* fast/history/resources/subframe.html: Added.
* fast/history/subframe-is-visited-expected.txt: Added.
* fast/history/subframe-is-visited.html: Added.
2008-02-23 Dan Bernstein <mitz@apple.com>
Reviewed by Dave Hyatt.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>
<body>
</body>
</html>
There should be no red link displayed below.
Subframe loaded; test was able to run.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/css">
a { background-color: red; }
.pending { display: none; }
#link:visited { display: none; }
iframe { visibility: hidden; }
</style>
<script type="text/javascript">
function test()
{
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
layoutTestController.keepWebHistory();
}
var subframeLocation = "resources/subframe.html?" + (new Date()).valueOf();
document.getElementById('link').setAttribute("href", subframeLocation);
var frame = document.createElement("iframe");
frame.setAttribute("name", subframeLocation);
frame.setAttribute("src", subframeLocation);
frame.setAttribute("onload", "frameLoaded()");
document.getElementById("frameHolder").appendChild(frame);
}
function frameLoaded()
{
document.getElementById('link').removeAttribute('class');
getComputedStyle(document.getElementById('link'));
document.getElementById('loadedMessage').appendChild(document.createTextNode("Subframe loaded; test was able to run."));
if (window.layoutTestController)
layoutTestController.notifyDone();
}
</script>
</head>
<body onload="test()">
<p>There should be no red link displayed below.</p>
<p id="loadedMessage"></p>
<p><a id="link" class="pending">If you can see this link, the test failed.</a></p>
<p id="frameHolder"></p>
</body>
</html>
2008-02-24 Darin Adler <darin@apple.com>
Reviewed by Sam.
- fix http://bugs.webkit.org/show_bug.cgi?id=16770
Acid3 expects :visited styled links to restyle on iframe load
Disentangle global history updating from the back/forward history.
There are many cases where we don't want to create a new back/forward
item, but we do still want to add to the global history (used for visited
link coloring) in those cases.
Test: fast/history/subframe-is-visited.html
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::updateGlobalHistory): Renamed from
addHistoryForCurrentLocation and removed the back/forward handling.
(WebCore::FrameLoader::updateHistoryForStandardLoad): Streamlined logic a
bit. Replaced call to addHistoryForCurrentLocation with a call to
addBackForwardItemClippedAtTarget. Added an unconditional call to
updateGlobalHistory.
(WebCore::FrameLoader::updateHistoryForClientRedirect): Added a FIXME;
why doesn't this function update global history?
(WebCore::FrameLoader::updateHistoryForBackForwardNavigation): Ditto.
(WebCore::FrameLoader::updateHistoryForReload): Replaced the direct call
the client with a call to the new updateGlobalHistory function.
(WebCore::FrameLoader::updateHistoryForRedirectWithLockedHistory): Did
the same changes as for updateHistoryForStandardLoad.
* loader/FrameLoader.h: More of the same.
* loader/FrameLoaderClient.h: Removed updateGlobalHistoryForReload and
renamed updateGlobalHistoryForStandardLoad to updateGlobalHistory.
* svg/graphics/SVGImageEmptyClients.h:
(WebCore::SVGEmptyFrameLoaderClient::updateGlobalHistory): Updated to
match the above.
2008-02-23 Darin Adler <darin@apple.com>
Reviewed by Sam.
......@@ -2351,7 +2351,8 @@ bool FrameLoader::shouldAllowNavigation(Frame* targetFrame) const
return true;
}
if (!targetFrame->settings()->privateBrowsingEnabled()) {
Settings* settings = targetFrame->settings();
if (settings && !settings->privateBrowsingEnabled()) {
Document* targetDocument = targetFrame->document();
// FIXME: this error message should contain more specifics of why the navigation change is not allowed.
String message = String::format("Unsafe JavaScript attempt to initiate a navigation change for frame with URL %s from frame with URL %s.\n",
......@@ -4223,40 +4224,41 @@ bool FrameLoader::childFramesMatchItem(HistoryItem* item) const
return true;
}
void FrameLoader::addHistoryForCurrentLocation()
void FrameLoader::updateGlobalHistory()
{
if (!m_frame->settings()->privateBrowsingEnabled()) {
// FIXME: <rdar://problem/4880065> - This will be a hook into the WebCore global history, and this loader/client call will be removed
m_client->updateGlobalHistoryForStandardLoad(documentLoader()->urlForHistory());
}
addBackForwardItemClippedAtTarget(true);
Settings* settings = m_frame->settings();
if (!settings)
return;
if (settings->privateBrowsingEnabled())
return;
const KURL& url = documentLoader()->urlForHistory();
if (url.isEmpty())
return;
m_client->updateGlobalHistory(url);
}
void FrameLoader::updateHistoryForStandardLoad()
{
LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s", documentLoader()->url().string().ascii().data());
bool frameNavigationOnLoad = false;
// if the navigation occured during on load and this is a subframe
// update the current history item rather than adding a new one
// <rdar://problem/5333496>
// If the navigation occured during load and this is a subframe, update the current
// history item rather than adding a new one. <rdar://problem/5333496>
bool frameNavigationDuringLoad = false;
if (m_navigationDuringLoad) {
HTMLFrameOwnerElement* owner = m_frame->ownerElement();
frameNavigationOnLoad = owner && !owner->createdByParser();
frameNavigationDuringLoad = owner && !owner->createdByParser();
m_navigationDuringLoad = false;
}
if (!frameNavigationOnLoad && !documentLoader()->isClientRedirect()) {
if (!frameNavigationDuringLoad && !documentLoader()->isClientRedirect()) {
if (!documentLoader()->urlForHistory().isEmpty())
addHistoryForCurrentLocation();
addBackForwardItemClippedAtTarget(true);
} else if (documentLoader()->unreachableURL().isEmpty() && m_currentHistoryItem) {
m_currentHistoryItem->setURL(documentLoader()->url());
m_currentHistoryItem->setFormInfoFromRequest(documentLoader()->request());
}
// reset navigation during on load since we no longer
// need it past thsi point
m_navigationDuringLoad = false;
updateGlobalHistory();
}
void FrameLoader::updateHistoryForClientRedirect()
......@@ -4272,6 +4274,8 @@ void FrameLoader::updateHistoryForClientRedirect()
m_currentHistoryItem->clearDocumentState();
m_currentHistoryItem->clearScrollPoint();
}
// FIXME: Should we call updateGlobalHistory here?
}
void FrameLoader::updateHistoryForBackForwardNavigation()
......@@ -4283,6 +4287,8 @@ void FrameLoader::updateHistoryForBackForwardNavigation()
// Must grab the current scroll position before disturbing it
saveScrollPositionAndViewStateToItem(m_previousHistoryItem.get());
// FIXME: Should we call updateGlobalHistory here?
}
void FrameLoader::updateHistoryForReload()
......@@ -4303,9 +4309,7 @@ void FrameLoader::updateHistoryForReload()
m_currentHistoryItem->setURL(documentLoader()->requestURL());
}
// FIXME: <rdar://problem/4880065> - This will be a hook into the WebCore global history, and this loader/client call will be removed
// Update the last visited time. Mostly interesting for URL autocompletion statistics.
m_client->updateGlobalHistoryForReload(documentLoader()->originalURL());
updateGlobalHistory();
}
void FrameLoader::updateHistoryForRedirectWithLockedHistory()
......@@ -4317,7 +4321,7 @@ void FrameLoader::updateHistoryForRedirectWithLockedHistory()
if (documentLoader()->isClientRedirect()) {
if (!m_currentHistoryItem && !m_frame->tree()->parent())
addHistoryForCurrentLocation();
addBackForwardItemClippedAtTarget(true);
if (m_currentHistoryItem) {
m_currentHistoryItem->setURL(documentLoader()->url());
m_currentHistoryItem->setFormInfoFromRequest(documentLoader()->request());
......@@ -4327,6 +4331,8 @@ void FrameLoader::updateHistoryForRedirectWithLockedHistory()
if (parentFrame && parentFrame->loader()->m_currentHistoryItem)
parentFrame->loader()->m_currentHistoryItem->addChildItem(createHistoryItem(true));
}
updateGlobalHistory();
}
void FrameLoader::updateHistoryForCommit()
......
......@@ -449,7 +449,6 @@ namespace WebCore {
void recursiveGoToItem(HistoryItem*, HistoryItem*, FrameLoadType);
bool childFramesMatchItem(HistoryItem*) const;
void addHistoryForCurrentLocation();
void updateHistoryForBackForwardNavigation();
void updateHistoryForReload();
void updateHistoryForStandardLoad();
......@@ -457,6 +456,8 @@ namespace WebCore {
void updateHistoryForClientRedirect();
void updateHistoryForCommit();
void updateGlobalHistory();
void redirectionTimerFired(Timer<FrameLoader>*);
void checkCompletedTimerFired(Timer<FrameLoader>*);
void checkLoadCompleteTimerFired(Timer<FrameLoader>*);
......
......@@ -150,8 +150,7 @@ namespace WebCore {
virtual void finishedLoading(DocumentLoader*) = 0;
virtual void finalSetupForReplace(DocumentLoader*) = 0;
virtual void updateGlobalHistoryForStandardLoad(const KURL&) = 0;
virtual void updateGlobalHistoryForReload(const KURL&) = 0;
virtual void updateGlobalHistory(const KURL&) = 0;
virtual bool shouldGoToHistoryItem(HistoryItem*) const = 0;
virtual ResourceError cancelledError(const ResourceRequest&) = 0;
......
......@@ -247,8 +247,7 @@ public:
virtual void transitionToCommittedFromCachedPage(CachedPage*) { }
virtual void transitionToCommittedForNewPage() { }
virtual void updateGlobalHistoryForStandardLoad(const KURL&) { }
virtual void updateGlobalHistoryForReload(const KURL&) { }
virtual void updateGlobalHistory(const KURL&) { }
virtual bool shouldGoToHistoryItem(HistoryItem*) const { return false; }
virtual void saveViewStateToItem(HistoryItem*) { }
virtual bool canCachePage() const { return false; }
......
2008-02-24 Darin Adler <darin@apple.com>
Reviewed by Sam.
- remove separate client calls for "standard" and "reload' history
* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::updateGlobalHistory):
* WebCoreSupport/FrameLoaderClientGtk.h:
2008-02-23 Alexey Proskuryakov <ap@webkit.org>
Build fix.
......
......@@ -766,12 +766,7 @@ void FrameLoaderClient::startDownload(const ResourceRequest&)
notImplemented();
}
void FrameLoaderClient::updateGlobalHistoryForStandardLoad(const KURL&)
{
notImplemented();
}
void FrameLoaderClient::updateGlobalHistoryForReload(const KURL&)
void FrameLoaderClient::updateGlobalHistory(const KURL&)
{
notImplemented();
}
......
......@@ -132,8 +132,7 @@ namespace WebKit {
virtual void finishedLoading(WebCore::DocumentLoader*);
virtual void finalSetupForReplace(WebCore::DocumentLoader*);
virtual void updateGlobalHistoryForStandardLoad(const WebCore::KURL&);
virtual void updateGlobalHistoryForReload(const WebCore::KURL&);
virtual void updateGlobalHistory(const WebCore::KURL&);
virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&);
......
2008-02-24 Darin Adler <darin@apple.com>
Reviewed by Sam.
- remove separate client calls for "standard" and "reload' history
* WebCoreSupport/WebFrameLoaderClient.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::updateGlobalHistory):
2008-02-23 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
......
......@@ -140,8 +140,7 @@ private:
virtual void committedLoad(WebCore::DocumentLoader*, const char*, int);
virtual void finishedLoading(WebCore::DocumentLoader*);
virtual void finalSetupForReplace(WebCore::DocumentLoader*);
virtual void updateGlobalHistoryForStandardLoad(const WebCore::KURL&);
virtual void updateGlobalHistoryForReload(const WebCore::KURL&);
virtual void updateGlobalHistory(const WebCore::KURL&);
virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&);
......
......@@ -713,27 +713,15 @@ void WebFrameLoaderClient::finalSetupForReplace(DocumentLoader* loader)
[dataSource(loader) _clearUnarchivingState];
}
// FIXME: <rdar://problem/4880065> - Push Global History into WebCore
// Once that task is complete, this will go away
void WebFrameLoaderClient::updateGlobalHistoryForStandardLoad(const KURL& url)
void WebFrameLoaderClient::updateGlobalHistory(const KURL& url)
{
NSURL *cocoaURL = url;
WebHistoryItem *entry = [[WebHistory optionalSharedHistory] addItemForURL:cocoaURL];
String pageTitle = core(m_webFrame.get())->loader()->documentLoader()->title();
if (pageTitle.length())
const String& pageTitle = core(m_webFrame.get())->loader()->documentLoader()->title();
if (!pageTitle.isEmpty())
[entry setTitle:pageTitle];
}
// FIXME: <rdar://problem/4880065> - Push Global History into WebCore
// Once that task is complete, this will go away
void WebFrameLoaderClient::updateGlobalHistoryForReload(const KURL& url)
{
WebHistory *sharedHistory = [WebHistory optionalSharedHistory];
WebHistoryItem *item = [sharedHistory itemForURL:url];
if (item)
[sharedHistory setLastVisitedTimeInterval:[NSDate timeIntervalSinceReferenceDate] forItem:item];
}
bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem* item) const
{
WebView* view = getWebView(m_webFrame.get());
......
2008-02-24 Darin Adler <darin@apple.com>
Reviewed by Sam.
- remove separate client calls for "standard" and "reload' history
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::updateGlobalHistory):
* WebCoreSupport/FrameLoaderClientQt.h:
2008-02-24 Darin Adler <darin@apple.com>
- another try at fixing the build
......
......@@ -599,18 +599,13 @@ void FrameLoaderClientQt::registerForIconNotification(bool)
notImplemented();
}
void FrameLoaderClientQt::updateGlobalHistoryForStandardLoad(const WebCore::KURL& url)
void FrameLoaderClientQt::updateGlobalHistory(const WebCore::KURL& url)
{
QWebHistoryInterface *history = QWebHistoryInterface::defaultInterface();
if (history)
history->addHistoryEntry(url.prettyURL());
}
void FrameLoaderClientQt::updateGlobalHistoryForReload(const WebCore::KURL&)
{
notImplemented();
}
bool FrameLoaderClientQt::shouldGoToHistoryItem(WebCore::HistoryItem *item) const
{
if (item) {
......
......@@ -156,8 +156,7 @@ namespace WebCore {
virtual void transitionToCommittedFromCachedPage(WebCore::CachedPage*);
virtual void transitionToCommittedForNewPage();
virtual void updateGlobalHistoryForStandardLoad(const WebCore::KURL&);
virtual void updateGlobalHistoryForReload(const WebCore::KURL&);
virtual void updateGlobalHistory(const WebCore::KURL&);
virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
virtual void saveViewStateToItem(WebCore::HistoryItem*);
virtual bool canCachePage() const;
......
2008-02-24 Darin Adler <darin@apple.com>
Reviewed by Sam.
- remove separate client calls for "standard" and "reload' history
* WebFrame.cpp:
(WebFrame::updateGlobalHistory):
* WebFrame.h:
2008-02-23 Brent Fulgham <bfulgham@gmail.com>
Not reviewed, build fix.
......
......@@ -1594,42 +1594,15 @@ void WebFrame::transitionToCommittedForNewPage()
frame->view()->setScrollbarsMode(owner->scrollingMode());
}
void WebFrame::updateGlobalHistoryForStandardLoad(const KURL& url)
void WebFrame::updateGlobalHistory(const KURL& url)
{
COMPtr<WebHistory> history;
history.adoptRef(webHistory());
if (!history)
return;
history->addItemForURL(BString(url.string()), 0);
}
void WebFrame::updateGlobalHistoryForReload(const KURL& url)
{
BString urlBStr(url.string());
COMPtr<WebHistory> history;
history.adoptRef(webHistory());
if (!history)
return;
COMPtr<IWebHistoryItem> item;
if (SUCCEEDED(history->itemForURL(urlBStr, &item))) {
COMPtr<IWebHistoryItemPrivate> itemPrivate;
if (SUCCEEDED(item->QueryInterface(IID_IWebHistoryItemPrivate, (void**)&itemPrivate))) {
SYSTEMTIME currentTime;
GetSystemTime(&currentTime);
DATE visitedTime = 0;
SystemTimeToVariantTime(&currentTime, &visitedTime);
// FIXME - bumping the last visited time doesn't mark the history as changed
itemPrivate->setLastVisitedTimeInterval(visitedTime);
}
}
}
bool WebFrame::shouldGoToHistoryItem(HistoryItem*) const
{
return true;
......
......@@ -270,8 +270,7 @@ public:
virtual void savePlatformDataToCachedPage(WebCore::CachedPage*);
virtual void transitionToCommittedFromCachedPage(WebCore::CachedPage*);
virtual void transitionToCommittedForNewPage();
virtual void updateGlobalHistoryForStandardLoad(const WebCore::KURL &);
virtual void updateGlobalHistoryForReload(const WebCore::KURL &);
virtual void updateGlobalHistory(const WebCore::KURL &);
virtual bool shouldGoToHistoryItem(WebCore::HistoryItem *) const;
virtual void saveViewStateToItem(WebCore::HistoryItem *);
virtual bool canCachePage(void) const;
......
2008-02-24 Darin Adler <darin@apple.com>
Reviewed by Sam.
- remove separate client calls for "standard" and "reload' history
* WebKitSupport/FrameLoaderClientWx.cpp:
(WebCore::FrameLoaderClientWx::updateGlobalHistory):
* WebKitSupport/FrameLoaderClientWx.h:
2008-02-23 Kevin Ollivier <kevino@theolliviers.com>
Reviewed by Darin Adler.
......
......@@ -581,12 +581,7 @@ void FrameLoaderClientWx::partClearedInBegin()
notImplemented();
}
void FrameLoaderClientWx::updateGlobalHistoryForStandardLoad(const WebCore::KURL&)
{
notImplemented();
}
void FrameLoaderClientWx::updateGlobalHistoryForReload(const WebCore::KURL&)
void FrameLoaderClientWx::updateGlobalHistory(const WebCore::KURL&)
{
notImplemented();
}
......
......@@ -156,8 +156,7 @@ namespace WebCore {
virtual void transitionToCommittedFromCachedPage(WebCore::CachedPage*);
virtual void transitionToCommittedForNewPage();
virtual void updateGlobalHistoryForStandardLoad(const KURL&);
virtual void updateGlobalHistoryForReload(const KURL&);
virtual void updateGlobalHistory(const KURL&);
virtual bool shouldGoToHistoryItem(HistoryItem*) const;
virtual void saveScrollPositionAndViewStateToItem(HistoryItem*);
virtual bool canCachePage() const;
......
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