2011-04-16 Sam Weinig <sam@webkit.org>
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Apr 2011 19:31:42 +0000 (19:31 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Apr 2011 19:31:42 +0000 (19:31 +0000)
        Reviewed by Simon Fraser.

        Pages in the PageCache don't have the correct visited link coloring after being restored
        https://bugs.webkit.org/show_bug.cgi?id=58721

        * WebCore.exp.in:
        Add export of markPagesForVistedLinkStyleRecalc for use by WebKit2.

        * history/CachedPage.cpp:
        (WebCore::CachedPage::CachedPage):
        (WebCore::CachedPage::restore):
        (WebCore::CachedPage::clear):
        * history/CachedPage.h:
        (WebCore::CachedPage::markForVistedLinkStyleRecalc):
        Add bit, set by calling markForVistedLinkStyleRecalc, which forces a visited link
        style recalc when being restored.

        * history/PageCache.h:
        * history/PageCache.cpp:
        (WebCore::PageCache::markPagesForVistedLinkStyleRecalc):
        Mark all pages in the page cache as requiring visited link style recalc.

        * page/PageGroup.cpp:
        (WebCore::PageGroup::addVisitedLink):
        (WebCore::PageGroup::removeVisitedLinks):
        (WebCore::PageGroup::removeAllVisitedLinks):
        Set dirty bit when changing any visited link information.

2011-04-16  Sam Weinig  <sam@webkit.org>

        Reviewed by Simon Fraser.

        Pages in the PageCache don't have the correct visited link coloring after being restored
        https://bugs.webkit.org/show_bug.cgi?id=58721

        * WebProcess/WebProcess.cpp:
        (WebKit::WebProcess::visitedLinkStateChanged):
        (WebKit::WebProcess::allVisitedLinkStateChanged):
        Mark all pages in the page cache as needing visited link style recalc
        whenever visited link information changes.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@84091 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/history/CachedPage.cpp
Source/WebCore/history/CachedPage.h
Source/WebCore/history/PageCache.cpp
Source/WebCore/history/PageCache.h
Source/WebCore/page/PageGroup.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebProcess.cpp

index 6972867..f48ba79 100644 (file)
@@ -1,3 +1,34 @@
+2011-04-16  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Simon Fraser.
+
+        Pages in the PageCache don't have the correct visited link coloring after being restored
+        https://bugs.webkit.org/show_bug.cgi?id=58721
+
+        * WebCore.exp.in:
+        Add export of markPagesForVistedLinkStyleRecalc for use by WebKit2.
+
+        * history/CachedPage.cpp:
+        (WebCore::CachedPage::CachedPage):
+        (WebCore::CachedPage::restore):
+        (WebCore::CachedPage::clear):
+        * history/CachedPage.h:
+        (WebCore::CachedPage::markForVistedLinkStyleRecalc):
+        Add bit, set by calling markForVistedLinkStyleRecalc, which forces a visited link
+        style recalc when being restored.
+
+        * history/PageCache.h:
+        * history/PageCache.cpp:
+        (WebCore::PageCache::markPagesForVistedLinkStyleRecalc):
+        Mark all pages in the page cache as requiring visited link style recalc.
+
+        * page/PageGroup.cpp:
+        (WebCore::PageGroup::addVisitedLink):
+        (WebCore::PageGroup::removeVisitedLinks):
+        (WebCore::PageGroup::removeAllVisitedLinks):
+        Set dirty bit when changing any visited link information.
+        
+
 2011-04-16  Leo Yang  <leoyang.webkit@gmail.com>
 
         Reviewed by Nikolas Zimmermann.
index a4b8231..6f35870 100644 (file)
@@ -538,8 +538,8 @@ __ZN7WebCore20ResourceResponseBaseC2Ev
 __ZN7WebCore20SpaceSplitStringData12createVectorEv
 __ZN7WebCore20UserGestureIndicatorC1ENS_26ProcessingUserGestureStateE
 __ZN7WebCore20UserGestureIndicatorD1Ev
-__ZN7WebCore20protocolIsJavaScriptERKN3WTF6StringE
 __ZN7WebCore20makeRGBA32FromFloatsEffff
+__ZN7WebCore20protocolIsJavaScriptERKN3WTF6StringE
 __ZN7WebCore21BackForwardController11itemAtIndexEi
 __ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS0_4TypeEb
 __ZN7WebCore21PlatformKeyboardEventC1EP7NSEvent
@@ -712,6 +712,7 @@ __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_8NodeListE
 __ZN7WebCore5Color11transparentE
 __ZN7WebCore5Color5whiteE
 __ZN7WebCore5Frame10createViewERKNS_7IntSizeERKNS_5ColorEbS3_bNS_13ScrollbarModeEbS7_b
+__ZN7WebCore5Frame13rangeForPointERKNS_8IntPointE
 __ZN7WebCore5Frame14frameForWidgetEPKNS_6WidgetE
 __ZN7WebCore5Frame17setPageZoomFactorEf
 __ZN7WebCore5Frame17setTextZoomFactorEf
@@ -723,7 +724,6 @@ __ZN7WebCore5Frame6createEPNS_4PageEPNS_21HTMLFrameOwnerElementEPNS_17FrameLoade
 __ZN7WebCore5Frame7setViewEN3WTF10PassRefPtrINS_9FrameViewEEE
 __ZN7WebCore5Frame9nodeImageEPNS_4NodeE
 __ZN7WebCore5Frame9scalePageEfRKNS_8IntPointE
-__ZN7WebCore5Frame13rangeForPointERKNS_8IntPointE
 __ZN7WebCore5FrameD1Ev
 __ZN7WebCore5Image12supportsTypeERKN3WTF6StringE
 __ZN7WebCore5Image20loadPlatformResourceEPKc
@@ -876,7 +876,6 @@ __ZN7WebCore8Settings26setDefaultTextEncodingNameERKN3WTF6StringE
 __ZN7WebCore8Settings26setNeedsSiteSpecificQuirksEb
 __ZN7WebCore8Settings27setFTPDirectoryTemplatePathERKN3WTF6StringE
 __ZN7WebCore8Settings27setLoadsImagesAutomaticallyEb
-__ZN7WebCore8Settings44setLoadsSiteIconsIgnoringImageLoadingSettingEb
 __ZN7WebCore8Settings27setLocalStorageDatabasePathERKN3WTF6StringE
 __ZN7WebCore8Settings27setSpatialNavigationEnabledEb
 __ZN7WebCore8Settings28setAcceleratedDrawingEnabledEb
@@ -901,6 +900,7 @@ __ZN7WebCore8Settings36setOfflineWebApplicationCacheEnabledEb
 __ZN7WebCore8Settings40setJavaScriptCanOpenWindowsAutomaticallyEb
 __ZN7WebCore8Settings40setTextDirectionSubmenuInclusionBehaviorENS_37TextDirectionSubmenuInclusionBehaviorE
 __ZN7WebCore8Settings41setNeedsKeyboardEventDisambiguationQuirksEb
+__ZN7WebCore8Settings44setLoadsSiteIconsIgnoringImageLoadingSettingEb
 __ZN7WebCore8blankURLEv
 __ZN7WebCore8makeRGBAEiiii
 __ZN7WebCore8openFileERKN3WTF6StringENS_12FileOpenModeE
@@ -978,6 +978,7 @@ __ZN7WebCore9HTMLNames9scriptTagE
 __ZN7WebCore9JSElement6s_infoE
 __ZN7WebCore9PageCache11setCapacityEi
 __ZN7WebCore9PageCache27releaseAutoreleasedPagesNowEv
+__ZN7WebCore9PageCache33markPagesForVistedLinkStyleRecalcEv
 __ZN7WebCore9PageGroup13isLinkVisitedEy
 __ZN7WebCore9PageGroup14addVisitedLinkEPKtm
 __ZN7WebCore9PageGroup17closeLocalStorageEv
@@ -1220,7 +1221,6 @@ __ZNK7WebCore5Range9firstNodeEv
 __ZNK7WebCore5Range9textQuadsERN3WTF6VectorINS_9FloatQuadELm0EEEb
 __ZNK7WebCore6Chrome12createWindowEPNS_5FrameERKNS_16FrameLoadRequestERKNS_14WindowFeaturesERKNS_16NavigationActionE
 __ZNK7WebCore6Cursor14platformCursorEv
-__ZNK7WebCore6Editor8behaviorEv
 __ZNK7WebCore6Editor12selectedTextEv
 __ZNK7WebCore6Editor13canEditRichlyEv
 __ZNK7WebCore6Editor16compositionRangeEv
@@ -1242,6 +1242,7 @@ __ZNK7WebCore6Editor7Command7executeERKN3WTF6StringEPNS_5EventE
 __ZNK7WebCore6Editor7Command9isEnabledEPNS_5EventE
 __ZNK7WebCore6Editor7canCopyEv
 __ZNK7WebCore6Editor7canEditEv
+__ZNK7WebCore6Editor8behaviorEv
 __ZNK7WebCore6Editor8canPasteEv
 __ZNK7WebCore6Editor9canDeleteEv
 __ZNK7WebCore6Widget14platformWidgetEv
index acbfd31..1eb7af6 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "CachedPage.h"
 
+#include "CSSStyleSelector.h"
 #include "FocusController.h"
 #include "Frame.h"
 #include "FrameView.h"
@@ -49,6 +50,7 @@ PassRefPtr<CachedPage> CachedPage::create(Page* page)
 CachedPage::CachedPage(Page* page)
     : m_timeStamp(currentTime())
     , m_cachedMainFrame(CachedFrame::create(page->mainFrame()))
+    , m_needStyleRecalcForVisitedLinks(false)
 {
 #ifndef NDEBUG
     cachedPageCounter.increment();
@@ -80,7 +82,14 @@ void CachedPage::restore(Page* page)
         if (node->isElementNode())
             static_cast<Element*>(node)->updateFocusAppearance(true);
     }
-    
+
+    if (m_needStyleRecalcForVisitedLinks) {
+        for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+            if (CSSStyleSelector* styleSelector = frame->document()->styleSelector())
+                styleSelector->allVisitedStateChanged();
+        }
+    }
+
     clear();
 }
 
@@ -89,6 +98,7 @@ void CachedPage::clear()
     ASSERT(m_cachedMainFrame);
     m_cachedMainFrame->clear();
     m_cachedMainFrame = 0;
+    m_needStyleRecalcForVisitedLinks = false;
 }
 
 void CachedPage::destroy()
index 4741c79..8a226be 100644 (file)
@@ -50,11 +50,14 @@ public:
     
     CachedFrame* cachedMainFrame() { return m_cachedMainFrame.get(); }
 
+    void markForVistedLinkStyleRecalc() { m_needStyleRecalcForVisitedLinks = true; }
+
 private:
     CachedPage(Page*);
 
     double m_timeStamp;
     RefPtr<CachedFrame> m_cachedMainFrame;
+    bool m_needStyleRecalcForVisitedLinks;
 };
 
 } // namespace WebCore
index d57df65..204ab36 100644 (file)
@@ -341,6 +341,12 @@ int PageCache::autoreleasedPageCount() const
     return m_autoreleaseSet.size();
 }
 
+void PageCache::markPagesForVistedLinkStyleRecalc()
+{
+    for (HistoryItem* current = m_head; current; current = current->m_next)
+        current->m_cachedPage->markForVistedLinkStyleRecalc();
+}
+
 void PageCache::add(PassRefPtr<HistoryItem> prpItem, Page* page)
 {
     ASSERT(prpItem);
index 912bd65..1bd2e13 100644 (file)
@@ -59,6 +59,8 @@ namespace WebCore {
         int frameCount() const;
         int autoreleasedPageCount() const;
 
+        void markPagesForVistedLinkStyleRecalc();
+
     private:
         typedef HashSet<RefPtr<CachedPage> > CachedPageSet;
 
index 32681f8..f987053 100644 (file)
@@ -33,6 +33,7 @@
 #include "GroupSettings.h"
 #include "IDBFactoryBackendInterface.h"
 #include "Page.h"
+#include "PageCache.h"
 #include "SecurityOrigin.h"
 #include "Settings.h"
 #include "StorageNamespace.h"
@@ -202,6 +203,7 @@ inline void PageGroup::addVisitedLink(LinkHash hash)
         return;
 #endif
     Page::visitedStateChanged(this, hash);
+    pageCache()->markPagesForVistedLinkStyleRecalc();
 }
 
 void PageGroup::addVisitedLink(const KURL& url)
@@ -226,11 +228,13 @@ void PageGroup::removeVisitedLinks()
         return;
     m_visitedLinkHashes.clear();
     Page::allVisitedStateChanged(this);
+    pageCache()->markPagesForVistedLinkStyleRecalc();
 }
 
 void PageGroup::removeAllVisitedLinks()
 {
     Page::removeAllVisitedLinks();
+    pageCache()->markPagesForVistedLinkStyleRecalc();
 }
 
 void PageGroup::setShouldTrackVisitedLinks(bool shouldTrack)
index 168b504..8b8885e 100644 (file)
@@ -1,3 +1,16 @@
+2011-04-16  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Simon Fraser.
+
+        Pages in the PageCache don't have the correct visited link coloring after being restored
+        https://bugs.webkit.org/show_bug.cgi?id=58721
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::visitedLinkStateChanged):
+        (WebKit::WebProcess::allVisitedLinkStateChanged):
+        Mark all pages in the page cache as needing visited link style recalc
+        whenever visited link information changes.
+
 2011-04-15  Daniel Bates  <dbates@webkit.org>
 
         Attempt to fix the Qt Linux Release build after changeset 84064 <http://trac.webkit.org/changeset/84064>
index 92512bc..93a34eb 100644 (file)
@@ -59,6 +59,7 @@
 #include <WebCore/Logging.h>
 #include <WebCore/MemoryCache.h>
 #include <WebCore/Page.h>
+#include <WebCore/PageCache.h>
 #include <WebCore/PageGroup.h>
 #include <WebCore/ResourceHandle.h>
 #include <WebCore/SchemeRegistry.h>
@@ -69,7 +70,6 @@
 #include <wtf/RandomNumber.h>
 
 #ifndef NDEBUG
-#include <WebCore/MemoryCache.h>
 #include <WebCore/GCController.h>
 #endif
 
@@ -283,6 +283,8 @@ void WebProcess::visitedLinkStateChanged(const Vector<WebCore::LinkHash>& linkHa
         for (; it != end; ++it)
             Page::visitedStateChanged(PageGroup::pageGroup(it->second->identifier()), linkHashes[i]);
     }
+
+    pageCache()->markPagesForVistedLinkStyleRecalc();
 }
 
 void WebProcess::allVisitedLinkStateChanged()
@@ -292,6 +294,8 @@ void WebProcess::allVisitedLinkStateChanged()
     HashMap<uint64_t, RefPtr<WebPageGroupProxy> >::const_iterator end = m_pageGroupMap.end();
     for (; it != end; ++it)
         Page::allVisitedStateChanged(PageGroup::pageGroup(it->second->identifier()));
+
+    pageCache()->markPagesForVistedLinkStyleRecalc();
 }
 
 bool WebProcess::isLinkVisited(LinkHash linkHash) const