Title: [184481] branches/safari-601.1.32-branch/Source

Diff

Modified: branches/safari-601.1.32-branch/Source/WebCore/ChangeLog (184480 => 184481)


--- branches/safari-601.1.32-branch/Source/WebCore/ChangeLog	2015-05-18 14:23:02 UTC (rev 184480)
+++ branches/safari-601.1.32-branch/Source/WebCore/ChangeLog	2015-05-18 14:23:14 UTC (rev 184481)
@@ -1,5 +1,51 @@
 2015-05-18  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r184290. rdar://problem/19790341
+
+    2015-05-13  Timothy Horton  <timothy_hor...@apple.com>
+
+            View scale changes are temporarily lost after restoring a page from the page cache
+            https://bugs.webkit.org/show_bug.cgi?id=144934
+
+            Reviewed by Brady Eidson.
+
+            * history/CachedPage.cpp:
+            (WebCore::CachedPage::CachedPage):
+            (WebCore::CachedPage::restore):
+            (WebCore::CachedPage::clear):
+            * history/CachedPage.h:
+            (WebCore::CachedPage::markForDeviceOrPageScaleChanged): Renamed.
+            * history/PageCache.cpp:
+            (WebCore::PageCache::markPagesForDeviceOrPageScaleChanged): Renamed.
+            * history/PageCache.h:
+            Rename PageCache/CachedPage methods to make it more clear that they
+            will eventually result in calling deviceOrPageScaleFactorChanged().
+            Also, use modern initialization for CachedPage members.
+
+            * loader/HistoryController.cpp:
+            (WebCore::HistoryController::saveScrollPositionAndViewStateToItem):
+            (WebCore::HistoryController::restoreScrollPositionAndViewState):
+            Store the pageScaleFactor on HistoryItem with the view scale factored out,
+            because the view scale can change while the page is in the page cache, and
+            WebCore needs a way - without consulting with WebKit2 - to apply the changed
+            view scale to the cached page scale.
+
+            * page/Page.cpp:
+            (WebCore::Page::setViewScaleFactor):
+            (WebCore::Page::setDeviceScaleFactor):
+            * page/Page.h:
+            (WebCore::Page::viewScaleFactor):
+            Keep track of the viewScaleFactor, and mark all pages in the page cache
+            as needing to call deviceOrPageScaleFactorChanged and do a full style recalc
+            when they come back from the page cache.
+
+            For now, we expect all callers of setPageScaleFactor (including WebKit2 and
+            HistoryController) to multiply the viewScale in manually, to avoid the
+            significant amount of change in WebCore that would be required to keep them
+            totally separately.
+
+2015-05-18  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r184204. rdar://problem/20909871
 
     2015-05-12  Eric Carlson  <eric.carl...@apple.com>

Modified: branches/safari-601.1.32-branch/Source/WebCore/history/CachedPage.cpp (184480 => 184481)


--- branches/safari-601.1.32-branch/Source/WebCore/history/CachedPage.cpp	2015-05-18 14:23:02 UTC (rev 184480)
+++ branches/safari-601.1.32-branch/Source/WebCore/history/CachedPage.cpp	2015-05-18 14:23:14 UTC (rev 184481)
@@ -52,12 +52,6 @@
 CachedPage::CachedPage(Page& page)
     : m_expirationTime(monotonicallyIncreasingTime() + page.settings().backForwardCacheExpirationInterval())
     , m_cachedMainFrame(std::make_unique<CachedFrame>(page.mainFrame()))
-    , m_needStyleRecalcForVisitedLinks(false)
-    , m_needsFullStyleRecalc(false)
-#if ENABLE(VIDEO_TRACK)
-    , m_needsCaptionPreferencesChanged(false)
-#endif
-    , m_needsDeviceScaleChanged(false)
 {
 #ifndef NDEBUG
     cachedPageCounter.increment();
@@ -111,7 +105,7 @@
             frame->document()->visitedLinkState().invalidateStyleForAllLinks();
     }
 
-    if (m_needsDeviceScaleChanged)
+    if (m_needsDeviceOrPageScaleChanged)
         page.mainFrame().deviceOrPageScaleFactorChanged();
 
     if (m_needsFullStyleRecalc)
@@ -135,7 +129,7 @@
 #if ENABLE(VIDEO_TRACK)
     m_needsCaptionPreferencesChanged = false;
 #endif
-    m_needsDeviceScaleChanged = false;
+    m_needsDeviceOrPageScaleChanged = false;
 }
 
 bool CachedPage::hasExpired() const

Modified: branches/safari-601.1.32-branch/Source/WebCore/history/CachedPage.h (184480 => 184481)


--- branches/safari-601.1.32-branch/Source/WebCore/history/CachedPage.h	2015-05-18 14:23:02 UTC (rev 184480)
+++ branches/safari-601.1.32-branch/Source/WebCore/history/CachedPage.h	2015-05-18 14:23:14 UTC (rev 184481)
@@ -55,17 +55,17 @@
     void markForCaptionPreferencesChanged() { m_needsCaptionPreferencesChanged = true; }
 #endif
 
-    void markForDeviceScaleChanged() { m_needsDeviceScaleChanged = true; }
+    void markForDeviceOrPageScaleChanged() { m_needsDeviceOrPageScaleChanged = true; }
 
 private:
     double m_expirationTime;
     std::unique_ptr<CachedFrame> m_cachedMainFrame;
-    bool m_needStyleRecalcForVisitedLinks;
-    bool m_needsFullStyleRecalc;
+    bool m_needStyleRecalcForVisitedLinks { false };
+    bool m_needsFullStyleRecalc { false };
 #if ENABLE(VIDEO_TRACK)
-    bool m_needsCaptionPreferencesChanged;
+    bool m_needsCaptionPreferencesChanged { false };
 #endif
-    bool m_needsDeviceScaleChanged;
+    bool m_needsDeviceOrPageScaleChanged { false };
 };
 
 } // namespace WebCore

Modified: branches/safari-601.1.32-branch/Source/WebCore/history/PageCache.cpp (184480 => 184481)


--- branches/safari-601.1.32-branch/Source/WebCore/history/PageCache.cpp	2015-05-18 14:23:02 UTC (rev 184480)
+++ branches/safari-601.1.32-branch/Source/WebCore/history/PageCache.cpp	2015-05-18 14:23:14 UTC (rev 184481)
@@ -390,12 +390,12 @@
     }
 }
 
-void PageCache::markPagesForDeviceScaleChanged(Page& page)
+void PageCache::markPagesForDeviceOrPageScaleChanged(Page& page)
 {
     for (auto& item : m_items) {
         CachedPage& cachedPage = *item->m_cachedPage;
         if (&page.mainFrame() == &cachedPage.cachedMainFrame()->view()->frame())
-            cachedPage.markForDeviceScaleChanged();
+            cachedPage.markForDeviceOrPageScaleChanged();
     }
 }
 

Modified: branches/safari-601.1.32-branch/Source/WebCore/history/PageCache.h (184480 => 184481)


--- branches/safari-601.1.32-branch/Source/WebCore/history/PageCache.h	2015-05-18 14:23:02 UTC (rev 184480)
+++ branches/safari-601.1.32-branch/Source/WebCore/history/PageCache.h	2015-05-18 14:23:14 UTC (rev 184481)
@@ -64,7 +64,7 @@
     WEBCORE_EXPORT void markPagesForVisitedLinkStyleRecalc();
     // Will mark all cached pages associated with the given page as needing style recalc.
     void markPagesForFullStyleRecalc(Page&);
-    void markPagesForDeviceScaleChanged(Page&);
+    void markPagesForDeviceOrPageScaleChanged(Page&);
 #if ENABLE(VIDEO_TRACK)
     void markPagesForCaptionPreferencesChanged();
 #endif

Modified: branches/safari-601.1.32-branch/Source/WebCore/loader/HistoryController.cpp (184480 => 184481)


--- branches/safari-601.1.32-branch/Source/WebCore/loader/HistoryController.cpp	2015-05-18 14:23:02 UTC (rev 184480)
+++ branches/safari-601.1.32-branch/Source/WebCore/loader/HistoryController.cpp	2015-05-18 14:23:14 UTC (rev 184481)
@@ -86,7 +86,7 @@
 
     Page* page = m_frame.page();
     if (page && m_frame.isMainFrame())
-        item->setPageScaleFactor(page->pageScaleFactor());
+        item->setPageScaleFactor(page->pageScaleFactor() / page->viewScaleFactor());
 
     // FIXME: It would be great to work out a way to put this code in WebCore instead of calling through to the client.
     m_frame.loader().client().saveViewStateToItem(item);
@@ -151,7 +151,7 @@
     if (view && !view->wasScrolledByUser()) {
         Page* page = m_frame.page();
         if (page && m_frame.isMainFrame() && m_currentItem->pageScaleFactor())
-            page->setPageScaleFactor(m_currentItem->pageScaleFactor(), m_currentItem->scrollPoint());
+            page->setPageScaleFactor(m_currentItem->pageScaleFactor() * page->viewScaleFactor(), m_currentItem->scrollPoint());
         else
             view->setScrollPosition(m_currentItem->scrollPoint());
     }

Modified: branches/safari-601.1.32-branch/Source/WebCore/page/Page.cpp (184480 => 184481)


--- branches/safari-601.1.32-branch/Source/WebCore/page/Page.cpp	2015-05-18 14:23:02 UTC (rev 184480)
+++ branches/safari-601.1.32-branch/Source/WebCore/page/Page.cpp	2015-05-18 14:23:14 UTC (rev 184481)
@@ -832,6 +832,16 @@
 #endif
 }
 
+void Page::setViewScaleFactor(float scale)
+{
+    if (m_viewScaleFactor == scale)
+        return;
+
+    m_viewScaleFactor = scale;
+    PageCache::singleton().markPagesForDeviceOrPageScaleChanged(*this);
+    PageCache::singleton().markPagesForFullStyleRecalc(*this);
+}
+
 void Page::setDeviceScaleFactor(float scaleFactor)
 {
     ASSERT(scaleFactor > 0);
@@ -845,7 +855,7 @@
     setNeedsRecalcStyleInAllFrames();
 
     mainFrame().deviceOrPageScaleFactorChanged();
-    PageCache::singleton().markPagesForDeviceScaleChanged(*this);
+    PageCache::singleton().markPagesForDeviceOrPageScaleChanged(*this);
 
     PageCache::singleton().markPagesForFullStyleRecalc(*this);
     GraphicsContext::updateDocumentMarkerResources();

Modified: branches/safari-601.1.32-branch/Source/WebCore/page/Page.h (184480 => 184481)


--- branches/safari-601.1.32-branch/Source/WebCore/page/Page.h	2015-05-18 14:23:02 UTC (rev 184480)
+++ branches/safari-601.1.32-branch/Source/WebCore/page/Page.h	2015-05-18 14:23:14 UTC (rev 184481)
@@ -260,6 +260,11 @@
     WEBCORE_EXPORT void setPageScaleFactor(float scale, const IntPoint& origin, bool inStableState = true);
     float pageScaleFactor() const { return m_pageScaleFactor; }
 
+    // The view scale factor is multiplied into the page scale factor by all
+    // callers of setPageScaleFactor.
+    WEBCORE_EXPORT void setViewScaleFactor(float);
+    float viewScaleFactor() const { return m_viewScaleFactor; }
+
     WEBCORE_EXPORT void setZoomedOutPageScaleFactor(float);
     float zoomedOutPageScaleFactor() const { return m_zoomedOutPageScaleFactor; }
 
@@ -520,6 +525,7 @@
     float m_pageScaleFactor;
     float m_zoomedOutPageScaleFactor;
     float m_deviceScaleFactor;
+    float m_viewScaleFactor { 1 };
 
     float m_topContentInset;
     

Modified: branches/safari-601.1.32-branch/Source/WebKit2/ChangeLog (184480 => 184481)


--- branches/safari-601.1.32-branch/Source/WebKit2/ChangeLog	2015-05-18 14:23:02 UTC (rev 184480)
+++ branches/safari-601.1.32-branch/Source/WebKit2/ChangeLog	2015-05-18 14:23:14 UTC (rev 184481)
@@ -1,5 +1,27 @@
 2015-05-18  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r184290. rdar://problem/19790341
+
+    2015-05-13  Timothy Horton  <timothy_hor...@apple.com>
+
+            View scale changes are temporarily lost after restoring a page from the page cache
+            https://bugs.webkit.org/show_bug.cgi?id=144934
+
+            Reviewed by Brady Eidson.
+
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::WebPage):
+            (WebKit::WebPage::scalePage):
+            (WebKit::WebPage::scalePageInViewCoordinates):
+            (WebKit::WebPage::pageScaleFactor):
+            (WebKit::WebPage::viewScaleFactor):
+            (WebKit::WebPage::scaleView):
+            * WebProcess/WebPage/WebPage.h:
+            (WebKit::WebPage::viewScaleFactor): Deleted.
+            Get rid of m_viewScaleFactor, instead using Page::viewScaleFactor.
+
+2015-05-18  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r184052. rdar://problem/20890647
 
     2015-05-10  Darin Adler  <da...@apple.com>

Modified: branches/safari-601.1.32-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (184480 => 184481)


--- branches/safari-601.1.32-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-05-18 14:23:02 UTC (rev 184480)
+++ branches/safari-601.1.32-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-05-18 14:23:14 UTC (rev 184481)
@@ -338,7 +338,6 @@
     , m_processSuppressionEnabled(true)
     , m_userActivity("Process suppression disabled for page.")
     , m_pendingNavigationID(0)
-    , m_viewScaleFactor(parameters.viewScaleFactor)
 #if ENABLE(WEBGL)
     , m_systemWebGLPolicy(WebGLAllowCreation)
 #endif
@@ -506,8 +505,8 @@
 #endif
     m_page->settings().setAppleMailPaginationQuirkEnabled(parameters.appleMailPaginationQuirkEnabled);
 
-    if (m_viewScaleFactor != 1)
-        scalePage(1, IntPoint());
+    if (parameters.viewScaleFactor != 1)
+        scaleView(parameters.viewScaleFactor);
 }
 
 void WebPage::reinitializeWebPage(const WebPageCreationParameters& parameters)
@@ -1374,7 +1373,7 @@
 
 void WebPage::scalePage(double scale, const IntPoint& origin)
 {
-    double totalScale = scale * m_viewScaleFactor;
+    double totalScale = scale * viewScaleFactor();
     bool willChangeScaleFactor = totalScale != totalScaleFactor();
 
 #if PLATFORM(IOS)
@@ -1407,7 +1406,7 @@
 
 void WebPage::scalePageInViewCoordinates(double scale, IntPoint centerInViewCoordinates)
 {
-    double totalScale = scale * m_viewScaleFactor;
+    double totalScale = scale * viewScaleFactor();
     if (totalScale == totalScaleFactor())
         return;
 
@@ -1428,26 +1427,32 @@
 
 double WebPage::pageScaleFactor() const
 {
-    return totalScaleFactor() / m_viewScaleFactor;
+    return totalScaleFactor() / viewScaleFactor();
 }
 
+double WebPage::viewScaleFactor() const
+{
+    return m_page->viewScaleFactor();
+}
+
 void WebPage::scaleView(double scale)
 {
+    if (viewScaleFactor() == scale)
+        return;
+
     float pageScale = pageScaleFactor();
 
-    double scaleRatio = scale / m_viewScaleFactor;
-
     IntPoint scrollPositionAtNewScale;
     if (FrameView* mainFrameView = m_page->mainFrame().view()) {
+        double scaleRatio = scale / viewScaleFactor();
         scrollPositionAtNewScale = mainFrameView->scrollPosition();
         scrollPositionAtNewScale.scale(scaleRatio, scaleRatio);
     }
 
-    m_viewScaleFactor = scale;
+    m_page->setViewScaleFactor(scale);
     scalePage(pageScale, scrollPositionAtNewScale);
 }
 
-
 #if PLATFORM(COCOA)
 void WebPage::scaleViewAndUpdateGeometryFenced(double scale, IntSize viewSize, uint64_t callbackID)
 {

Modified: branches/safari-601.1.32-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h (184480 => 184481)


--- branches/safari-601.1.32-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-05-18 14:23:02 UTC (rev 184480)
+++ branches/safari-601.1.32-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-05-18 14:23:14 UTC (rev 184481)
@@ -359,7 +359,7 @@
     void scalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates);
     double pageScaleFactor() const;
     double totalScaleFactor() const;
-    double viewScaleFactor() const { return m_viewScaleFactor; }
+    double viewScaleFactor() const;
     void scaleView(double scale);
 #if PLATFORM(COCOA)
     void scaleViewAndUpdateGeometryFenced(double scale, WebCore::IntSize viewSize, uint64_t callbackID);
@@ -1359,8 +1359,6 @@
 
     uint64_t m_pendingNavigationID;
 
-    double m_viewScaleFactor { 1 };
-
 #if ENABLE(WEBGL)
     WebCore::WebGLLoadPolicy m_systemWebGLPolicy;
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to