Changeset 176578 in webkit
- Timestamp:
- Nov 29, 2014, 2:23:36 PM (12 years ago)
- Location:
- trunk/Source/WebKit/win
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
WebCoreSupport/WebVisitedLinkStore.cpp (modified) (3 diffs)
-
WebCoreSupport/WebVisitedLinkStore.h (modified) (2 diffs)
-
WebHistory.cpp (modified) (2 diffs)
-
WebHistory.h (modified) (2 diffs)
-
WebView.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/win/ChangeLog
r176573 r176578 1 2014-11-29 Anders Carlsson <andersca@apple.com> 2 3 Stub out more of WebVisitedLinkStore on Windows 4 https://bugs.webkit.org/show_bug.cgi?id=139098 5 6 Reviewed by Sam Weinig. 7 8 * WebCoreSupport/WebVisitedLinkStore.cpp: 9 (WebVisitedLinkStore::WebVisitedLinkStore): 10 Initialize m_visitedLinksPopulated to false. 11 12 (WebVisitedLinkStore::setShouldTrackVisitedLinks): 13 Update s_shouldTrackVisitedLinks and remove all visited links if needed. 14 15 (WebVisitedLinkStore::removeAllVisitedLinks): 16 Remove all hashes from our shared link store. 17 18 (WebVisitedLinkStore::addVisitedLink): 19 Compute the visited link hash and add it to the store. 20 21 (WebVisitedLinkStore::isLinkVisited): 22 Populate visited links and then look up the hash in our hash map. 23 24 (WebVisitedLinkStore::populateVisitedLinksIfNeeded): 25 Call out to the history delegate or populate visited links from shared history. 26 27 (WebVisitedLinkStore::addVisitedLinkHash): 28 Add the hash if we're tracking hashes. 29 30 (WebVisitedLinkStore::removeVisitedLinkHashes): 31 Clear the map. 32 33 * WebCoreSupport/WebVisitedLinkStore.h: 34 Add members. 35 36 * WebHistory.cpp: 37 (WebHistory::addVisitedLinksToVisitedLinkStore): 38 New function that adds visited links from the history to a given store. 39 40 * WebHistory.h: 41 Add new member. 42 43 * WebView.cpp: 44 (WebView::addVisitedLinks): 45 Add links to the visited link store as well. 46 1 47 2014-11-27 Anders Carlsson <andersca@apple.com> 2 48 -
trunk/Source/WebKit/win/WebCoreSupport/WebVisitedLinkStore.cpp
r176573 r176578 27 27 #include "WebVisitedLinkStore.h" 28 28 29 #include "WebHistory.h" 30 #include "WebView.h" 31 #include <WebCore/PageCache.h> 29 32 #include <wtf/NeverDestroyed.h> 33 34 using namespace WebCore; 35 36 static bool s_shouldTrackVisitedLinks; 30 37 31 38 WebVisitedLinkStore& WebVisitedLinkStore::shared() … … 37 44 38 45 WebVisitedLinkStore::WebVisitedLinkStore() 46 : m_visitedLinksPopulated(false) 39 47 { 40 48 } … … 44 52 } 45 53 46 bool WebVisitedLinkStore::isLinkVisited(WebCore::Page&, WebCore::LinkHash, const WebCore::URL& baseURL, const AtomicString& attributeURL)54 void WebVisitedLinkStore::setShouldTrackVisitedLinks(bool shouldTrackVisitedLinks) 47 55 { 48 // FIXME: Implement. 49 return false; 56 if (s_shouldTrackVisitedLinks == shouldTrackVisitedLinks) 57 return; 58 59 s_shouldTrackVisitedLinks = shouldTrackVisitedLinks; 60 if (!s_shouldTrackVisitedLinks) 61 removeAllVisitedLinks(); 50 62 } 51 63 52 void WebVisitedLinkStore:: addVisitedLink(WebCore::Page&, WebCore::LinkHash)64 void WebVisitedLinkStore::removeAllVisitedLinks() 53 65 { 54 // FIXME: Implement. 66 shared().removeVisitedLinkHashes(); 67 pageCache()->markPagesForVistedLinkStyleRecalc(); 55 68 } 69 70 void WebVisitedLinkStore::addVisitedLink(const String& urlString) 71 { 72 addVisitedLinkHash(visitedLinkHash(urlString)); 73 } 74 75 bool WebVisitedLinkStore::isLinkVisited(Page& page, LinkHash linkHash, const URL& baseURL, const AtomicString& attributeURL) 76 { 77 populateVisitedLinksIfNeeded(page); 78 79 return m_visitedLinkHashes.contains(linkHash); 80 } 81 82 void WebVisitedLinkStore::addVisitedLink(Page&, LinkHash linkHash) 83 { 84 if (!s_shouldTrackVisitedLinks) 85 return; 86 87 addVisitedLinkHash(linkHash); 88 } 89 90 void WebVisitedLinkStore::populateVisitedLinksIfNeeded(Page& sourcePage) 91 { 92 if (m_visitedLinksPopulated) 93 return; 94 95 m_visitedLinksPopulated = true; 96 97 WebView* webView = kit(&sourcePage); 98 if (!webView) 99 return; 100 101 COMPtr<IWebHistoryDelegate> historyDelegate; 102 webView->historyDelegate(&historyDelegate); 103 if (historyDelegate) { 104 historyDelegate->populateVisitedLinksForWebView(webView); 105 return; 106 } 107 108 WebHistory* history = WebHistory::sharedHistory(); 109 if (!history) 110 return; 111 history->addVisitedLinksToVisitedLinkStore(*this); 112 } 113 114 void WebVisitedLinkStore::addVisitedLinkHash(LinkHash linkHash) 115 { 116 ASSERT(s_shouldTrackVisitedLinks); 117 m_visitedLinkHashes.add(linkHash); 118 119 invalidateStylesForLink(linkHash); 120 pageCache()->markPagesForVistedLinkStyleRecalc(); 121 } 122 123 void WebVisitedLinkStore::removeVisitedLinkHashes() 124 { 125 m_visitedLinksPopulated = false; 126 if (m_visitedLinkHashes.isEmpty()) 127 return; 128 m_visitedLinkHashes.clear(); 129 130 invalidateStylesForAllLinks(); 131 } -
trunk/Source/WebKit/win/WebCoreSupport/WebVisitedLinkStore.h
r176573 r176578 27 27 #define WebVisitedLinkStore_h 28 28 29 #include <WebCore/LinkHash.h> 29 30 #include <WebCore/VisitedLinkStore.h> 30 31 #include <wtf/PassRef.h> … … 36 37 virtual ~WebVisitedLinkStore(); 37 38 39 static void setShouldTrackVisitedLinks(bool); 40 static void removeAllVisitedLinks(); 41 42 void addVisitedLink(const String& urlString); 43 38 44 private: 39 45 virtual bool isLinkVisited(WebCore::Page&, WebCore::LinkHash, const WebCore::URL& baseURL, const AtomicString& attributeURL) override; 40 46 virtual void addVisitedLink(WebCore::Page&, WebCore::LinkHash) override; 47 48 void populateVisitedLinksIfNeeded(WebCore::Page&); 49 void addVisitedLinkHash(WebCore::LinkHash); 50 void removeVisitedLinkHashes(); 51 52 HashSet<WebCore::LinkHash, WebCore::LinkHashHash> m_visitedLinkHashes; 53 bool m_visitedLinksPopulated; 41 54 }; 42 55 -
trunk/Source/WebKit/win/WebHistory.cpp
r174470 r176578 35 35 #include "WebNotificationCenter.h" 36 36 #include "WebPreferences.h" 37 #include "WebVisitedLinkStore.h" 37 38 #include <WebCore/BString.h> 38 39 #include <WebCore/HistoryItem.h> … … 579 580 } 580 581 582 WebHistory::addVisitedLinksToVisitedLinkStore(WebVisitedLinkStore& visitedLinkStore) 583 { 584 for (auto& url : m_entriesByURL.keys()) 585 group.addVisitedLinkHash(visitedLinkHash(url)); 586 } 587 581 588 void WebHistory::addVisitedLinksToPageGroup(PageGroup& group) 582 589 { -
trunk/Source/WebKit/win/WebHistory.h
r165676 r176578 40 40 41 41 class WebPreferences; 42 class WebVisitedLinkStore; 42 43 43 44 class WebHistory : public IWebHistory, public IWebHistoryPrivate { … … 112 113 void visitedURL(const WebCore::URL&, const WTF::String& title, const WTF::String& httpMethod, bool wasFailure, bool increaseVisitCount); 113 114 void addVisitedLinksToPageGroup(WebCore::PageGroup&); 115 void addVisitedLinksToVisitedLinkStore(WebVisitedLinkStore&); 114 116 115 117 COMPtr<IWebHistoryItem> itemForURLString(const WTF::String&) const; -
trunk/Source/WebKit/win/WebView.cpp
r176523 r176578 66 66 #include "WebPreferences.h" 67 67 #include "WebScriptWorld.h" 68 #include "WebVisitedLinkStore.h" 68 69 #include "resource.h" 69 70 #include <JavaScriptCore/APICast.h> … … 6433 6434 HRESULT WebView::addVisitedLinks(BSTR* visitedURLs, unsigned visitedURLCount) 6434 6435 { 6436 auto& visitedLinkStore = WebVisitedLinkStore::shared(); 6435 6437 PageGroup& group = core(this)->group(); 6436 6438 … … 6439 6441 unsigned length = SysStringLen(url); 6440 6442 group.addVisitedLink(url, length); 6443 6444 visitedLinkStore.addVisitedLink(String(url, length)); 6441 6445 } 6442 6446
Note:
See TracChangeset
for help on using the changeset viewer.