Skip to content
  • darin@apple.com's avatar
    WebCore: · 2060803d
    darin@apple.com authored
            Reviewed by Mitz.
    
            - fix http://bugs.webkit.org/show_bug.cgi?id=17526
              REGRESSION: iframes are added to Safari's History menu
              by separating the visited link machinery from global history
    
            This should also make page loading faster due to more efficient visited link coloring.
    
            * WebCore.base.exp: Updated.
            * WebCore.vcproj/WebCore.vcproj: Added PageGroup.h/cpp, removed GlobalHistory.h/cpp.
            * WebCore.xcodeproj/project.pbxproj: Ditto. Also removed WebCoreHistory.h/m.
    
            * css/CSSStyleSelector.cpp: Updated includes.
            (WebCore::CSSStyleSelector::initElementAndPseudoState): Eliminated code to set
            currentEncodedURL.
            (WebCore::checkPseudoState): Moved most of the code inside a new
            PageGroup::isLinkVisited function.
            (WebCore::CSSStyleSelector::canShareStyleWithElement): Tightened code a bit by using
            references and only getting colors when needed.
            (WebCore::CSSStyleSelector::getColorFromPrimitiveValue): Ditto.
            * css/CSSStyleSelector.h: Removed EncodedURL, m_encodedURL, and setEncodedURL.
    
            * dom/Document.cpp:
            (WebCore::Document::attach): Removed call to setEncodedURL.
            (WebCore::Document::setURL): Ditto.
            (WebCore::Document::recalcStyleSelector): Ditto.
    
            * loader/FrameLoader.cpp:
            (WebCore::FrameLoader::addBackForwardItemClippedAtTarget): Changed code to use
            early exit idiom to be a little more readable.
            (WebCore::FrameLoader::urlsMatchItem): Change to use a reference for slightly
            better efficiency.
            (WebCore::FrameLoader::goToItem): Use early exit idiom to be a little more
            readable.
            (WebCore::FrameLoader::updateHistoryForStandardLoad): Moved history code back
            in here and got rid of the helper function updateGlobalHistory, restoring the
            logic before r30549. Also added a call to the new addVisitedLink function.
            (WebCore::FrameLoader::updateHistoryForClientRedirect): Added code to call
            addVisitedLink here.
            (WebCore::FrameLoader::updateHistoryForBackForwardNavigation): Removed comment.
            (WebCore::FrameLoader::updateHistoryForReload): Removed call to
            updateGlobalHistory; we can just go without updating global history or
            visited links here, at least for now, since it's not clear that a reload
            is a "history event".
            (WebCore::FrameLoader::updateHistoryForRedirectWithLockedHistory): Moved
            history code back where it was, and added the call to addVisitedLink, just
            as in updateHistoryForStandardLoad above.
            * loader/FrameLoader.h: Removed updateGlobalHistory function.
    
            * page/Chrome.cpp:
            (WebCore::ChromeClient::populateVisitedLinks): Added. Empty placeholder so we
            don't have to implement this for every port all at once.
            (WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer): Changed to use the
            new PageGroup class.
            * page/ChromeClient.h: Added populateVisitedLinks function, used to fill the
            visited links set from the global history at application startup time.
    
            * page/FrameTree.cpp:
            (WebCore::FrameTree::find): Updated to use the new PageGroup class.
    
            * page/GlobalHistory.h: Removed.
            * page/win/GlobalHistoryWin.cpp: Removed.
            * page/mac/GlobalHistoryMac.mm: Removed.
            * platform/mac/WebCoreHistory.h: Removed.
            * platform/mac/WebCoreHistory.m: Removed.
            * platform/win/WebCoreHistory.cpp: Removed.
            * platform/win/WebCoreHistory.h: Removed.
    
            * page/Page.cpp:
            (WebCore::Page::Page): Set m_group to 0.
            (WebCore::Page::setGroupName): Set up m_group. If the page is not in any
            group, set it to 0 for now to postpone the cost of creating a group.
            (WebCore::Page::initGroup): Added. Sets m_group to point to a single-page
            group; used when getting a group.
            (WebCore::Page::removeAllVisitedLinks): Added. Calls removeVisitedLinks
            on all page groups.
            * page/Page.h: Moved enums inside the WebCore namespace. Removed the
            frameNamespace function and instead added the group and groupPtr functions.
    
            * page/PageGroup.cpp: Added. Contains all the visited code from the
            CSSStyleSelector in the isVisitedLink function, but more efficient because
            we don't allocate memory for the buffer.
            * page/PageGroup.h: Added.
    
            * platform/gtk/TemporaryLinkStubs.cpp: Removed historyContains.
            * platform/qt/TemporaryLinkStubs.cpp: Removed unneeded include.
            * platform/wx/TemporaryLinkStubs.cpp: Removed historyContains.
    
    WebKit:
    
            * WebKit.xcodeproj/project.pbxproj: Added WebHistoryInternal.h.
    
    WebKit/mac:
    
            Reviewed by Mitz.
    
            - fix http://bugs.webkit.org/show_bug.cgi?id=17526
              REGRESSION: iframes are added to Safari's History menu
              by separating the visited link machinery from global history
    
            * History/WebHistory.mm: Moved WebHistoryPrivate inside this file.
            (-[WebHistoryPrivate removeItemFromDateCaches:]): Removed the underscore from this
            method name, since it's on a private object.
            (-[WebHistoryPrivate removeItemForURLString:]): Added a call to the
            PageGroup::removeAllVisitedLinks function if the last URL was removed.
            (-[WebHistoryPrivate addItemToDateCaches:]): Removed the underscore from this
            method name, since it's on a private object.
            (-[WebHistoryPrivate removeAllItems]): Call PageGroup::removeAllVisitedLinks.
            (-[WebHistoryPrivate ageLimitDate]): Removed the underscore from this
            method name, since it's on a private object.
            (-[WebHistoryPrivate loadHistoryGutsFromURL:savedItemsCount:collectDiscardedItemsInto:error:]):
            Ditto.
            (-[WebHistoryPrivate saveHistoryGuts:URL:error:]): Ditto. Also changed this
            to correctly return the error by using the newer version of writeToURL: and
            removed the FIXME about that.
            (-[WebHistoryPrivate addVisitedLinksToPageGroup:]): Added. Calls addVisitedLink
            for every link in the history.
            (-[WebHistory saveToURL:error:]): Removed the FIXME, since we do get the error now.
            (-[WebHistory addItem:]): Moved into the WebPrivate category.
            (-[WebHistory addItemForURL:]): Ditto.
            (-[WebHistory _addItemForURL:title:]): Added. Used for the normal case where we
            create an item and already know its title.
            (-[WebHistory ageLimitDate]): Moved into the WebPrivate category.
            (-[WebHistory containsItemForURLString:]): Ditto.
            (-[WebHistory removeItem:]): Ditto.
            (-[WebHistory setLastVisitedTimeInterval:forItem:]): Ditto.
            (-[WebHistory _itemForURLString:]): Ditto.
            (-[WebHistory _addVisitedLinksToPageGroup:]): Added. For use only inside WebKit.
    
            * History/WebHistoryInternal.h: Added.
            * History/WebHistoryItemInternal.h: Tweaked formatting and includes.
            * History/WebHistoryPrivate.h: Moved the WebHistoryPrivate class out of this header.
            Also reorganized what was left behind.
    
            * WebCoreSupport/WebChromeClient.h: Added populateVisitedLinks.
            * WebCoreSupport/WebChromeClient.mm:
            (WebChromeClient::populateVisitedLinks): Added a call to the new
            -[WebHistory _addVisitedLinksToPageGroup:] method.
    
            * WebCoreSupport/WebFrameLoaderClient.mm:
            (WebFrameLoaderClient::updateGlobalHistory): Changed code to use the new
            -[WebHistory _addItemForURL:title:] method.
    
    WebKit/win:
    
            Reviewed by Mitz.
    
            - fix http://bugs.webkit.org/show_bug.cgi?id=17526
              REGRESSION: iframes are added to Safari's History menu
              by separating the visited link machinery from global history
    
            * WebCoreSupport/WebChromeClient.cpp:
            (WebChromeClient::populateVisitedLinks): Added a call to the new
            WebHistory::addVisitedLinksToPageGroup function.
            * WebCoreSupport/WebChromeClient.h: Added populateVisitedLinks.
            Also fixed the webView function to be non-virtual.
    
            * WebCoreSupport/WebFrameLoaderClient.cpp:
            (WebFrameLoaderClient::updateGlobalHistory): Changed to use the
            new WebHistory::addItem function.
            (WebFrameLoaderClient::webHistory): Changed to return a WebHistory*,
            there's no reason to AddRef the result from this function.
            * WebCoreSupport/WebFrameLoaderClient.h: Ditto.
    
            * WebHistory.cpp: Removed IWebHistoryPrivate and _WebCoreHistoryProvider.
            (WebHistory::QueryInterface): Removed IWebHistoryPrivate.
            (sharedHistoryStorage): Added.
            (WebHistory::sharedHistory): Added.
            (WebHistory::optionalSharedHistory): Changed to use sharedHistory().
            (WebHistory::setOptionalSharedHistory): Changed to require a WebHistory
            object, not just an IWebHistory.
            (WebHistory::removeAllItems): Call PageGroup::removeAllVisitedLinks.
            (WebHistory::addItem): Changed parameter types since this is called with
            arguments from WebCore -- at some point this could allow better efficiency.
            (WebHistory::removeItemForURLString):  Call PageGroup::removeAllVisitedLinks
            if the last URL is being removed.
            (addVisitedLinkToPageGroup): Added. Helper. Adds a single link to a group's
            visited link set.
            (WebHistory::addVisitedLinksToPageGroup): Added. Adds all links to a group's
            visited link.
            * WebHistory.h: Removed IWebHistoryPrivate. Removed optionalSharedHistoryInternal
            and added sharedHistory. Replaced addItemForURL and containsItemForURLString with
            non-virtual addItem and addVisitedLinksToPageGroup functions.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@30840 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    2060803d