Commit 2060803d authored by darin@apple.com's avatar darin@apple.com
Browse files

WebCore:

        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
parent cc636535
2008-03-06 Darin Adler <darin@apple.com>
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.
2008-03-06 Mark Rowe <mrowe@apple.com>
 
Fix 64-bit Mac build.
......@@ -407,6 +407,7 @@ __ZN7WebCore4Page37setInLowQualityImageInterpolationModeEb
__ZN7WebCore4Page6goBackEv
__ZN7WebCore4Page8goToItemEPNS_11HistoryItemENS_13FrameLoadTypeE
__ZN7WebCore4Page9goForwardEv
__ZN7WebCore4Page9initGroupEv
__ZN7WebCore4PageC1EPNS_12ChromeClientEPNS_17ContextMenuClientEPNS_12EditorClientEPNS_10DragClientEPNS_15InspectorClientE
__ZN7WebCore4PageD1Ev
__ZN7WebCore5Cache11setDisabledEb
......@@ -563,6 +564,8 @@ __ZN7WebCore9HTMLNames7srcAttrE
__ZN7WebCore9HTMLNames8hrefAttrE
__ZN7WebCore9PageCache11setCapacityEi
__ZN7WebCore9PageCache27releaseAutoreleasedPagesNowEv
__ZN7WebCore9PageGroup14addVisitedLinkEPKtm
__ZN7WebCore9PageGroup21removeAllVisitedLinksEv
__ZN7WebCore9Selection22expandUsingGranularityENS_15TextGranularityE
__ZN7WebCore9TimerBase4stopEv
__ZN7WebCore9TimerBase5startEdd
......
......@@ -2754,10 +2754,6 @@
RelativePath="..\page\FrameView.h"
>
</File>
<File
RelativePath="..\bridge\GlobalHistory.h"
>
</File>
<File
RelativePath="..\page\History.cpp"
>
......@@ -2794,6 +2790,14 @@
RelativePath="..\page\Page.h"
>
</File>
<File
RelativePath="..\page\PageGroup.cpp"
>
</File>
<File
RelativePath="..\page\PageGroup.h"
>
</File>
<File
RelativePath="..\page\Plugin.h"
>
......@@ -2837,10 +2841,6 @@
RelativePath="..\page\win\FrameWin.h"
>
</File>
<File
RelativePath="..\page\win\GlobalHistoryWin.cpp"
>
</File>
<File
RelativePath="..\page\win\PageWin.cpp"
>
......@@ -3568,14 +3568,6 @@
RelativePath="..\platform\win\WCDataObject.h"
>
</File>
<File
RelativePath="..\platform\win\WebCoreHistory.cpp"
>
</File>
<File
RelativePath="..\platform\win\WebCoreHistory.h"
>
</File>
<File
RelativePath="..\platform\win\WebCoreTextRenderer.cpp"
>
......
......@@ -289,12 +289,10 @@
1AE82FED0CAB07EE002237AE /* JSSQLResultSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE82FEB0CAB07EE002237AE /* JSSQLResultSet.h */; };
1AE830440CAB0ED1002237AE /* JSDatabaseCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE830420CAB0ED1002237AE /* JSDatabaseCustom.cpp */; };
1AF326460D78B5530068F0C4 /* AXObjectCacheMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AF326400D78B5530068F0C4 /* AXObjectCacheMac.mm */; };
1AF326470D78B5530068F0C4 /* GlobalHistoryMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AF326410D78B5530068F0C4 /* GlobalHistoryMac.mm */; };
1AF326480D78B5530068F0C4 /* WebCoreAXObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF326420D78B5530068F0C4 /* WebCoreAXObject.h */; };
1AF326490D78B5530068F0C4 /* WebCoreAXObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AF326430D78B5530068F0C4 /* WebCoreAXObject.mm */; };
1AF326780D78B9440068F0C4 /* AXObjectCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF326760D78B9440068F0C4 /* AXObjectCache.h */; };
1AF326790D78B9440068F0C4 /* EditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF326770D78B9440068F0C4 /* EditorClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
1AF3267B0D78B94E0068F0C4 /* GlobalHistory.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF3267A0D78B94E0068F0C4 /* GlobalHistory.h */; };
1AFE117D0CBFFB36003017FA /* SQLResultSetRowList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFE117B0CBFFB36003017FA /* SQLResultSetRowList.cpp */; };
1AFE117E0CBFFB36003017FA /* SQLResultSetRowList.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFE117C0CBFFB36003017FA /* SQLResultSetRowList.h */; };
1AFE11990CBFFCC4003017FA /* JSSQLResultSetRowList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFE11970CBFFCC4003017FA /* JSSQLResultSetRowList.cpp */; };
......@@ -1484,6 +1482,8 @@
85FF315A0AAFBFCB00374F38 /* DOMKeyboardEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 85FF31580AAFBFCB00374F38 /* DOMKeyboardEvent.h */; };
85FF315B0AAFBFCB00374F38 /* DOMKeyboardEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 85FF31590AAFBFCB00374F38 /* DOMKeyboardEvent.mm */; };
929264770B61FC7200B41D34 /* JSDocumentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 929264760B61FC7200B41D34 /* JSDocumentCustom.cpp */; };
9302B0BD0D79F82900C7EE83 /* PageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */; };
9302B0BF0D79F82C00C7EE83 /* PageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 9302B0BE0D79F82C00C7EE83 /* PageGroup.h */; settings = {ATTRIBUTES = (Private, ); }; };
9305B24D098F1B6B00C28855 /* Timer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9305B24C098F1B6B00C28855 /* Timer.h */; settings = {ATTRIBUTES = (Private, ); }; };
930705D809E0C9B700B17FE4 /* JSCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 930705D709E0C9B700B17FE4 /* JSCounter.cpp */; };
930705DA09E0C9BF00B17FE4 /* JSCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 930705D909E0C9BF00B17FE4 /* JSCounter.h */; };
......@@ -1690,7 +1690,6 @@
93F1999D08245E59001E9ABC /* DeprecatedValueList.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786C202DE3B8601EA4122 /* DeprecatedValueList.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F1999E08245E59001E9ABC /* DeprecatedValueListImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F587853B02DE375901EA4122 /* DeprecatedValueListImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F199A808245E59001E9ABC /* WebCoreFrameView.h in Headers */ = {isa = PBXBuildFile; fileRef = F587854C02DE375901EA4122 /* WebCoreFrameView.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F199A908245E59001E9ABC /* WebCoreHistory.h in Headers */ = {isa = PBXBuildFile; fileRef = F5517DC2031AB56301A80180 /* WebCoreHistory.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F199B308245E59001E9ABC /* WebCoreViewFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = F587855402DE375901EA4122 /* WebCoreViewFactory.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F199B808245E59001E9ABC /* ScrollBar.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7B2AF80450824100A8000F /* ScrollBar.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F199BB08245E59001E9ABC /* WebCoreKeyboardUIMode.h in Headers */ = {isa = PBXBuildFile; fileRef = BE983D95052A2E0A00892D85 /* WebCoreKeyboardUIMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -1714,7 +1713,6 @@
93F19A9D08245E59001E9ABC /* TextResourceDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D27802DE43D7018635CA /* TextResourceDecoder.cpp */; };
93F19AB908245E59001E9ABC /* Range.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30302DE4476018635CA /* Range.cpp */; };
93F19ABC08245E59001E9ABC /* XMLTokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30902DE4476018635CA /* XMLTokenizer.cpp */; };
93F19AC808245E59001E9ABC /* WebCoreHistory.m in Sources */ = {isa = PBXBuildFile; fileRef = F5517DC3031AB56301A80180 /* WebCoreHistory.m */; };
93F19AD508245E59001E9ABC /* RenderTreeAsText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93955A4203D72932008635CE /* RenderTreeAsText.cpp */; };
93F19ADC08245E59001E9ABC /* PlatformScrollBarMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC7B2AF90450824100A8000F /* PlatformScrollBarMac.mm */; };
93F19AE108245E59001E9ABC /* BlockExceptions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65F80697054D9F86008BF776 /* BlockExceptions.mm */; };
......@@ -4622,12 +4620,10 @@
1AE82FEB0CAB07EE002237AE /* JSSQLResultSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLResultSet.h; sourceTree = "<group>"; };
1AE830420CAB0ED1002237AE /* JSDatabaseCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseCustom.cpp; sourceTree = "<group>"; };
1AF326400D78B5530068F0C4 /* AXObjectCacheMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AXObjectCacheMac.mm; sourceTree = "<group>"; };
1AF326410D78B5530068F0C4 /* GlobalHistoryMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GlobalHistoryMac.mm; sourceTree = "<group>"; };
1AF326420D78B5530068F0C4 /* WebCoreAXObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreAXObject.h; sourceTree = "<group>"; };
1AF326430D78B5530068F0C4 /* WebCoreAXObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreAXObject.mm; sourceTree = "<group>"; };
1AF326760D78B9440068F0C4 /* AXObjectCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AXObjectCache.h; sourceTree = "<group>"; };
1AF326770D78B9440068F0C4 /* EditorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditorClient.h; sourceTree = "<group>"; };
1AF3267A0D78B94E0068F0C4 /* GlobalHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlobalHistory.h; sourceTree = "<group>"; };
1AFE117B0CBFFB36003017FA /* SQLResultSetRowList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLResultSetRowList.cpp; sourceTree = "<group>"; };
1AFE117C0CBFFB36003017FA /* SQLResultSetRowList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLResultSetRowList.h; sourceTree = "<group>"; };
1AFE118C0CBFFC4E003017FA /* SQLResultSetRowList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SQLResultSetRowList.idl; sourceTree = "<group>"; };
......@@ -5761,6 +5757,8 @@
85FF31580AAFBFCB00374F38 /* DOMKeyboardEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMKeyboardEvent.h; sourceTree = "<group>"; };
85FF31590AAFBFCB00374F38 /* DOMKeyboardEvent.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMKeyboardEvent.mm; sourceTree = "<group>"; };
929264760B61FC7200B41D34 /* JSDocumentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSDocumentCustom.cpp; sourceTree = "<group>"; };
9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroup.cpp; sourceTree = "<group>"; };
9302B0BE0D79F82C00C7EE83 /* PageGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageGroup.h; sourceTree = "<group>"; };
9305B24C098F1B6B00C28855 /* Timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timer.h; sourceTree = "<group>"; };
9307059009E0C75800B17FE4 /* CSSPrimitiveValue.idl */ = {isa = PBXFileReference; explicitFileType = sourcecode; fileEncoding = 4; path = CSSPrimitiveValue.idl; sourceTree = "<group>"; };
930705C709E0C95F00B17FE4 /* Counter.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Counter.idl; sourceTree = "<group>"; };
......@@ -8011,8 +8009,6 @@
F523D30402DE4476018635CA /* Range.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Range.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F523D30902DE4476018635CA /* XMLTokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLTokenizer.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F523D30A02DE4476018635CA /* XMLTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = XMLTokenizer.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F5517DC2031AB56301A80180 /* WebCoreHistory.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreHistory.h; sourceTree = "<group>"; };
F5517DC3031AB56301A80180 /* WebCoreHistory.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WebCoreHistory.m; sourceTree = "<group>"; };
F58784F002DE375901EA4122 /* CursorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CursorMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587851502DE375901EA4122 /* DeprecatedPtrListImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = DeprecatedPtrListImpl.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587851602DE375901EA4122 /* DeprecatedPtrListImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeprecatedPtrListImpl.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
......@@ -8538,8 +8534,6 @@
84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.mm */,
6582A15509999D6D00BEEB6D /* SystemTimeMac.cpp */,
51DF6D7F0B92A18E00C2DC85 /* ThreadCheck.mm */,
F5517DC2031AB56301A80180 /* WebCoreHistory.h */,
F5517DC3031AB56301A80180 /* WebCoreHistory.m */,
84B2B1F7056BEF3A00D2B771 /* WebCoreKeyGenerator.h */,
84B2B1F8056BEF3A00D2B771 /* WebCoreKeyGenerator.m */,
934D9BA60B8C1175007B42A9 /* WebCoreNSStringExtras.h */,
......@@ -8605,7 +8599,6 @@
65A21483097A3F5300B9050A /* FrameTree.h */,
65CBFEF70974F607001DAC25 /* FrameView.cpp */,
65CBFEF80974F607001DAC25 /* FrameView.h */,
1AF3267A0D78B94E0068F0C4 /* GlobalHistory.h */,
BC94D1500C275C8B006BC617 /* History.cpp */,
BC94D1510C275C8B006BC617 /* History.h */,
BC94D1520C275C8B006BC617 /* History.idl */,
......@@ -8616,6 +8609,8 @@
935C476209AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h */,
65FEA86809833ADE00BED4AB /* Page.cpp */,
65A21467097A329100B9050A /* Page.h */,
9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */,
9302B0BE0D79F82C00C7EE83 /* PageGroup.h */,
65D1C1C909932B22000CB324 /* Plugin.h */,
BCEC01BA0C274DAC009F4EC9 /* Screen.cpp */,
BCEC01BB0C274DAC009F4EC9 /* Screen.h */,
......@@ -9915,7 +9910,6 @@
isa = PBXGroup;
children = (
1AF326400D78B5530068F0C4 /* AXObjectCacheMac.mm */,
1AF326410D78B5530068F0C4 /* GlobalHistoryMac.mm */,
1AF326420D78B5530068F0C4 /* WebCoreAXObject.h */,
1AF326430D78B5530068F0C4 /* WebCoreAXObject.mm */,
ABAF22070C03B1C700B0BCF0 /* ChromeMac.mm */,
......@@ -14290,7 +14284,6 @@
B255996F0D00D8BA00BB825C /* WKTableTransferFilter.h in Headers */,
654EC611097778F500DAB52C /* WebCoreFrameBridge.h in Headers */,
93F199A808245E59001E9ABC /* WebCoreFrameView.h in Headers */,
93F199A908245E59001E9ABC /* WebCoreHistory.h in Headers */,
93F199C208245E59001E9ABC /* WebCoreKeyGenerator.h in Headers */,
93F199BB08245E59001E9ABC /* WebCoreKeyboardUIMode.h in Headers */,
934D9BA70B8C1175007B42A9 /* WebCoreNSStringExtras.h in Headers */,
......@@ -14409,7 +14402,7 @@
1CEFC9B90D78DC8C007D2579 /* SchedulePair.h in Headers */,
1AF326480D78B5530068F0C4 /* WebCoreAXObject.h in Headers */,
1AF326780D78B9440068F0C4 /* AXObjectCache.h in Headers */,
1AF3267B0D78B94E0068F0C4 /* GlobalHistory.h in Headers */,
9302B0BF0D79F82C00C7EE83 /* PageGroup.h in Headers */,
BCA83E500D7CE1E9003421A8 /* JSClipboard.h in Headers */,
BC6C49F40D7DBA0500FFA558 /* JSImageConstructor.h in Headers */,
BC3452440D7E00EA0016574A /* JSRGBColor.h in Headers */,
......@@ -15931,7 +15924,6 @@
B255996D0D00D8BA00BB825C /* WKSpotLightFilter.m in Sources */,
B25599700D00D8BA00BB825C /* WKTableTransferFilter.m in Sources */,
654EC612097778F500DAB52C /* WebCoreFrameBridge.mm in Sources */,
93F19AC808245E59001E9ABC /* WebCoreHistory.m in Sources */,
93F19AE508245E59001E9ABC /* WebCoreKeyGenerator.m in Sources */,
934D9BA50B8C116B007B42A9 /* WebCoreNSStringExtras.mm in Sources */,
DD05FE0E0B8BA3C6009ACDFE /* WebCoreObjCExtras.c in Sources */,
......@@ -16032,8 +16024,8 @@
A766F3530D6BDE3500ABDDB3 /* JSCanvasPixelArrayCustom.cpp in Sources */,
1CEFC9BA0D78DC8C007D2579 /* SchedulePair.cpp in Sources */,
1AF326460D78B5530068F0C4 /* AXObjectCacheMac.mm in Sources */,
1AF326470D78B5530068F0C4 /* GlobalHistoryMac.mm in Sources */,
1AF326490D78B5530068F0C4 /* WebCoreAXObject.mm in Sources */,
9302B0BD0D79F82900C7EE83 /* PageGroup.cpp in Sources */,
1CE24F970D7CAF0E007E04C2 /* SchedulePairMac.mm in Sources */,
BCA83E4F0D7CE1E9003421A8 /* JSClipboard.cpp in Sources */,
BCA83E520D7CE205003421A8 /* JSClipboardCustom.cpp in Sources */,
......@@ -49,13 +49,14 @@
#include "FontValue.h"
#include "Frame.h"
#include "FrameView.h"
#include "GlobalHistory.h"
#include "HTMLDocument.h"
#include "HTMLElement.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "MediaList.h"
#include "MediaQueryEvaluator.h"
#include "Page.h"
#include "PageGroup.h"
#include "Pair.h"
#include "Rect.h"
#include "RenderTheme.h"
......@@ -228,7 +229,6 @@ CSSStyleSheet* CSSStyleSelector::m_viewSourceSheet = 0;
CSSStyleSheet *CSSStyleSelector::m_svgSheet = 0;
#endif
static CSSStyleSelector::EncodedURL* currentEncodedURL = 0;
static PseudoState pseudoState;
static const MediaQueryEvaluator& screenEval()
......@@ -312,28 +312,10 @@ void CSSStyleSelector::init()
m_medium = 0;
}
void CSSStyleSelector::setEncodedURL(const KURL& url)
{
KURL u = url;
u.setQuery(String());
u.setRef(String());
m_encodedURL.file = u.string();
int pos = m_encodedURL.file.reverseFind('/');
m_encodedURL.path = m_encodedURL.file;
if (pos > 0) {
m_encodedURL.path.truncate(pos);
m_encodedURL.path.append('/');
}
u.setPath(String());
m_encodedURL.prefix = u.string();
}
CSSStyleSelector::~CSSStyleSelector()
{
delete m_medium;
::delete m_rootDefaultStyle;
delete m_rootDefaultStyle;
delete m_authorStyle;
delete m_userStyle;
}
......@@ -533,7 +515,6 @@ void CSSStyleSelector::initElementAndPseudoState(Element* e)
m_styledElement = static_cast<StyledElement*>(m_element);
else
m_styledElement = 0;
currentEncodedURL = &m_encodedURL;
pseudoState = PseudoUnknown;
}
......@@ -564,81 +545,7 @@ void CSSStyleSelector::initForStyleResolve(Element* e, RenderStyle* defaultParen
m_fontDirty = false;
}
static inline int findSlashDotDotSlash(const UChar* characters, size_t length)
{
unsigned loopLimit = length < 4 ? 0 : length - 3;
for (unsigned i = 0; i < loopLimit; ++i) {
if (characters[i] == '/' && characters[i + 1] == '.' && characters[i + 2] == '.' && characters[i + 3] == '/')
return i;
}
return -1;
}
static inline int findSlashSlash(const UChar* characters, size_t length, int position)
{
unsigned loopLimit = length < 2 ? 0 : length - 1;
for (unsigned i = position; i < loopLimit; ++i) {
if (characters[i] == '/' && characters[i + 1] == '/')
return i;
}
return -1;
}
static inline int findSlashDotSlash(const UChar* characters, size_t length)
{
unsigned loopLimit = length < 3 ? 0 : length - 2;
for (unsigned i = 0; i < loopLimit; ++i) {
if (characters[i] == '/' && characters[i + 1] == '.' && characters[i + 2] == '/')
return i;
}
return -1;
}
static inline bool containsColonSlashSlash(const UChar* characters, unsigned length)
{
unsigned loopLimit = length < 3 ? 0 : length - 2;
for (unsigned i = 0; i < loopLimit; ++i)
if (characters[i] == ':' && characters[i + 1] == '/' && characters[i + 2] == '/')
return true;
return false;
}
static void cleanPath(Vector<UChar, 512>& path)
{
int pos;
while ((pos = findSlashDotDotSlash(path.data(), path.size())) != -1) {
int prev = reverseFind(path.data(), path.size(), '/', pos - 1);
// don't remove the host, i.e. http://foo.org/../foo.html
if (prev < 0 || (prev > 3 && path[prev - 2] == ':' && path[prev - 1] == '/'))
path.remove(pos, 3);
else
path.remove(prev, pos - prev + 3);
}
// Don't remove "//" from an anchor identifier. -rjw
// Set refPos to -2 to mean "I haven't looked for the anchor yet".
// We don't want to waste a function call on the search for the the anchor
// in the vast majority of cases where there is no "//" in the path.
pos = 0;
int refPos = -2;
while ((pos = findSlashSlash(path.data(), path.size(), pos)) != -1) {
if (refPos == -2)
refPos = find(path.data(), path.size(), '#');
if (refPos > 0 && pos >= refPos)
break;
if (pos == 0 || path[pos - 1] != ':')
path.remove(pos);
else
pos += 2;
}
// FIXME: We don't want to remove "/./" from an anchor identifier either.
while ((pos = findSlashDotSlash(path.data(), path.size())) != -1)
path.remove(pos, 2);
}
static void checkPseudoState(Element *e, bool checkVisited = true)
static void checkPseudoState(Element* e, bool checkVisited = true)
{
if (!e->isLink()) {
pseudoState = PseudoNone;
......@@ -667,26 +574,21 @@ static void checkPseudoState(Element *e, bool checkVisited = true)
return;
}
const UChar* characters = attr->characters();
unsigned length = attr->length();
Document* document = e->document();
if (containsColonSlashSlash(characters, length)) {
// FIXME: Strange to not clean the path just beacause it has "://" in it.
pseudoState = historyContains(characters, length) ? PseudoVisited : PseudoLink;
Frame* frame = document->frame();
if (!frame) {
pseudoState = PseudoLink;
return;
}
Vector<UChar, 512> buffer;
if (length && characters[0] == '/') {
buffer.append(currentEncodedURL->prefix.characters(), currentEncodedURL->prefix.length());
} else if (length && characters[0] == '#') {
buffer.append(currentEncodedURL->file.characters(), currentEncodedURL->file.length());
} else {
buffer.append(currentEncodedURL->path.characters(), currentEncodedURL->path.length());
Page* page = frame->page();
if (!page) {
pseudoState = PseudoLink;
return;
}
buffer.append(characters, length);
cleanPath(buffer);
pseudoState = historyContains(buffer.data(), buffer.size()) ? PseudoVisited : PseudoLink;
pseudoState = page->group().isLinkVisited(document, *attr) ? PseudoVisited : PseudoLink;
}
// a helper function for parsing nth-arguments
......@@ -825,12 +727,14 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n)
mappedAttrsMatch = s->mappedAttributes()->mapsEquivalent(m_styledElement->mappedAttributes());
if (mappedAttrsMatch) {
bool linksMatch = true;
if (s->isLink()) {
// We need to check to see if the visited state matches.
Color linkColor = m_element->document()->linkColor();
Color visitedColor = m_element->document()->visitedLinkColor();
if (pseudoState == PseudoUnknown)
if (pseudoState == PseudoUnknown) {
const Color& linkColor = m_element->document()->linkColor();
const Color& visitedColor = m_element->document()->visitedLinkColor();
checkPseudoState(m_element, style->pseudoState() != PseudoAnyLink || linkColor != visitedColor);
}
linksMatch = (pseudoState == style->pseudoState());
}
......@@ -5130,8 +5034,8 @@ Color CSSStyleSelector::getColorFromPrimitiveValue(CSSPrimitiveValue* primitiveV
if (ident == CSS_VAL__WEBKIT_TEXT)
col = m_element->document()->textColor();
else if (ident == CSS_VAL__WEBKIT_LINK) {
Color linkColor = m_element->document()->linkColor();
Color visitedColor = m_element->document()->visitedLinkColor();
const Color& linkColor = m_element->document()->linkColor();
const Color& visitedColor = m_element->document()->visitedLinkColor();
if (linkColor == visitedColor)
col = linkColor;
else {
......
......@@ -110,14 +110,6 @@ public:
bool strictParsing;
struct EncodedURL {
String prefix; // protocol, host, etc.
String path;
String file;
} m_encodedURL;
void setEncodedURL(const KURL& url);
// Given a CSS keyword in the range (xx-small to -webkit-xxx-large), this function will return
// the correct font size scaled relative to the user's default (medium).
float fontSizeForKeyword(int keyword, bool quirksMode, bool monospace) const;
......@@ -250,11 +242,8 @@ public:
bool m_matchAuthorAndUserStyles;
RefPtr<CSSFontSelector> m_fontSelector;
HashSet<AtomicStringImpl*> m_selectorAttrs;
Vector<CSSMutableStyleDeclaration*> m_additionalAttributeStyleDecls;
Vector<MediaQueryResult*> m_viewportDependentMediaQueryResults;
void applyProperty(int id, CSSValue*);
......
......@@ -1215,7 +1215,6 @@ void Document::attach()
if (Settings* docSettings = settings())
matchAuthorAndUserStyles = docSettings->authorAndUserStylesEnabled();
m_styleSelector = new CSSStyleSelector(this, userStyleSheet(), m_styleSheets.get(), m_mappedElementSheet.get(), !inCompatMode(), matchAuthorAndUserStyles);
m_styleSelector->setEncodedURL(m_url);
}
recalcStyle(Force);
......@@ -1636,9 +1635,6 @@ void Document::setURL(const KURL& url)
return;
m_url = url;
if (m_styleSelector)
m_styleSelector->setEncodedURL(url);
m_isAllowedToLoadLocalResources = shouldBeAllowedToLoadLocalResources();
}
......@@ -2208,7 +2204,6 @@ void Document::recalcStyleSelector()
// Create a new style selector
delete m_styleSelector;
m_styleSelector = new CSSStyleSelector(this, userStyleSheet(), m_styleSheets.get(), m_mappedElementSheet.get(), !inCompatMode(), matchAuthorAndUserStyles);
m_styleSelector->setEncodedURL(m_url);
m_didCalculateStyleSelector = true;
}
......
......@@ -66,6 +66,7 @@
#include "MainResourceLoader.h"
#include "Page.h"
#include "PageCache.h"
#include "PageGroup.h"
#include "PluginInfoStore.h"
#include "ProgressTracker.h"
#include "RenderPart.h"
......@@ -3848,21 +3849,25 @@ PassRefPtr<HistoryItem> FrameLoader::createHistoryItem(bool useOriginal)
void FrameLoader::addBackForwardItemClippedAtTarget(bool doClip)
{
if (Page* page = m_frame->page())
if (!documentLoader()->urlForHistory().isEmpty()) {
Frame* mainFrame = page->mainFrame();
ASSERT(mainFrame);
FrameLoader* frameLoader = mainFrame->loader();
if (!frameLoader->m_didPerformFirstNavigation && page->backForwardList()->entries().size() == 1) {
frameLoader->m_didPerformFirstNavigation = true;
m_client->didPerformFirstNavigation();
}
Page* page = m_frame->page();
if (!page)
return;
RefPtr<HistoryItem> item = frameLoader->createHistoryItemTree(m_frame, doClip);
LOG(BackForward, "WebCoreBackForward - Adding backforward item %p for frame %s", item.get(), documentLoader()->url().string().ascii().data());
page->backForwardList()->addItem(item);
}
if (documentLoader()->urlForHistory().isEmpty())
return;
Frame* mainFrame = page->mainFrame();
ASSERT(mainFrame);
FrameLoader* frameLoader = mainFrame->loader();
if (!frameLoader->m_didPerformFirstNavigation && page->backForwardList()->entries().size() == 1) {
frameLoader->m_didPerformFirstNavigation = true;
m_client->didPerformFirstNavigation();
}
RefPtr<HistoryItem> item = frameLoader->createHistoryItemTree(m_frame, doClip);
LOG(BackForward, "WebCoreBackForward - Adding backforward item %p for frame %s", item.get(), documentLoader()->url().string().ascii().data());
page->backForwardList()->addItem(item);
}
PassRefPtr<HistoryItem> FrameLoader::createHistoryItemTree(Frame* targetFrame, bool clipAtTarget)
......@@ -4110,13 +4115,12 @@ void FrameLoader::loadItem(HistoryItem* item, FrameLoadType loadType)
// Walk the frame tree and ensure that the URLs match the URLs in the item.
bool FrameLoader::urlsMatchItem(HistoryItem* item) const
{
KURL currentURL = documentLoader()->