Commit 62cb9c58 authored by darin@apple.com's avatar darin@apple.com

WebCore:

        Reviewed by Mitz.

        - fix regression test failures from the visited-link change

        * WebCore.base.exp: Export PageGroup::setShouldTrackVisitedLinks.
        * page/PageGroup.cpp:
        (WebCore::PageGroup::addVisitedLink): Do nothing and return early
        if shouldTrackVisitedLinks is false.
        (WebCore::PageGroup::removeVisitedLinks): Reset m_visitedLinksPopulated
        so the next time a link is queried this will be populated from history.
        (WebCore::PageGroup::setShouldTrackVisitedLinks): Added.
        * page/PageGroup.h: Added setShouldTrackVisitedLinks. This is global
        for now, but it would be better if it was per-page-group instead.

WebKit/mac:

        Reviewed by Mitz.

        - fix regression test failures from the visited-link change

        * History/WebHistory.mm:
        (+[WebHistory setOptionalSharedHistory:]): Call PageGroup::setShouldTrackVisitedLinks
        to turn off visited links if there is no history object. Also call
        removeAllVisitedLinks so we can start over from scratch with the new history.

WebKit/win:

        Reviewed by Mitz.

        - fix regression test failures and crashes from the visited-link change

        * WebCoreSupport/WebChromeClient.cpp:
        (WebChromeClient::populateVisitedLinks): Check for null before calling
        addVisitedLinksToPageGroup.
        * WebCoreSupport/WebFrameLoaderClient.cpp:
        (WebFrameLoaderClient::updateGlobalHistory): Ditto.
        * WebHistory.cpp:
        (WebHistory::setOptionalSharedHistory): Call PageGroup::setShouldTrackVisitedLinks
        to turn off visited links if there is no history object. Also call
        removeAllVisitedLinks so we can start over from scratch with the new history.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@30867 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 15717c58
2008-03-06 Darin Adler <darin@apple.com>
Reviewed by Mitz.
- fix regression test failures from the visited-link change
* WebCore.base.exp: Export PageGroup::setShouldTrackVisitedLinks.
* page/PageGroup.cpp:
(WebCore::PageGroup::addVisitedLink): Do nothing and return early
if shouldTrackVisitedLinks is false.
(WebCore::PageGroup::removeVisitedLinks): Reset m_visitedLinksPopulated
so the next time a link is queried this will be populated from history.
(WebCore::PageGroup::setShouldTrackVisitedLinks): Added.
* page/PageGroup.h: Added setShouldTrackVisitedLinks. This is global
for now, but it would be better if it was per-page-group instead.
2008-03-06 Adele Peterson <adele@apple.com>
Reviewed by Darin.
......@@ -565,6 +565,7 @@ __ZN7WebCore9PageCache11setCapacityEi
__ZN7WebCore9PageCache27releaseAutoreleasedPagesNowEv
__ZN7WebCore9PageGroup14addVisitedLinkEPKtm
__ZN7WebCore9PageGroup21removeAllVisitedLinksEv
__ZN7WebCore9PageGroup26setShouldTrackVisitedLinksEb
__ZN7WebCore9Selection22expandUsingGranularityENS_15TextGranularityE
__ZN7WebCore9TimerBase4stopEv
__ZN7WebCore9TimerBase5startEdd
......
......@@ -34,6 +34,8 @@ namespace WebCore {
// --------
static bool shouldTrackVisitedLinks;
PageGroup::PageGroup(Page* page)
: m_visitedLinksPopulated(false)
{
......@@ -236,18 +238,23 @@ bool PageGroup::isLinkVisited(Document* document, const AtomicString& attributeU
void PageGroup::addVisitedLink(const KURL& url)
{
if (!shouldTrackVisitedLinks)
return;
ASSERT(!url.isEmpty());
m_visitedLinkHashes.add(url.string().impl()->hash());
}
void PageGroup::addVisitedLink(const UChar* characters, size_t length)
{
if (!shouldTrackVisitedLinks)
return;
m_visitedLinkHashes.add(StringImpl::computeHash(characters, length));
}
void PageGroup::removeVisitedLinks()
{
m_visitedLinkHashes.clear();
m_visitedLinksPopulated = false;
}
void PageGroup::removeAllVisitedLinks()
......@@ -255,4 +262,13 @@ void PageGroup::removeAllVisitedLinks()
Page::removeAllVisitedLinks();
}
void PageGroup::setShouldTrackVisitedLinks(bool shouldTrack)
{
if (shouldTrackVisitedLinks == shouldTrack)
return;
shouldTrackVisitedLinks = shouldTrack;
if (!shouldTrackVisitedLinks)
removeAllVisitedLinks();
}
} // namespace WebCore
......@@ -51,6 +51,8 @@ namespace WebCore {
void addVisitedLink(const KURL&);
void addVisitedLink(const UChar*, size_t);
void removeVisitedLinks();
static void setShouldTrackVisitedLinks(bool);
static void removeAllVisitedLinks();
private:
......
2008-03-06 Darin Adler <darin@apple.com>
Reviewed by Mitz.
- fix regression test failures from the visited-link change
* History/WebHistory.mm:
(+[WebHistory setOptionalSharedHistory:]): Call PageGroup::setShouldTrackVisitedLinks
to turn off visited links if there is no history object. Also call
removeAllVisitedLinks so we can start over from scratch with the new history.
2008-03-06 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
......
......@@ -643,12 +643,14 @@ WebHistoryDateKey timeIntervalForBeginningOfDay(NSTimeInterval interval)
+ (void)setOptionalSharedHistory:(WebHistory *)history
{
if (_sharedHistory == history)
return;
// FIXME: Need to think about multiple instances of WebHistory per application
// and correct synchronization of history file between applications.
if (_sharedHistory != history) {
[_sharedHistory release];
_sharedHistory = [history retain];
}
[_sharedHistory release];
_sharedHistory = [history retain];
PageGroup::setShouldTrackVisitedLinks(history);
PageGroup::removeAllVisitedLinks();
}
- (id)init
......
2008-03-06 Darin Adler <darin@apple.com>
Reviewed by Mitz.
- fix regression test failures and crashes from the visited-link change
* WebCoreSupport/WebChromeClient.cpp:
(WebChromeClient::populateVisitedLinks): Check for null before calling
addVisitedLinksToPageGroup.
* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::updateGlobalHistory): Ditto.
* WebHistory.cpp:
(WebHistory::setOptionalSharedHistory): Call PageGroup::setShouldTrackVisitedLinks
to turn off visited links if there is no history object. Also call
removeAllVisitedLinks so we can start over from scratch with the new history.
2008-03-06 Matt Lilek <webkit@mattlilek.com>
Reviewed by Adam Roben.
......
......@@ -500,7 +500,10 @@ void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& database
void WebChromeClient::populateVisitedLinks()
{
WebHistory::sharedHistory()->addVisitedLinksToPageGroup(m_webView->page()->group());
WebHistory* history = WebHistory::sharedHistory();
if (!history)
return;
history->addVisitedLinksToPageGroup(m_webView->page()->group());
}
COMPtr<IWebUIDelegate> WebChromeClient::uiDelegate()
......
......@@ -429,7 +429,10 @@ void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader)
void WebFrameLoaderClient::updateGlobalHistory(const KURL& url)
{
WebHistory::sharedHistory()->addItem(url, core(m_webFrame)->loader()->documentLoader()->title());
WebHistory* history = WebHistory::sharedHistory();
if (!history)
return;
history->addItem(url, core(m_webFrame)->loader()->documentLoader()->title());
}
bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem*) const
......
......@@ -192,7 +192,11 @@ HRESULT STDMETHODCALLTYPE WebHistory::optionalSharedHistory(
HRESULT STDMETHODCALLTYPE WebHistory::setOptionalSharedHistory(
/* [in] */ IWebHistory* history)
{
if (sharedHistoryStorage() == history)
return S_OK;
sharedHistoryStorage().query(history);
PageGroup::setShouldTrackVisitedLinks(sharedHistoryStorage());
PageGroup::removeAllVisitedLinks();
return S_OK;
}
......
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