Changeset 176576 in webkit
- Timestamp:
- Nov 29, 2014, 2:11:08 PM (12 years ago)
- Location:
- trunk/Source/WebKit/mac
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
History/WebHistory.mm (modified) (2 diffs)
-
History/WebHistoryInternal.h (modified) (2 diffs)
-
WebCoreSupport/WebVisitedLinkStore.h (modified) (2 diffs)
-
WebCoreSupport/WebVisitedLinkStore.mm (modified) (4 diffs)
-
WebView/WebView.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/mac/ChangeLog
r176575 r176576 1 2014-11-29 Anders Carlsson <andersca@apple.com> 2 3 Populate visited links 4 https://bugs.webkit.org/show_bug.cgi?id=139101 5 6 Reviewed by Sam Weinig. 7 8 * History/WebHistory.mm: 9 (-[WebHistoryPrivate addVisitedLinksToVisitedLinkStore:]): 10 Helper function that adds all visited link to the given store. 11 12 (-[WebHistory _addVisitedLinksToVisitedLinkStore:]): 13 Call the private method. 14 15 * History/WebHistoryInternal.h: 16 * WebCoreSupport/WebVisitedLinkStore.h: 17 Add new members. 18 19 * WebCoreSupport/WebVisitedLinkStore.mm: 20 (WebVisitedLinkStore::addVisitedLink): 21 Get the characters from the URL string and hash them, then call addVisitedLinkHash. 22 23 (WebVisitedLinkStore::populateVisitedLinksIfNeeded): 24 Implement this. First try the delegate, then try the shared history. 25 26 (WebVisitedLinkStore::addVisitedLinkHash): 27 Factor code that adds the link to the hash table into a separate function. 28 29 * WebView/WebView.mm: 30 (-[WebView addVisitedLinks:]): 31 Add the visited links to the store. 32 1 33 2014-11-29 Anders Carlsson <andersca@apple.com> 2 34 -
trunk/Source/WebKit/mac/History/WebHistory.mm
r176575 r176576 712 712 } 713 713 714 - (void)addVisitedLinksToVisitedLinkStore:(WebVisitedLinkStore&)visitedLinkStore 715 { 716 for (NSString *urlString in _entriesByURL) 717 visitedLinkStore.addVisitedLink(urlString); 718 } 719 714 720 @end 715 721 … … 946 952 } 947 953 954 - (void)_addVisitedLinksToVisitedLinkStore:(WebVisitedLinkStore &)visitedLinkStore 955 { 956 [_historyPrivate addVisitedLinksToVisitedLinkStore:visitedLinkStore]; 957 } 948 958 @end 949 959 -
trunk/Source/WebKit/mac/History/WebHistoryInternal.h
r170368 r176576 29 29 #import "WebHistoryPrivate.h" 30 30 31 class WebVisitedLinkStore; 32 31 33 namespace WebCore { 32 34 class PageGroup; … … 36 38 - (void)_visitedURL:(NSURL *)URL withTitle:(NSString *)title method:(NSString *)method wasFailure:(BOOL)wasFailure; 37 39 - (void)_addVisitedLinksToPageGroup:(WebCore::PageGroup&)group; 40 - (void)_addVisitedLinksToVisitedLinkStore:(WebVisitedLinkStore&)visitedLinkStore; 38 41 @end -
trunk/Source/WebKit/mac/WebCoreSupport/WebVisitedLinkStore.h
r176575 r176576 39 39 static void removeAllVisitedLinks(); 40 40 41 void addVisitedLink(NSString *urlString); 42 41 43 private: 42 44 WebVisitedLinkStore(); … … 46 48 47 49 void populateVisitedLinksIfNeeded(WebCore::Page&); 50 void addVisitedLinkHash(WebCore::LinkHash); 48 51 void removeVisitedLinkHashes(); 49 52 -
trunk/Source/WebKit/mac/WebCoreSupport/WebVisitedLinkStore.mm
r176575 r176576 26 26 #import "WebVisitedLinkStore.h" 27 27 28 #import "WebDelegateImplementationCaching.h" 29 #import "WebFrameInternal.h" 30 #import "WebHistoryInternal.h" 31 #import "WebViewInternal.h" 32 #import <WebCore/BlockExceptions.h> 28 33 #import <WebCore/PageCache.h> 29 34 #import <wtf/NeverDestroyed.h> … … 73 78 } 74 79 80 void WebVisitedLinkStore::addVisitedLink(NSString *urlString) 81 { 82 if (!s_shouldTrackVisitedLinks) 83 return; 84 85 size_t length = urlString.length; 86 87 if (const UChar* characters = CFStringGetCharactersPtr((__bridge CFStringRef)urlString)) { 88 addVisitedLinkHash(visitedLinkHash(characters, length)); 89 return; 90 } 91 92 Vector<UChar, 512> buffer(length); 93 [urlString getCharacters:buffer.data()]; 94 95 addVisitedLinkHash(visitedLinkHash(buffer.data(), length)); 96 } 97 75 98 bool WebVisitedLinkStore::isLinkVisited(Page& page, LinkHash linkHash, const URL& baseURL, const AtomicString& attributeURL) 76 99 { … … 80 103 void WebVisitedLinkStore::addVisitedLink(Page& sourcePage, LinkHash linkHash) 81 104 { 105 if (!s_shouldTrackVisitedLinks) 106 return; 107 108 addVisitedLinkHash(linkHash); 109 } 110 111 void WebVisitedLinkStore::populateVisitedLinksIfNeeded(Page& page) 112 { 113 if (m_visitedLinksPopulated) 114 return; 115 116 m_visitedLinksPopulated = true; 117 118 WebView *webView = kit(&page); 119 ASSERT(webView); 120 121 if (webView.historyDelegate) { 122 WebHistoryDelegateImplementationCache* implementations = WebViewGetHistoryDelegateImplementations(webView); 123 124 if (implementations->populateVisitedLinksFunc) 125 CallHistoryDelegate(implementations->populateVisitedLinksFunc, webView, @selector(populateVisitedLinksForWebView:)); 126 127 return; 128 } 129 130 BEGIN_BLOCK_OBJC_EXCEPTIONS; 131 [[WebHistory optionalSharedHistory] _addVisitedLinksToVisitedLinkStore:*this]; 132 END_BLOCK_OBJC_EXCEPTIONS; 133 } 134 135 void WebVisitedLinkStore::addVisitedLinkHash(LinkHash linkHash) 136 { 82 137 ASSERT(s_shouldTrackVisitedLinks); 83 138 … … 86 141 invalidateStylesForLink(linkHash); 87 142 pageCache()->markPagesForVistedLinkStyleRecalc(); 88 }89 90 void WebVisitedLinkStore::populateVisitedLinksIfNeeded(Page&)91 {92 if (m_visitedLinksPopulated)93 return;94 95 m_visitedLinksPopulated = true;96 97 // FIXME: Populate visited links.98 143 } 99 144 -
trunk/Source/WebKit/mac/WebView/WebView.mm
r176544 r176576 107 107 #import "WebUserMediaClient.h" 108 108 #import "WebViewGroup.h" 109 #import "WebVisitedLinkStore.h" 109 110 #import <CoreFoundation/CFSet.h> 110 111 #import <Foundation/NSURLConnection.h> … … 6994 6995 - (void)addVisitedLinks:(NSArray *)visitedLinks 6995 6996 { 6997 WebVisitedLinkStore& visitedLinkStore = _private->group->visitedLinkStore(); 6998 for (NSString *urlString in visitedLinks) 6999 visitedLinkStore.addVisitedLink(urlString); 7000 6996 7001 PageGroup& group = core(self)->group(); 6997 7002 6998 7003 NSEnumerator *enumerator = [visitedLinks objectEnumerator]; 6999 7004 while (NSString *url = [enumerator nextObject]) {
Note:
See TracChangeset
for help on using the changeset viewer.