Changeset 30549 in webkit


Ignore:
Timestamp:
Feb 24, 2008 12:30:32 AM (16 years ago)
Author:
Darin Adler
Message:

WebCore:

Reviewed by Sam.

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.

  • fast/history/resources/subframe.html: Added.
  • fast/history/subframe-is-visited-expected.txt: Added.
  • fast/history/subframe-is-visited.html: Added.
Location:
trunk
Files:
3 added
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r30530 r30549  
     12008-02-24  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam.
     4
     5        - test for http://bugs.webkit.org/show_bug.cgi?id=16770
     6          Acid3 expects :visited styled links to restyle on iframe load
     7
     8        * fast/history/resources/subframe.html: Added.
     9        * fast/history/subframe-is-visited-expected.txt: Added.
     10        * fast/history/subframe-is-visited.html: Added.
     11
    1122008-02-23  Dan Bernstein  <mitz@apple.com>
    213
  • trunk/WebCore/ChangeLog

    r30547 r30549  
     12008-02-24  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam.
     4
     5        - fix http://bugs.webkit.org/show_bug.cgi?id=16770
     6          Acid3 expects :visited styled links to restyle on iframe load
     7
     8        Disentangle global history updating from the back/forward history.
     9        There are many cases where we don't want to create a new back/forward
     10        item, but we do still want to add to the global history (used for visited
     11        link coloring) in those cases.
     12
     13        Test: fast/history/subframe-is-visited.html
     14
     15        * loader/FrameLoader.cpp:
     16        (WebCore::FrameLoader::updateGlobalHistory): Renamed from
     17        addHistoryForCurrentLocation and removed the back/forward handling.
     18        (WebCore::FrameLoader::updateHistoryForStandardLoad): Streamlined logic a
     19        bit. Replaced call to addHistoryForCurrentLocation with a call to
     20        addBackForwardItemClippedAtTarget. Added an unconditional call to
     21        updateGlobalHistory.
     22        (WebCore::FrameLoader::updateHistoryForClientRedirect): Added a FIXME;
     23        why doesn't this function update global history?
     24        (WebCore::FrameLoader::updateHistoryForBackForwardNavigation): Ditto.
     25        (WebCore::FrameLoader::updateHistoryForReload): Replaced the direct call
     26        the client with a call to the new updateGlobalHistory function.
     27        (WebCore::FrameLoader::updateHistoryForRedirectWithLockedHistory): Did
     28        the same changes as for updateHistoryForStandardLoad.
     29        * loader/FrameLoader.h: More of the same.
     30
     31        * loader/FrameLoaderClient.h: Removed updateGlobalHistoryForReload and
     32        renamed updateGlobalHistoryForStandardLoad to updateGlobalHistory.
     33
     34        * svg/graphics/SVGImageEmptyClients.h:
     35        (WebCore::SVGEmptyFrameLoaderClient::updateGlobalHistory): Updated to
     36        match the above.
     37
    1382008-02-23  Darin Adler  <darin@apple.com>
    239
  • trunk/WebCore/loader/FrameLoader.cpp

    r30443 r30549  
    23522352    }
    23532353
    2354     if (!targetFrame->settings()->privateBrowsingEnabled()) {
     2354    Settings* settings = targetFrame->settings();
     2355    if (settings && !settings->privateBrowsingEnabled()) {
    23552356        Document* targetDocument = targetFrame->document();
    23562357        // FIXME: this error message should contain more specifics of why the navigation change is not allowed.
     
    42244225}
    42254226
    4226 void FrameLoader::addHistoryForCurrentLocation()
    4227 {
    4228     if (!m_frame->settings()->privateBrowsingEnabled()) {
    4229         // FIXME: <rdar://problem/4880065> - This will be a hook into the WebCore global history, and this loader/client call will be removed
    4230         m_client->updateGlobalHistoryForStandardLoad(documentLoader()->urlForHistory());
    4231     }
    4232     addBackForwardItemClippedAtTarget(true);
     4227void FrameLoader::updateGlobalHistory()
     4228{
     4229    Settings* settings = m_frame->settings();
     4230    if (!settings)
     4231        return;
     4232    if (settings->privateBrowsingEnabled())
     4233        return;
     4234    const KURL& url = documentLoader()->urlForHistory();
     4235    if (url.isEmpty())
     4236        return;
     4237    m_client->updateGlobalHistory(url);
    42334238}
    42344239
     
    42374242    LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s", documentLoader()->url().string().ascii().data());
    42384243   
    4239     bool frameNavigationOnLoad = false;
    4240    
    4241     // if the navigation occured during on load and this is a subframe
    4242     // update the current history item rather than adding a new one
    4243     // <rdar://problem/5333496>
     4244    // If the navigation occured during load and this is a subframe, update the current
     4245    // history item rather than adding a new one. <rdar://problem/5333496>
     4246    bool frameNavigationDuringLoad = false;
    42444247    if (m_navigationDuringLoad) {
    42454248        HTMLFrameOwnerElement* owner = m_frame->ownerElement();
    4246         frameNavigationOnLoad = owner && !owner->createdByParser();
    4247     }
    4248    
    4249     if (!frameNavigationOnLoad && !documentLoader()->isClientRedirect()) {
     4249        frameNavigationDuringLoad = owner && !owner->createdByParser();
     4250        m_navigationDuringLoad = false;
     4251    }
     4252
     4253    if (!frameNavigationDuringLoad && !documentLoader()->isClientRedirect()) {
    42504254        if (!documentLoader()->urlForHistory().isEmpty())
    4251             addHistoryForCurrentLocation();
     4255            addBackForwardItemClippedAtTarget(true);
    42524256    } else if (documentLoader()->unreachableURL().isEmpty() && m_currentHistoryItem) {
    42534257        m_currentHistoryItem->setURL(documentLoader()->url());
    42544258        m_currentHistoryItem->setFormInfoFromRequest(documentLoader()->request());
    42554259    }
    4256    
    4257     // reset navigation during on load since we no longer
    4258     // need it past thsi point
    4259     m_navigationDuringLoad = false;
     4260
     4261    updateGlobalHistory();
    42604262}
    42614263
     
    42734275        m_currentHistoryItem->clearScrollPoint();
    42744276    }
     4277
     4278    // FIXME: Should we call updateGlobalHistory here?
    42754279}
    42764280
     
    42844288    // Must grab the current scroll position before disturbing it
    42854289    saveScrollPositionAndViewStateToItem(m_previousHistoryItem.get());
     4290
     4291    // FIXME: Should we call updateGlobalHistory here?
    42864292}
    42874293
     
    43044310    }
    43054311   
    4306     // FIXME: <rdar://problem/4880065> - This will be a hook into the WebCore global history, and this loader/client call will be removed
    4307     // Update the last visited time. Mostly interesting for URL autocompletion statistics.
    4308     m_client->updateGlobalHistoryForReload(documentLoader()->originalURL());
     4312    updateGlobalHistory();
    43094313}
    43104314
     
    43184322    if (documentLoader()->isClientRedirect()) {
    43194323        if (!m_currentHistoryItem && !m_frame->tree()->parent())
    4320             addHistoryForCurrentLocation();
     4324            addBackForwardItemClippedAtTarget(true);
    43214325        if (m_currentHistoryItem) {
    43224326            m_currentHistoryItem->setURL(documentLoader()->url());
     
    43284332            parentFrame->loader()->m_currentHistoryItem->addChildItem(createHistoryItem(true));
    43294333    }
     4334
     4335    updateGlobalHistory();
    43304336}
    43314337
  • trunk/WebCore/loader/FrameLoader.h

    r30243 r30549  
    450450        bool childFramesMatchItem(HistoryItem*) const;
    451451
    452         void addHistoryForCurrentLocation();
    453452        void updateHistoryForBackForwardNavigation();
    454453        void updateHistoryForReload();
     
    458457        void updateHistoryForCommit();
    459458   
     459        void updateGlobalHistory();
     460
    460461        void redirectionTimerFired(Timer<FrameLoader>*);
    461462        void checkCompletedTimerFired(Timer<FrameLoader>*);
  • trunk/WebCore/loader/FrameLoaderClient.h

    r29837 r30549  
    151151        virtual void finalSetupForReplace(DocumentLoader*) = 0;
    152152       
    153         virtual void updateGlobalHistoryForStandardLoad(const KURL&) = 0;
    154         virtual void updateGlobalHistoryForReload(const KURL&) = 0;
     153        virtual void updateGlobalHistory(const KURL&) = 0;
    155154        virtual bool shouldGoToHistoryItem(HistoryItem*) const = 0;
    156155
  • trunk/WebCore/svg/graphics/SVGImageEmptyClients.h

    r29698 r30549  
    248248    virtual void transitionToCommittedForNewPage() { }   
    249249
    250     virtual void updateGlobalHistoryForStandardLoad(const KURL&) { }
    251     virtual void updateGlobalHistoryForReload(const KURL&) { }
     250    virtual void updateGlobalHistory(const KURL&) { }
    252251    virtual bool shouldGoToHistoryItem(HistoryItem*) const { return false; }
    253252    virtual void saveViewStateToItem(HistoryItem*) { }
  • trunk/WebKit/gtk/ChangeLog

    r30526 r30549  
     12008-02-24  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam.
     4
     5        - remove separate client calls for "standard" and "reload' history
     6
     7        * WebCoreSupport/FrameLoaderClientGtk.cpp:
     8        (WebKit::FrameLoaderClient::updateGlobalHistory):
     9        * WebCoreSupport/FrameLoaderClientGtk.h:
     10
    1112008-02-23  Alexey Proskuryakov  <ap@webkit.org>
    212
  • trunk/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp

    r30267 r30549  
    767767}
    768768
    769 void FrameLoaderClient::updateGlobalHistoryForStandardLoad(const KURL&)
    770 {
    771     notImplemented();
    772 }
    773 
    774 void FrameLoaderClient::updateGlobalHistoryForReload(const KURL&)
     769void FrameLoaderClient::updateGlobalHistory(const KURL&)
    775770{
    776771    notImplemented();
  • trunk/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h

    r29961 r30549  
    133133        virtual void finalSetupForReplace(WebCore::DocumentLoader*);
    134134
    135         virtual void updateGlobalHistoryForStandardLoad(const WebCore::KURL&);
    136         virtual void updateGlobalHistoryForReload(const WebCore::KURL&);
     135        virtual void updateGlobalHistory(const WebCore::KURL&);
    137136        virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
    138137
  • trunk/WebKit/mac/ChangeLog

    r30522 r30549  
     12008-02-24  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam.
     4
     5        - remove separate client calls for "standard" and "reload' history
     6
     7        * WebCoreSupport/WebFrameLoaderClient.h:
     8        * WebCoreSupport/WebFrameLoaderClient.mm:
     9        (WebFrameLoaderClient::updateGlobalHistory):
     10
    1112008-02-23  Alexey Proskuryakov  <ap@webkit.org>
    212
  • trunk/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h

    r28672 r30549  
    141141    virtual void finishedLoading(WebCore::DocumentLoader*);
    142142    virtual void finalSetupForReplace(WebCore::DocumentLoader*);
    143     virtual void updateGlobalHistoryForStandardLoad(const WebCore::KURL&);
    144     virtual void updateGlobalHistoryForReload(const WebCore::KURL&);
     143    virtual void updateGlobalHistory(const WebCore::KURL&);
    145144    virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
    146145
  • trunk/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r30410 r30549  
    714714}
    715715
    716 // FIXME: <rdar://problem/4880065> - Push Global History into WebCore
    717 // Once that task is complete, this will go away
    718 void WebFrameLoaderClient::updateGlobalHistoryForStandardLoad(const KURL& url)
     716void WebFrameLoaderClient::updateGlobalHistory(const KURL& url)
    719717{
    720718    NSURL *cocoaURL = url;
    721719    WebHistoryItem *entry = [[WebHistory optionalSharedHistory] addItemForURL:cocoaURL];
    722     String pageTitle = core(m_webFrame.get())->loader()->documentLoader()->title();
    723     if (pageTitle.length())
     720    const String& pageTitle = core(m_webFrame.get())->loader()->documentLoader()->title();
     721    if (!pageTitle.isEmpty())
    724722        [entry setTitle:pageTitle];
    725723}
    726724 
    727 // FIXME: <rdar://problem/4880065> - Push Global History into WebCore
    728 // Once that task is complete, this will go away
    729 void WebFrameLoaderClient::updateGlobalHistoryForReload(const KURL& url)
    730 {
    731     WebHistory *sharedHistory = [WebHistory optionalSharedHistory];
    732     WebHistoryItem *item = [sharedHistory itemForURL:url];
    733     if (item)
    734         [sharedHistory setLastVisitedTimeInterval:[NSDate timeIntervalSinceReferenceDate] forItem:item];
    735 }
    736 
    737725bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem* item) const
    738726{
  • trunk/WebKit/qt/ChangeLog

    r30548 r30549  
     12008-02-24  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam.
     4
     5        - remove separate client calls for "standard" and "reload' history
     6
     7        * WebCoreSupport/FrameLoaderClientQt.cpp:
     8        (WebCore::FrameLoaderClientQt::updateGlobalHistory):
     9        * WebCoreSupport/FrameLoaderClientQt.h:
     10
    1112008-02-24  Darin Adler  <darin@apple.com>
    212
  • trunk/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp

    r29765 r30549  
    600600}
    601601
    602 void FrameLoaderClientQt::updateGlobalHistoryForStandardLoad(const WebCore::KURL& url)
     602void FrameLoaderClientQt::updateGlobalHistory(const WebCore::KURL& url)
    603603{
    604604    QWebHistoryInterface *history = QWebHistoryInterface::defaultInterface();
    605605    if (history)
    606606        history->addHistoryEntry(url.prettyURL());
    607 }
    608 
    609 void FrameLoaderClientQt::updateGlobalHistoryForReload(const WebCore::KURL&)
    610 {
    611     notImplemented();
    612607}
    613608
  • trunk/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h

    r29663 r30549  
    157157        virtual void transitionToCommittedForNewPage();
    158158       
    159         virtual void updateGlobalHistoryForStandardLoad(const WebCore::KURL&);
    160         virtual void updateGlobalHistoryForReload(const WebCore::KURL&);
     159        virtual void updateGlobalHistory(const WebCore::KURL&);
    161160        virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
    162161        virtual void saveViewStateToItem(WebCore::HistoryItem*);
  • trunk/WebKit/win/ChangeLog

    r30532 r30549  
     12008-02-24  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam.
     4
     5        - remove separate client calls for "standard" and "reload' history
     6
     7        * WebFrame.cpp:
     8        (WebFrame::updateGlobalHistory):
     9        * WebFrame.h:
     10
    1112008-02-23  Brent Fulgham  <bfulgham@gmail.com>
    212
  • trunk/WebKit/win/WebFrame.cpp

    r30485 r30549  
    15951595}
    15961596
    1597 void WebFrame::updateGlobalHistoryForStandardLoad(const KURL& url)
     1597void WebFrame::updateGlobalHistory(const KURL& url)
    15981598{
    15991599    COMPtr<WebHistory> history;
    16001600    history.adoptRef(webHistory());
    1601 
    16021601    if (!history)
    16031602        return;
    1604 
    16051603    history->addItemForURL(BString(url.string()), 0);                 
    1606 }
    1607 
    1608 void WebFrame::updateGlobalHistoryForReload(const KURL& url)
    1609 {
    1610     BString urlBStr(url.string());
    1611 
    1612     COMPtr<WebHistory> history;
    1613     history.adoptRef(webHistory());
    1614 
    1615     if (!history)
    1616         return;
    1617 
    1618     COMPtr<IWebHistoryItem> item;
    1619     if (SUCCEEDED(history->itemForURL(urlBStr, &item))) {
    1620         COMPtr<IWebHistoryItemPrivate> itemPrivate;
    1621         if (SUCCEEDED(item->QueryInterface(IID_IWebHistoryItemPrivate, (void**)&itemPrivate))) {
    1622             SYSTEMTIME currentTime;
    1623             GetSystemTime(&currentTime);
    1624             DATE visitedTime = 0;
    1625             SystemTimeToVariantTime(&currentTime, &visitedTime);
    1626 
    1627             // FIXME - bumping the last visited time doesn't mark the history as changed
    1628             itemPrivate->setLastVisitedTimeInterval(visitedTime);
    1629         }
    1630     }
    16311604}
    16321605
  • trunk/WebKit/win/WebFrame.h

    r30485 r30549  
    271271    virtual void transitionToCommittedFromCachedPage(WebCore::CachedPage*);
    272272    virtual void transitionToCommittedForNewPage();
    273     virtual void updateGlobalHistoryForStandardLoad(const WebCore::KURL &);
    274     virtual void updateGlobalHistoryForReload(const WebCore::KURL &);
     273    virtual void updateGlobalHistory(const WebCore::KURL &);
    275274    virtual bool shouldGoToHistoryItem(WebCore::HistoryItem *) const;
    276275    virtual void saveViewStateToItem(WebCore::HistoryItem *);
  • trunk/WebKit/wx/ChangeLog

    r30539 r30549  
     12008-02-24  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam.
     4
     5        - remove separate client calls for "standard" and "reload' history
     6
     7        * WebKitSupport/FrameLoaderClientWx.cpp:
     8        (WebCore::FrameLoaderClientWx::updateGlobalHistory):
     9        * WebKitSupport/FrameLoaderClientWx.h:
     10
    1112008-02-23  Kevin Ollivier  <kevino@theolliviers.com>
    212
  • trunk/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp

    r30133 r30549  
    582582}
    583583
    584 void FrameLoaderClientWx::updateGlobalHistoryForStandardLoad(const WebCore::KURL&)
    585 {
    586     notImplemented();
    587 }
    588 
    589 void FrameLoaderClientWx::updateGlobalHistoryForReload(const WebCore::KURL&)
     584void FrameLoaderClientWx::updateGlobalHistory(const WebCore::KURL&)
    590585{
    591586    notImplemented();
  • trunk/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h

    r29663 r30549  
    157157        virtual void transitionToCommittedForNewPage();
    158158       
    159         virtual void updateGlobalHistoryForStandardLoad(const KURL&);
    160         virtual void updateGlobalHistoryForReload(const KURL&);
     159        virtual void updateGlobalHistory(const KURL&);
    161160        virtual bool shouldGoToHistoryItem(HistoryItem*) const;
    162161        virtual void saveScrollPositionAndViewStateToItem(HistoryItem*);
Note: See TracChangeset for help on using the changeset viewer.