Title: [164624] trunk
Revision
164624
Author
[email protected]
Date
2014-02-24 19:33:27 -0800 (Mon, 24 Feb 2014)

Log Message

Add a DefaultVisitedLinkProvider and route visited link actions through it
https://bugs.webkit.org/show_bug.cgi?id=129285

Reviewed by Dan Bernstein.

Source/WebCore:

DefaultVisitedLinkProvider currently just forwards everything to the visited link strategy,
but will soon take over the responsibilities of visited link handling from PageGroup.

* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* dom/VisitedLinkState.cpp:
(WebCore::VisitedLinkState::determineLinkStateSlowCase):
* loader/HistoryController.cpp:
(WebCore::addVisitedLink):
(WebCore::HistoryController::updateForStandardLoad):
(WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):
(WebCore::HistoryController::updateForClientRedirect):
(WebCore::HistoryController::updateForSameDocumentNavigation):
(WebCore::HistoryController::pushState):
(WebCore::HistoryController::replaceState):
* page/DefaultVisitedLinkProvider.cpp: Copied from Source/WebCore/page/VisitedLinkProvider.h.
(WebCore::DefaultVisitedLinkProvider::create):
(WebCore::DefaultVisitedLinkProvider::DefaultVisitedLinkProvider):
(WebCore::DefaultVisitedLinkProvider::~DefaultVisitedLinkProvider):
(WebCore::DefaultVisitedLinkProvider::isLinkVisited):
(WebCore::DefaultVisitedLinkProvider::addVisitedLink):
* page/DefaultVisitedLinkProvider.h: Copied from Source/WebCore/page/VisitedLinkProvider.h.
* page/Page.cpp:
(WebCore::Page::visitedLinkProvider):
* page/Page.h:
* page/PageGroup.cpp:
(WebCore::PageGroup::PageGroup):
(WebCore::PageGroup::visitedLinkProvider):
* page/PageGroup.h:
* page/VisitedLinkProvider.h:

Tools:

* MiniBrowser/mac/AppDelegate.m:
(-[BrowserAppDelegate applicationDidFinishLaunching:]):
Set a shared history so we'll get visited link tracking.

* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController awakeFromNib]):
Set a group name.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (164623 => 164624)


--- trunk/Source/WebCore/CMakeLists.txt	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Source/WebCore/CMakeLists.txt	2014-02-25 03:33:27 UTC (rev 164624)
@@ -1699,6 +1699,7 @@
     page/DOMWindow.cpp
     page/DOMWindowExtension.cpp
     page/DOMWindowProperty.cpp
+    page/DefaultVisitedLinkProvider.cpp
     page/DeviceController.cpp
     page/DiagnosticLoggingKeys.cpp
     page/DragController.cpp

Modified: trunk/Source/WebCore/ChangeLog (164623 => 164624)


--- trunk/Source/WebCore/ChangeLog	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Source/WebCore/ChangeLog	2014-02-25 03:33:27 UTC (rev 164624)
@@ -1,3 +1,44 @@
+2014-02-24  Anders Carlsson  <[email protected]>
+
+        Add a DefaultVisitedLinkProvider and route visited link actions through it
+        https://bugs.webkit.org/show_bug.cgi?id=129285
+
+        Reviewed by Dan Bernstein.
+
+        DefaultVisitedLinkProvider currently just forwards everything to the visited link strategy,
+        but will soon take over the responsibilities of visited link handling from PageGroup.
+        
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/VisitedLinkState.cpp:
+        (WebCore::VisitedLinkState::determineLinkStateSlowCase):
+        * loader/HistoryController.cpp:
+        (WebCore::addVisitedLink):
+        (WebCore::HistoryController::updateForStandardLoad):
+        (WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):
+        (WebCore::HistoryController::updateForClientRedirect):
+        (WebCore::HistoryController::updateForSameDocumentNavigation):
+        (WebCore::HistoryController::pushState):
+        (WebCore::HistoryController::replaceState):
+        * page/DefaultVisitedLinkProvider.cpp: Copied from Source/WebCore/page/VisitedLinkProvider.h.
+        (WebCore::DefaultVisitedLinkProvider::create):
+        (WebCore::DefaultVisitedLinkProvider::DefaultVisitedLinkProvider):
+        (WebCore::DefaultVisitedLinkProvider::~DefaultVisitedLinkProvider):
+        (WebCore::DefaultVisitedLinkProvider::isLinkVisited):
+        (WebCore::DefaultVisitedLinkProvider::addVisitedLink):
+        * page/DefaultVisitedLinkProvider.h: Copied from Source/WebCore/page/VisitedLinkProvider.h.
+        * page/Page.cpp:
+        (WebCore::Page::visitedLinkProvider):
+        * page/Page.h:
+        * page/PageGroup.cpp:
+        (WebCore::PageGroup::PageGroup):
+        (WebCore::PageGroup::visitedLinkProvider):
+        * page/PageGroup.h:
+        * page/VisitedLinkProvider.h:
+
 2014-02-24  Jeremy Jones  <[email protected]>
 
         WK2 AVKit fullscreen doesn't display video.

Modified: trunk/Source/WebCore/GNUmakefile.list.am (164623 => 164624)


--- trunk/Source/WebCore/GNUmakefile.list.am	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2014-02-25 03:33:27 UTC (rev 164624)
@@ -4070,6 +4070,8 @@
 	Source/WebCore/page/DOMWindowExtension.h \
 	Source/WebCore/page/DOMWindowProperty.cpp \
 	Source/WebCore/page/DOMWindowProperty.h \
+	Source/WebCore/page/DefaultVisitedLinkProvider.cpp \
+	Source/WebCore/page/DefaultVisitedLinkProvider.h \
 	Source/WebCore/page/DragActions.h \
 	Source/WebCore/page/DragClient.h \
 	Source/WebCore/page/DragController.cpp \

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (164623 => 164624)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2014-02-25 03:33:27 UTC (rev 164624)
@@ -6977,6 +6977,7 @@
     <ClCompile Include="..\page\DOMWindow.cpp" />
     <ClCompile Include="..\page\DOMWindowExtension.cpp" />
     <ClCompile Include="..\page\DOMWindowProperty.cpp" />
+    <ClCompile Include="..\page\DefaultVisitedLinkProvider.cpp" />
     <ClCompile Include="..\page\DragController.cpp" />
     <ClCompile Include="..\page\scrolling\coordinatedgraphics\ScrollingCoordinatorCoordinatedGraphics.cpp" />
     <ClCompile Include="..\page\scrolling\coordinatedgraphics\ScrollingStateNodeCoordinatedGraphics.cpp" />
@@ -18675,6 +18676,7 @@
     <ClInclude Include="..\page\DOMWindow.h" />
     <ClInclude Include="..\page\DOMWindowExtension.h" />
     <ClInclude Include="..\page\DOMWindowProperty.h" />
+    <ClInclude Include="..\page\DefaultVisitedLinkProvider.h" />
     <ClInclude Include="..\page\DragActions.h" />
     <ClInclude Include="..\page\DragClient.h" />
     <ClInclude Include="..\page\DragController.h" />

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (164623 => 164624)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2014-02-25 03:33:27 UTC (rev 164624)
@@ -702,6 +702,9 @@
     <ClCompile Include="..\page\DOMWindowProperty.cpp">
       <Filter>page</Filter>
     </ClCompile>
+    <ClCompile Include="..\page\DefaultVisitedLinkProvider.cpp">
+      <Filter>page</Filter>
+    </ClCompile>
     <ClCompile Include="..\page\DragController.cpp">
       <Filter>page</Filter>
     </ClCompile>
@@ -7505,6 +7508,9 @@
     <ClInclude Include="..\page\DOMWindowProperty.h">
       <Filter>page</Filter>
     </ClInclude>
+    <ClCompile Include="..\page\DefaultVisitedLinkProvider.h">
+      <Filter>page</Filter>
+    </ClCompile>
     <ClInclude Include="..\page\DragActions.h">
       <Filter>page</Filter>
     </ClInclude>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (164623 => 164624)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-02-25 03:33:27 UTC (rev 164624)
@@ -798,7 +798,6 @@
 		1ABA76CA11D20E50004C201C /* CSSPropertyNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41EA038119836DB00710BC5 /* CSSPropertyNames.cpp */; };
 		1ABA76CB11D20E57004C201C /* CSSValueKeywords.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41EA0391198374900710BC5 /* CSSValueKeywords.cpp */; };
 		1ABA80001897341200DCE9D6 /* VisitedLinkProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABA7FFF1897341200DCE9D6 /* VisitedLinkProvider.h */; };
-		1ABA80061897355500DCE9D6 /* VisitedLinkProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ABA80051897355500DCE9D6 /* VisitedLinkProvider.cpp */; };
 		1ABC7109170E5E1B00F9A9D6 /* WorkerNavigatorStorageQuota.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABC7108170E5E1B00F9A9D6 /* WorkerNavigatorStorageQuota.h */; };
 		1AC2260C0DB69F190089B669 /* JSDOMApplicationCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC2260A0DB69F190089B669 /* JSDOMApplicationCache.cpp */; };
 		1AC2260D0DB69F190089B669 /* JSDOMApplicationCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC2260B0DB69F190089B669 /* JSDOMApplicationCache.h */; };
@@ -869,6 +868,9 @@
 		1AEF4E67170E160300AB2799 /* CachedFontClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEF4E66170E160300AB2799 /* CachedFontClient.h */; };
 		1AEF4E69170E174800AB2799 /* CachedSVGDocumentClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEF4E68170E174800AB2799 /* CachedSVGDocumentClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1AF326790D78B9440068F0C4 /* EditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF326770D78B9440068F0C4 /* EditorClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		1AF4CEE918BC350100BC2D34 /* DefaultVisitedLinkProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF4CEE718BC350100BC2D34 /* DefaultVisitedLinkProvider.cpp */; };
+		1AF4CEEA18BC350100BC2D34 /* DefaultVisitedLinkProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF4CEE818BC350100BC2D34 /* DefaultVisitedLinkProvider.h */; };
+		1AF4CEEC18BC3C1B00BC2D34 /* VisitedLinkProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF4CEEB18BC3C1B00BC2D34 /* VisitedLinkProvider.cpp */; };
 		1AF62EE614DA22A70041556C /* ScrollingCoordinatorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AF62EE314DA22A70041556C /* ScrollingCoordinatorMac.mm */; };
 		1AF62EE714DA22A70041556C /* ScrollingCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF62EE414DA22A70041556C /* ScrollingCoordinator.cpp */; };
 		1AF62EE814DA22A70041556C /* ScrollingCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF62EE514DA22A70041556C /* ScrollingCoordinator.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -7577,7 +7579,6 @@
 		1AB7FC660A8B92EC00D9D37B /* XPathVariableReference.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = XPathVariableReference.cpp; sourceTree = "<group>"; };
 		1AB7FC670A8B92EC00D9D37B /* XPathVariableReference.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = XPathVariableReference.h; sourceTree = "<group>"; };
 		1ABA7FFF1897341200DCE9D6 /* VisitedLinkProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisitedLinkProvider.h; sourceTree = "<group>"; };
-		1ABA80051897355500DCE9D6 /* VisitedLinkProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisitedLinkProvider.cpp; sourceTree = "<group>"; };
 		1ABC7108170E5E1B00F9A9D6 /* WorkerNavigatorStorageQuota.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerNavigatorStorageQuota.h; sourceTree = "<group>"; };
 		1AC2260A0DB69F190089B669 /* JSDOMApplicationCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMApplicationCache.cpp; sourceTree = "<group>"; };
 		1AC2260B0DB69F190089B669 /* JSDOMApplicationCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMApplicationCache.h; sourceTree = "<group>"; };
@@ -7668,6 +7669,9 @@
 		1AEF4E66170E160300AB2799 /* CachedFontClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedFontClient.h; sourceTree = "<group>"; };
 		1AEF4E68170E174800AB2799 /* CachedSVGDocumentClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedSVGDocumentClient.h; sourceTree = "<group>"; };
 		1AF326770D78B9440068F0C4 /* EditorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditorClient.h; sourceTree = "<group>"; };
+		1AF4CEE718BC350100BC2D34 /* DefaultVisitedLinkProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DefaultVisitedLinkProvider.cpp; sourceTree = "<group>"; };
+		1AF4CEE818BC350100BC2D34 /* DefaultVisitedLinkProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DefaultVisitedLinkProvider.h; sourceTree = "<group>"; };
+		1AF4CEEB18BC3C1B00BC2D34 /* VisitedLinkProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisitedLinkProvider.cpp; sourceTree = "<group>"; };
 		1AF62EE314DA22A70041556C /* ScrollingCoordinatorMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingCoordinatorMac.mm; sourceTree = "<group>"; };
 		1AF62EE414DA22A70041556C /* ScrollingCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingCoordinator.cpp; sourceTree = "<group>"; };
 		1AF62EE514DA22A70041556C /* ScrollingCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingCoordinator.h; sourceTree = "<group>"; };
@@ -16076,6 +16080,8 @@
 				517FBA18151AA71B00B57959 /* DOMWindowExtension.h */,
 				97D2AD0114B823A60093DF32 /* DOMWindowProperty.cpp */,
 				97D2AD0214B823A60093DF32 /* DOMWindowProperty.h */,
+				1AF4CEE718BC350100BC2D34 /* DefaultVisitedLinkProvider.cpp */,
+				1AF4CEE818BC350100BC2D34 /* DefaultVisitedLinkProvider.h */,
 				A718760D0B2A120100A16ECE /* DragActions.h */,
 				A7CA59620B27C1F200FA021D /* DragClient.h */,
 				A7CA595C0B27BD9E00FA021D /* DragController.cpp */,
@@ -16203,7 +16209,7 @@
 				26F9A83618A046AC00AEB88A /* ViewportConfiguration.cpp */,
 				26F9A83718A046AC00AEB88A /* ViewportConfiguration.h */,
 				8678D0BA1878E810003ABDE6 /* ViewState.h */,
-				1ABA80051897355500DCE9D6 /* VisitedLinkProvider.cpp */,
+				1AF4CEEB18BC3C1B00BC2D34 /* VisitedLinkProvider.cpp */,
 				1ABA7FFF1897341200DCE9D6 /* VisitedLinkProvider.h */,
 				BE983D95052A2E0A00892D85 /* WebCoreKeyboardUIMode.h */,
 				494BD7930F55C8EE00747828 /* WebKitPoint.h */,
@@ -23999,6 +24005,7 @@
 				FDA15EBE12B03F0B003A583A /* JSConvolverNode.h in Headers */,
 				FE6FD48E0F676E9300092873 /* JSCoordinates.h in Headers */,
 				930705DA09E0C9BF00B17FE4 /* JSCounter.h in Headers */,
+				1AF4CEEA18BC350100BC2D34 /* DefaultVisitedLinkProvider.h in Headers */,
 				975CA2A21303679D00E99AD9 /* JSCrypto.h in Headers */,
 				E157A8F118185425009F821D /* JSCryptoAlgorithmBuilder.h in Headers */,
 				E1C657131815F9DD00256CDD /* JSCryptoAlgorithmDictionary.h in Headers */,
@@ -28821,6 +28828,7 @@
 				B2227AC00D00BF220071B782 /* SVGSymbolElement.cpp in Sources */,
 				B2227AC40D00BF220071B782 /* SVGTests.cpp in Sources */,
 				B2227AC70D00BF220071B782 /* SVGTextContentElement.cpp in Sources */,
+				1AF4CEEC18BC3C1B00BC2D34 /* VisitedLinkProvider.cpp in Sources */,
 				B2227ACA0D00BF220071B782 /* SVGTextElement.cpp in Sources */,
 				B2227ACD0D00BF220071B782 /* SVGTextPathElement.cpp in Sources */,
 				B2227AD00D00BF220071B782 /* SVGTextPositioningElement.cpp in Sources */,
@@ -28836,6 +28844,7 @@
 				B2227AEF0D00BF220071B782 /* SVGViewElement.cpp in Sources */,
 				B2227AF20D00BF220071B782 /* SVGViewSpec.cpp in Sources */,
 				8485228A1190173C006EDC7F /* SVGVKernElement.cpp in Sources */,
+				1AF4CEE918BC350100BC2D34 /* DefaultVisitedLinkProvider.cpp in Sources */,
 				B2227AF50D00BF220071B782 /* SVGZoomAndPan.cpp in Sources */,
 				B2E4EC970D00C22B00432643 /* SVGZoomEvent.cpp in Sources */,
 				E180811216FCF42F00B80D07 /* SynchronousLoaderClient.cpp in Sources */,
@@ -28973,7 +28982,6 @@
 				93309E1F099E64920056E581 /* VisiblePosition.cpp in Sources */,
 				A883DF270F3D045D00F19BF6 /* VisibleSelection.cpp in Sources */,
 				93309E1D099E64920056E581 /* VisibleUnits.cpp in Sources */,
-				1ABA80061897355500DCE9D6 /* VisitedLinkProvider.cpp in Sources */,
 				419BC2DE1685329900D64D6D /* VisitedLinkState.cpp in Sources */,
 				BE20507918A458680080647E /* VTTCue.cpp in Sources */,
 				A14832B1187F61E100DA63A6 /* WAKAppKitStubs.m in Sources */,

Modified: trunk/Source/WebCore/dom/VisitedLinkState.cpp (164623 => 164624)


--- trunk/Source/WebCore/dom/VisitedLinkState.cpp	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Source/WebCore/dom/VisitedLinkState.cpp	2014-02-25 03:33:27 UTC (rev 164624)
@@ -34,8 +34,7 @@
 #include "HTMLAnchorElement.h"
 #include "Page.h"
 #include "PageGroup.h"
-#include "PlatformStrategies.h"
-#include "VisitedLinkStrategy.h"
+#include "VisitedLinkProvider.h"
 #include "XLinkNames.h"
 
 namespace WebCore {
@@ -119,7 +118,10 @@
 
     m_linksCheckedForVisitedState.add(hash);
 
-    return platformStrategies()->visitedLinkStrategy()->isLinkVisited(page, hash, element.document().baseURL(), *attribute) ? InsideVisitedLink : InsideUnvisitedLink;
+    if (!page->visitedLinkProvider().isLinkVisited(*page, hash, element.document().baseURL(), *attribute))
+        return InsideUnvisitedLink;
+
+    return InsideVisitedLink;
 }
 
-}
+} // namespace WebCore

Modified: trunk/Source/WebCore/loader/HistoryController.cpp (164623 => 164624)


--- trunk/Source/WebCore/loader/HistoryController.cpp	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Source/WebCore/loader/HistoryController.cpp	2014-02-25 03:33:27 UTC (rev 164624)
@@ -46,17 +46,16 @@
 #include "Page.h"
 #include "PageCache.h"
 #include "PageGroup.h"
-#include "PlatformStrategies.h"
 #include "ScrollingCoordinator.h"
 #include "Settings.h"
-#include "VisitedLinkStrategy.h"
+#include "VisitedLinkProvider.h"
 #include <wtf/text/CString.h>
 
 namespace WebCore {
 
-static inline void addVisitedLink(Page* page, const URL& url)
+static inline void addVisitedLink(Page& page, const URL& url)
 {
-    platformStrategies()->visitedLinkStrategy()->addVisitedLink(page, visitedLinkHash(url.string()));
+    page.visitedLinkProvider().addVisitedLink(page, visitedLinkHash(url.string()));
 }
 
 HistoryController::HistoryController(Frame& frame)
@@ -372,7 +371,7 @@
 
     if (!historyURL.isEmpty() && !needPrivacy) {
         if (Page* page = m_frame.page())
-            addVisitedLink(page, historyURL);
+            addVisitedLink(*page, historyURL);
 
         if (!frameLoader.documentLoader()->didCreateGlobalHistoryEntry() && frameLoader.documentLoader()->unreachableURL().isEmpty() && !m_frame.document()->url().isEmpty())
             frameLoader.client().updateGlobalHistoryRedirectLinks();
@@ -413,7 +412,7 @@
 
     if (!historyURL.isEmpty() && !needPrivacy) {
         if (Page* page = m_frame.page())
-            addVisitedLink(page, historyURL);
+            addVisitedLink(*page, historyURL);
 
         if (!m_frame.loader().documentLoader()->didCreateGlobalHistoryEntry() && m_frame.loader().documentLoader()->unreachableURL().isEmpty() && !m_frame.document()->url().isEmpty())
             m_frame.loader().client().updateGlobalHistoryRedirectLinks();
@@ -439,7 +438,7 @@
 
     if (!historyURL.isEmpty() && !needPrivacy) {
         if (Page* page = m_frame.page())
-            addVisitedLink(page, historyURL);
+            addVisitedLink(*page, historyURL);
     }
 }
 
@@ -531,7 +530,7 @@
     if (!page)
         return;
 
-    addVisitedLink(page, m_frame.document()->url());
+    addVisitedLink(*page, m_frame.document()->url());
     m_frame.mainFrame().loader().history().recursiveUpdateForSameDocumentNavigation();
 
     if (m_currentItem) {
@@ -851,7 +850,7 @@
     if (m_frame.settings().privateBrowsingEnabled())
         return;
 
-    addVisitedLink(page, URL(ParsedURLString, urlString));
+    addVisitedLink(*page, URL(ParsedURLString, urlString));
     m_frame.loader().client().updateGlobalHistory();
 }
 
@@ -871,7 +870,7 @@
         return;
 
     ASSERT(m_frame.page());
-    addVisitedLink(m_frame.page(), URL(ParsedURLString, urlString));
+    addVisitedLink(*m_frame.page(), URL(ParsedURLString, urlString));
     m_frame.loader().client().updateGlobalHistory();
 }
 

Copied: trunk/Source/WebCore/page/DefaultVisitedLinkProvider.cpp (from rev 164619, trunk/Source/WebCore/page/VisitedLinkProvider.h) (0 => 164624)


--- trunk/Source/WebCore/page/DefaultVisitedLinkProvider.cpp	                        (rev 0)
+++ trunk/Source/WebCore/page/DefaultVisitedLinkProvider.cpp	2014-02-25 03:33:27 UTC (rev 164624)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DefaultVisitedLinkProvider.h"
+
+#include "PlatformStrategies.h"
+#include "VisitedLinkStrategy.h"
+
+namespace WebCore {
+
+PassRefPtr<DefaultVisitedLinkProvider> DefaultVisitedLinkProvider::create()
+{
+    return adoptRef(new DefaultVisitedLinkProvider);
+}
+
+DefaultVisitedLinkProvider::DefaultVisitedLinkProvider()
+{
+}
+
+DefaultVisitedLinkProvider::~DefaultVisitedLinkProvider()
+{
+}
+
+bool DefaultVisitedLinkProvider::isLinkVisited(Page& page, LinkHash linkHash, const URL& baseURL, const AtomicString& attributeURL)
+{
+    return platformStrategies()->visitedLinkStrategy()->isLinkVisited(&page, linkHash, baseURL, attributeURL);
+}
+
+void DefaultVisitedLinkProvider::addVisitedLink(Page& page, LinkHash linkHash)
+{
+    platformStrategies()->visitedLinkStrategy()->addVisitedLink(&page, linkHash);
+}
+
+} // namespace WebCore

Copied: trunk/Source/WebCore/page/DefaultVisitedLinkProvider.h (from rev 164619, trunk/Source/WebCore/page/VisitedLinkProvider.h) (0 => 164624)


--- trunk/Source/WebCore/page/DefaultVisitedLinkProvider.h	                        (rev 0)
+++ trunk/Source/WebCore/page/DefaultVisitedLinkProvider.h	2014-02-25 03:33:27 UTC (rev 164624)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DefaultVisitedLinkProvider_h
+#define DefaultVisitedLinkProvider_h
+
+#include "VisitedLinkProvider.h"
+
+namespace WebCore {
+
+class DefaultVisitedLinkProvider : public VisitedLinkProvider {
+public:
+    static PassRefPtr<DefaultVisitedLinkProvider> create();
+    virtual ~DefaultVisitedLinkProvider();
+
+private:
+    DefaultVisitedLinkProvider();
+
+    virtual bool isLinkVisited(Page&, LinkHash, const URL& baseURL, const AtomicString& attributeURL) override;
+    virtual void addVisitedLink(Page&, LinkHash) override;
+};
+
+} // namespace WebCore
+
+#endif // DefaultVisitedLinkProvider_h

Modified: trunk/Source/WebCore/page/Page.cpp (164623 => 164624)


--- trunk/Source/WebCore/page/Page.cpp	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Source/WebCore/page/Page.cpp	2014-02-25 03:33:27 UTC (rev 164624)
@@ -1511,6 +1511,12 @@
     m_sessionID = sessionID;
 }
 
+VisitedLinkProvider& Page::visitedLinkProvider()
+{
+    // FIXME: This shouldn't always return the group visited link provider.
+    return group().visitedLinkProvider();
+}
+
 Page::PageClients::PageClients()
     : alternativeTextClient(nullptr)
     , chromeClient(nullptr)

Modified: trunk/Source/WebCore/page/Page.h (164623 => 164624)


--- trunk/Source/WebCore/page/Page.h	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Source/WebCore/page/Page.h	2014-02-25 03:33:27 UTC (rev 164624)
@@ -106,6 +106,7 @@
 class StorageNamespace;
 class UserContentController;
 class ValidationMessageClient;
+class VisitedLinkProvider;
 
 typedef uint64_t LinkHash;
 
@@ -398,6 +399,9 @@
 
     void setUserContentController(UserContentController*);
     UserContentController* userContentController() { return m_userContentController.get(); }
+
+    VisitedLinkProvider& visitedLinkProvider();
+
     SessionID sessionID() const;
     void setSessionID(SessionID);
 

Modified: trunk/Source/WebCore/page/PageGroup.cpp (164623 => 164624)


--- trunk/Source/WebCore/page/PageGroup.cpp	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Source/WebCore/page/PageGroup.cpp	2014-02-25 03:33:27 UTC (rev 164624)
@@ -29,6 +29,7 @@
 #include "Chrome.h"
 #include "ChromeClient.h"
 #include "DOMWrapperWorld.h"
+#include "DefaultVisitedLinkProvider.h"
 #include "Document.h"
 #include "DocumentStyleSheetCollection.h"
 #include "GroupSettings.h"
@@ -64,7 +65,6 @@
 
 PageGroup::PageGroup(const String& name)
     : m_name(name)
-    , m_visitedLinkProvider(VisitedLinkProvider::create())
     , m_visitedLinksPopulated(false)
     , m_identifier(getUniqueIdentifier())
     , m_userContentController(UserContentController::create())
@@ -73,8 +73,7 @@
 }
 
 PageGroup::PageGroup(Page& page)
-    : m_visitedLinkProvider(VisitedLinkProvider::create())
-    , m_visitedLinksPopulated(false)
+    : m_visitedLinksPopulated(false)
     , m_identifier(getUniqueIdentifier())
     , m_userContentController(UserContentController::create())
     , m_groupSettings(std::make_unique<GroupSettings>())
@@ -179,6 +178,14 @@
     page.setUserContentController(nullptr);
 }
 
+VisitedLinkProvider& PageGroup::visitedLinkProvider()
+{
+    if (!m_visitedLinkProvider)
+        m_visitedLinkProvider = DefaultVisitedLinkProvider::create();
+
+    return *m_visitedLinkProvider;
+}
+
 bool PageGroup::isLinkVisited(LinkHash visitedLinkHash)
 {
     if (!m_visitedLinksPopulated) {

Modified: trunk/Source/WebCore/page/PageGroup.h (164623 => 164624)


--- trunk/Source/WebCore/page/PageGroup.h	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Source/WebCore/page/PageGroup.h	2014-02-25 03:33:27 UTC (rev 164624)
@@ -72,7 +72,7 @@
         void addPage(Page&);
         void removePage(Page&);
 
-        VisitedLinkProvider& visitedLinkProvider() { return *m_visitedLinkProvider; }
+        VisitedLinkProvider& visitedLinkProvider();
 
         bool isLinkVisited(LinkHash);
 

Modified: trunk/Source/WebCore/page/VisitedLinkProvider.h (164623 => 164624)


--- trunk/Source/WebCore/page/VisitedLinkProvider.h	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Source/WebCore/page/VisitedLinkProvider.h	2014-02-25 03:33:27 UTC (rev 164624)
@@ -38,16 +38,14 @@
 
 class VisitedLinkProvider : public RefCounted<VisitedLinkProvider> {
 public:
-    static PassRefPtr<VisitedLinkProvider> create()
-    {
-        return adoptRef(new VisitedLinkProvider);
-    }
-    ~VisitedLinkProvider();
-
-private:
     VisitedLinkProvider();
+    virtual ~VisitedLinkProvider();
+
+    // FIXME: These two members should only take the link hash.
+    virtual bool isLinkVisited(Page&, LinkHash, const URL& baseURL, const AtomicString& attributeURL) = 0;
+    virtual void addVisitedLink(Page&, LinkHash) = 0;
 };
 
-}
+} // namespace WebCore
 
 #endif // VisitedLinkProvider_h

Modified: trunk/Tools/ChangeLog (164623 => 164624)


--- trunk/Tools/ChangeLog	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Tools/ChangeLog	2014-02-25 03:33:27 UTC (rev 164624)
@@ -1,3 +1,18 @@
+2014-02-24  Anders Carlsson  <[email protected]>
+
+        Add a DefaultVisitedLinkProvider and route visited link actions through it
+        https://bugs.webkit.org/show_bug.cgi?id=129285
+
+        Reviewed by Dan Bernstein.
+
+        * MiniBrowser/mac/AppDelegate.m:
+        (-[BrowserAppDelegate applicationDidFinishLaunching:]):
+        Set a shared history so we'll get visited link tracking.
+
+        * MiniBrowser/mac/WK1BrowserWindowController.m:
+        (-[WK1BrowserWindowController awakeFromNib]):
+        Set a group name.
+
 2014-02-24  Dan Bernstein  <[email protected]>
 
         iOS build fix after r164577.

Modified: trunk/Tools/MiniBrowser/mac/AppDelegate.m (164623 => 164624)


--- trunk/Tools/MiniBrowser/mac/AppDelegate.m	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Tools/MiniBrowser/mac/AppDelegate.m	2014-02-25 03:33:27 UTC (rev 164624)
@@ -27,7 +27,7 @@
 
 #import "WK1BrowserWindowController.h"
 #import "WK2BrowserWindowController.h"
-
+#import <WebKit/WebHistory.h>
 #import <WebKit2/WebKit2.h>
 #import <WebKit2/WKStringCF.h>
 #import <WebKit2/WKURLCF.h>
@@ -83,6 +83,10 @@
 
 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
 {
+    WebHistory *webHistory = [[WebHistory alloc] init];
+    [WebHistory setOptionalSharedHistory:webHistory];
+    [webHistory release];
+
     [self newWindow:self];
 }
 

Modified: trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m (164623 => 164624)


--- trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m	2014-02-25 03:00:59 UTC (rev 164623)
+++ trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m	2014-02-25 03:33:27 UTC (rev 164624)
@@ -36,7 +36,7 @@
 
 - (void)awakeFromNib
 {
-    _webView = [[WebView alloc] initWithFrame:[containerView bounds]];
+    _webView = [[WebView alloc] initWithFrame:[containerView bounds] frameName:nil groupName:@"MiniBrowser"];
     [_webView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
 
     // Set the WebView delegates
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to