Title: [116167] trunk/Source/WebCore
Revision
116167
Author
[email protected]
Date
2012-05-04 14:16:30 -0700 (Fri, 04 May 2012)

Log Message

Move markPagesForFullStyleRecalc to PageCache
https://bugs.webkit.org/show_bug.cgi?id=85664

Reviewed by Dan Bernstein.

Instead of going through all the history items in the back/forward list looking for cached pages, just iterate over the cached pages in the page.

* history/BackForwardController.cpp:
* history/BackForwardController.h:
* history/HistoryItem.cpp:
* history/HistoryItem.h:
* history/PageCache.cpp:
(WebCore::PageCache::markPagesForFullStyleRecalc):
(WebCore):
* history/PageCache.h:
(PageCache):
* page/Frame.cpp:
(WebCore::Frame::setPageAndTextZoomFactors):
* page/Page.cpp:
(WebCore::Page::setDeviceScaleFactor):
(WebCore::Page::setPagination):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (116166 => 116167)


--- trunk/Source/WebCore/ChangeLog	2012-05-04 21:15:13 UTC (rev 116166)
+++ trunk/Source/WebCore/ChangeLog	2012-05-04 21:16:30 UTC (rev 116167)
@@ -1,3 +1,27 @@
+2012-05-04  Anders Carlsson  <[email protected]>
+
+        Move markPagesForFullStyleRecalc to PageCache
+        https://bugs.webkit.org/show_bug.cgi?id=85664
+
+        Reviewed by Dan Bernstein.
+
+        Instead of going through all the history items in the back/forward list looking for cached pages, just iterate over the cached pages in the page.
+
+        * history/BackForwardController.cpp:
+        * history/BackForwardController.h:
+        * history/HistoryItem.cpp:
+        * history/HistoryItem.h:
+        * history/PageCache.cpp:
+        (WebCore::PageCache::markPagesForFullStyleRecalc):
+        (WebCore):
+        * history/PageCache.h:
+        (PageCache):
+        * page/Frame.cpp:
+        (WebCore::Frame::setPageAndTextZoomFactors):
+        * page/Page.cpp:
+        (WebCore::Page::setDeviceScaleFactor):
+        (WebCore::Page::setPagination):
+
 2012-05-04  Tony Chang  <[email protected]>
 
         The computed style of flex-item-align should never be auto.

Modified: trunk/Source/WebCore/history/BackForwardController.cpp (116166 => 116167)


--- trunk/Source/WebCore/history/BackForwardController.cpp	2012-05-04 21:15:13 UTC (rev 116166)
+++ trunk/Source/WebCore/history/BackForwardController.cpp	2012-05-04 21:16:30 UTC (rev 116167)
@@ -109,21 +109,4 @@
     m_client->close();
 }
 
-void BackForwardController::markPagesForFullStyleRecalc()
-{
-    int first = -backCount();
-    int last = forwardCount();
-    for (int i = first; i <= last; i++) {
-        if (!i)
-            continue;
-
-        // FIXME: itemAtIndex should never return null here, but due to the way the
-        // back/forward list is implemented in WebKit2 it sometimes can, when the
-        // session has been updated in the UI process but the session update message
-        // hasn't yet reached the web process.
-        if (HistoryItem* historyItem = itemAtIndex(i))
-            historyItem->markForFullStyleRecalc();
-    }
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/history/BackForwardController.h (116166 => 116167)


--- trunk/Source/WebCore/history/BackForwardController.h	2012-05-04 21:15:13 UTC (rev 116166)
+++ trunk/Source/WebCore/history/BackForwardController.h	2012-05-04 21:16:30 UTC (rev 116167)
@@ -68,8 +68,6 @@
     HistoryItem* currentItem() { return itemAtIndex(0); }
     HistoryItem* forwardItem() { return itemAtIndex(1); }
 
-    void markPagesForFullStyleRecalc();
-
 private:
     BackForwardController(Page*, PassRefPtr<BackForwardList>);
 

Modified: trunk/Source/WebCore/history/HistoryItem.cpp (116166 => 116167)


--- trunk/Source/WebCore/history/HistoryItem.cpp	2012-05-04 21:15:13 UTC (rev 116166)
+++ trunk/Source/WebCore/history/HistoryItem.cpp	2012-05-04 21:16:30 UTC (rev 116167)
@@ -845,13 +845,6 @@
     return node.release();
 }
 
-void HistoryItem::markForFullStyleRecalc()
-{
-    // Children are guaranteed not to have CachedPages.
-    if (m_cachedPage)
-        m_cachedPage->markForFullStyleRecalc();
-}
-
 #ifndef NDEBUG
 
 int HistoryItem::showTree() const

Modified: trunk/Source/WebCore/history/HistoryItem.h (116166 => 116167)


--- trunk/Source/WebCore/history/HistoryItem.h	2012-05-04 21:15:13 UTC (rev 116166)
+++ trunk/Source/WebCore/history/HistoryItem.h	2012-05-04 21:16:30 UTC (rev 116167)
@@ -217,8 +217,6 @@
     const Vector<int>& dailyVisitCounts() const { return m_dailyVisitCounts; }
     const Vector<int>& weeklyVisitCounts() const { return m_weeklyVisitCounts; }
 
-    void markForFullStyleRecalc();
-
 private:
     HistoryItem();
     HistoryItem(const String& urlString, const String& title, double lastVisited);

Modified: trunk/Source/WebCore/history/PageCache.cpp (116166 => 116167)


--- trunk/Source/WebCore/history/PageCache.cpp	2012-05-04 21:15:13 UTC (rev 116166)
+++ trunk/Source/WebCore/history/PageCache.cpp	2012-05-04 21:16:30 UTC (rev 116167)
@@ -40,6 +40,7 @@
 #include "FrameLoader.h"
 #include "FrameLoaderClient.h"
 #include "FrameLoaderStateMachine.h"
+#include "FrameView.h"
 #include "HistogramSupport.h"
 #include "HistoryItem.h"
 #include "Logging.h"
@@ -419,6 +420,17 @@
         current->m_cachedPage->markForVistedLinkStyleRecalc();
 }
 
+void PageCache::markPagesForFullStyleRecalc(Page* page)
+{
+    Frame* mainFrame = page->mainFrame();
+
+    for (HistoryItem* current = m_head; current; current = current->m_next) {
+        CachedPage* cachedPage = current->m_cachedPage.get();
+        if (cachedPage->cachedMainFrame()->view()->frame() == mainFrame)
+            cachedPage->markForFullStyleRecalc();
+    }
+}
+
 void PageCache::add(PassRefPtr<HistoryItem> prpItem, Page* page)
 {
     ASSERT(prpItem);

Modified: trunk/Source/WebCore/history/PageCache.h (116166 => 116167)


--- trunk/Source/WebCore/history/PageCache.h	2012-05-04 21:15:13 UTC (rev 116166)
+++ trunk/Source/WebCore/history/PageCache.h	2012-05-04 21:16:30 UTC (rev 116167)
@@ -60,6 +60,9 @@
 
         void markPagesForVistedLinkStyleRecalc();
 
+        // Will mark all cached pages associated with the given page as needing style recalc.
+        void markPagesForFullStyleRecalc(Page*);
+
 #if USE(ACCELERATED_COMPOSITING)
         bool shouldClearBackingStores() const { return m_shouldClearBackingStores; }
         void setShouldClearBackingStores(bool flag) { m_shouldClearBackingStores = flag; }

Modified: trunk/Source/WebCore/page/Frame.cpp (116166 => 116167)


--- trunk/Source/WebCore/page/Frame.cpp	2012-05-04 21:15:13 UTC (rev 116166)
+++ trunk/Source/WebCore/page/Frame.cpp	2012-05-04 21:16:30 UTC (rev 116167)
@@ -66,6 +66,7 @@
 #include "Navigator.h"
 #include "NodeList.h"
 #include "Page.h"
+#include "PageCache.h"
 #include "PageGroup.h"
 #include "RegularExpression.h"
 #include "RenderPart.h"
@@ -953,7 +954,7 @@
     }
 
     if (page->mainFrame() == this)
-        page->backForward()->markPagesForFullStyleRecalc();
+        pageCache()->markPagesForFullStyleRecalc(page);
 }
 
 float Frame::frameScaleFactor() const

Modified: trunk/Source/WebCore/page/Page.cpp (116166 => 116167)


--- trunk/Source/WebCore/page/Page.cpp	2012-05-04 21:15:13 UTC (rev 116166)
+++ trunk/Source/WebCore/page/Page.cpp	2012-05-04 21:16:30 UTC (rev 116167)
@@ -52,6 +52,7 @@
 #include "MediaCanStartListener.h"
 #include "Navigator.h"
 #include "NetworkStateNotifier.h"
+#include "PageCache.h"
 #include "PageGroup.h"
 #include "PluginData.h"
 #include "PluginView.h"
@@ -682,7 +683,7 @@
     for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext())
         frame->editor()->deviceScaleFactorChanged();
 
-    backForward()->markPagesForFullStyleRecalc();
+    pageCache()->markPagesForFullStyleRecalc(this);
 }
 
 void Page::setPagination(const Pagination& pagination)
@@ -693,7 +694,7 @@
     m_pagination = pagination;
 
     setNeedsRecalcStyleInAllFrames();
-    backForward()->markPagesForFullStyleRecalc();
+    pageCache()->markPagesForFullStyleRecalc(this);
 }
 
 unsigned Page::pageCount() const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to