Title: [93669] trunk/Source/WebCore
Revision
93669
Author
bda...@apple.com
Date
2011-08-23 17:29:27 -0700 (Tue, 23 Aug 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=66244
Cached pages don't fully update when going back after changing the display scale 
factor
-and corresponding-
<rdar://problem/9955656>

Reviewed by Darin Adler.

This patch adds a generalized concept of needing a full style recalc to the 
BackForwardController. So when the display scale factor is changed, the 
BackForwardController can be informed that all pages will need a full style recalc 
when they come out of the cache. This same mechanism is also used to fix a long-
standing bug with full-page/text zoom.

Iterate through the HistoryItems and mark all CachedPages as needing a full style 
recalc.
* history/BackForwardController.cpp:
(WebCore::BackForwardController::markPagesForFullStyleRecalc):
* history/BackForwardController.h:

ChachedPage has a new bool -- m_needsFullStyleRecalc -- to track whether a full 
style recalc is needed when the CachedPage is restored.
* history/CachedPage.cpp:
(WebCore::CachedPage::CachedPage):
(WebCore::CachedPage::restore):
(WebCore::CachedPage::clear):
* history/CachedPage.h:
(WebCore::CachedPage::markForFullStyleRecalc):

HistoryItem actually takes care of calling into CachedPage.
* history/HistoryItem.cpp:
(WebCore::HistoryItem::markForFullStyleRecalc):
* history/HistoryItem.h:

Fix style recalc issues for full-page/text zoom by calling our new function on 
PageCache.
* page/Frame.cpp:
(WebCore::Frame::setPageAndTextZoomFactors):

Fix style recalc issues for display scale factor changes by calling our new 
function on PageCache.
* page/Page.cpp:
(WebCore::Page::setDeviceScaleFactor):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (93668 => 93669)


--- trunk/Source/WebCore/ChangeLog	2011-08-24 00:15:37 UTC (rev 93668)
+++ trunk/Source/WebCore/ChangeLog	2011-08-24 00:29:27 UTC (rev 93669)
@@ -1,3 +1,49 @@
+2011-08-23  Beth Dakin  <bda...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=66244
+        Cached pages don't fully update when going back after changing the display scale 
+        factor
+        -and corresponding-
+        <rdar://problem/9955656>
+
+        Reviewed by Darin Adler.
+
+        This patch adds a generalized concept of needing a full style recalc to the 
+        BackForwardController. So when the display scale factor is changed, the 
+        BackForwardController can be informed that all pages will need a full style recalc 
+        when they come out of the cache. This same mechanism is also used to fix a long-
+        standing bug with full-page/text zoom.
+
+        Iterate through the HistoryItems and mark all CachedPages as needing a full style 
+        recalc.
+        * history/BackForwardController.cpp:
+        (WebCore::BackForwardController::markPagesForFullStyleRecalc):
+        * history/BackForwardController.h:
+
+        ChachedPage has a new bool -- m_needsFullStyleRecalc -- to track whether a full 
+        style recalc is needed when the CachedPage is restored.
+        * history/CachedPage.cpp:
+        (WebCore::CachedPage::CachedPage):
+        (WebCore::CachedPage::restore):
+        (WebCore::CachedPage::clear):
+        * history/CachedPage.h:
+        (WebCore::CachedPage::markForFullStyleRecalc):
+
+        HistoryItem actually takes care of calling into CachedPage.
+        * history/HistoryItem.cpp:
+        (WebCore::HistoryItem::markForFullStyleRecalc):
+        * history/HistoryItem.h:
+
+        Fix style recalc issues for full-page/text zoom by calling our new function on 
+        PageCache.
+        * page/Frame.cpp:
+        (WebCore::Frame::setPageAndTextZoomFactors):
+
+        Fix style recalc issues for display scale factor changes by calling our new 
+        function on PageCache.
+        * page/Page.cpp:
+        (WebCore::Page::setDeviceScaleFactor):
+
 2011-08-23  Anders Carlsson  <ander...@apple.com>
 
         Fix build.

Modified: trunk/Source/WebCore/history/BackForwardController.cpp (93668 => 93669)


--- trunk/Source/WebCore/history/BackForwardController.cpp	2011-08-24 00:15:37 UTC (rev 93668)
+++ trunk/Source/WebCore/history/BackForwardController.cpp	2011-08-24 00:29:27 UTC (rev 93669)
@@ -104,4 +104,15 @@
     m_client->close();
 }
 
+void BackForwardController::markPagesForFullStyleRecalc()
+{
+    int first = -backCount();
+    int last = forwardCount();
+    for (int i = first; i <= last; i++) {
+        if (!i)
+            continue;
+        itemAtIndex(i)->markForFullStyleRecalc();
+    }
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/history/BackForwardController.h (93668 => 93669)


--- trunk/Source/WebCore/history/BackForwardController.h	2011-08-24 00:15:37 UTC (rev 93668)
+++ trunk/Source/WebCore/history/BackForwardController.h	2011-08-24 00:29:27 UTC (rev 93669)
@@ -67,6 +67,8 @@
     HistoryItem* currentItem() { return itemAtIndex(0); }
     HistoryItem* forwardItem() { return itemAtIndex(1); }
 
+    void markPagesForFullStyleRecalc();
+
 private:
     Page* m_page;
     RefPtr<BackForwardList> m_client;

Modified: trunk/Source/WebCore/history/CachedPage.cpp (93668 => 93669)


--- trunk/Source/WebCore/history/CachedPage.cpp	2011-08-24 00:15:37 UTC (rev 93668)
+++ trunk/Source/WebCore/history/CachedPage.cpp	2011-08-24 00:29:27 UTC (rev 93669)
@@ -54,6 +54,7 @@
     : m_timeStamp(currentTime())
     , m_cachedMainFrame(CachedFrame::create(page->mainFrame()))
     , m_needStyleRecalcForVisitedLinks(false)
+    , m_needsFullStyleRecalc(false)
 {
 #ifndef NDEBUG
     cachedPageCounter.increment();
@@ -93,6 +94,9 @@
         }
     }
 
+    if (m_needsFullStyleRecalc)
+        page->setNeedsRecalcStyleInAllFrames();
+
     clear();
 }
 
@@ -102,6 +106,7 @@
     m_cachedMainFrame->clear();
     m_cachedMainFrame = 0;
     m_needStyleRecalcForVisitedLinks = false;
+    m_needsFullStyleRecalc = false;
 }
 
 void CachedPage::destroy()

Modified: trunk/Source/WebCore/history/CachedPage.h (93668 => 93669)


--- trunk/Source/WebCore/history/CachedPage.h	2011-08-24 00:15:37 UTC (rev 93668)
+++ trunk/Source/WebCore/history/CachedPage.h	2011-08-24 00:29:27 UTC (rev 93669)
@@ -51,6 +51,7 @@
     CachedFrame* cachedMainFrame() { return m_cachedMainFrame.get(); }
 
     void markForVistedLinkStyleRecalc() { m_needStyleRecalcForVisitedLinks = true; }
+    void markForFullStyleRecalc() { m_needsFullStyleRecalc = true; }
 
 private:
     CachedPage(Page*);
@@ -58,6 +59,7 @@
     double m_timeStamp;
     RefPtr<CachedFrame> m_cachedMainFrame;
     bool m_needStyleRecalcForVisitedLinks;
+    bool m_needsFullStyleRecalc;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/history/HistoryItem.cpp (93668 => 93669)


--- trunk/Source/WebCore/history/HistoryItem.cpp	2011-08-24 00:15:37 UTC (rev 93668)
+++ trunk/Source/WebCore/history/HistoryItem.cpp	2011-08-24 00:29:27 UTC (rev 93669)
@@ -845,6 +845,13 @@
     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 (93668 => 93669)


--- trunk/Source/WebCore/history/HistoryItem.h	2011-08-24 00:15:37 UTC (rev 93668)
+++ trunk/Source/WebCore/history/HistoryItem.h	2011-08-24 00:29:27 UTC (rev 93669)
@@ -207,6 +207,8 @@
     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/page/Frame.cpp (93668 => 93669)


--- trunk/Source/WebCore/page/Frame.cpp	2011-08-24 00:15:37 UTC (rev 93668)
+++ trunk/Source/WebCore/page/Frame.cpp	2011-08-24 00:29:27 UTC (rev 93669)
@@ -30,6 +30,7 @@
 #include "Frame.h"
 
 #include "ApplyStyleCommand.h"
+#include "BackForwardController.h"
 #include "CSSComputedStyleDeclaration.h"
 #include "CSSMutableStyleDeclaration.h"
 #include "CSSProperty.h"
@@ -1069,6 +1070,9 @@
         if (document->renderer() && document->renderer()->needsLayout() && view->didFirstLayout())
             view->layout();
     }
+
+    if (page->mainFrame() == this)
+        page->backForward()->markPagesForFullStyleRecalc();
 }
 
 #if USE(ACCELERATED_COMPOSITING)

Modified: trunk/Source/WebCore/page/Page.cpp (93668 => 93669)


--- trunk/Source/WebCore/page/Page.cpp	2011-08-24 00:15:37 UTC (rev 93668)
+++ trunk/Source/WebCore/page/Page.cpp	2011-08-24 00:29:27 UTC (rev 93669)
@@ -596,6 +596,8 @@
 #if USE(ACCELERATED_COMPOSITING)
     m_mainFrame->deviceOrPageScaleFactorChanged();
 #endif
+
+    backForward()->markPagesForFullStyleRecalc();
 }
 
 void Page::didMoveOnscreen()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to