REGRESSION: Page opens with enlarged font after visiting PDF, navigating back,
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Feb 2015 22:56:11 +0000 (22:56 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Feb 2015 22:56:11 +0000 (22:56 +0000)
then doing a process swap
https://bugs.webkit.org/show_bug.cgi?id=141584
-and corresponding-
rdar://problem/18167729

Reviewed by Tim Horton.

This patch keeps the plugin zoom/scale factors separate from page zoom/scale
factors in the UI process since they are used for slightly different purposes for
plugins (i.e., PDFs) than they are for normal pages. Keeping track of the right
factor for the right type of document will ensure that we don’t use the wrong one.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::pageZoomFactor):
(WebKit::WebPageProxy::pageScaleFactor):
(WebKit::WebPageProxy::pluginScaleFactorDidChange):
(WebKit::WebPageProxy::pluginZoomFactorDidChange):
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::pageZoomFactorDidChange): Deleted.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::pageZoomFactor): Deleted.
(WebKit::WebPageProxy::pageScaleFactor): Deleted.
* UIProcess/WebPageProxy.messages.in:
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::setPageScaleFactor):

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/WebProcess/Plugins/PluginView.cpp

index 4c8826d..f3e7ff2 100644 (file)
@@ -1,3 +1,33 @@
+2015-02-14  Beth Dakin  <bdakin@apple.com>
+
+        REGRESSION: Page opens with enlarged font after visiting PDF, navigating back, 
+        then doing a process swap
+        https://bugs.webkit.org/show_bug.cgi?id=141584
+        -and corresponding-
+        rdar://problem/18167729
+
+        Reviewed by Tim Horton.
+
+        This patch keeps the plugin zoom/scale factors separate from page zoom/scale 
+        factors in the UI process since they are used for slightly different purposes for 
+        plugins (i.e., PDFs) than they are for normal pages. Keeping track of the right 
+        factor for the right type of document will ensure that we don’t use the wrong one.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+        (WebKit::WebPageProxy::pageZoomFactor):
+        (WebKit::WebPageProxy::pageScaleFactor):
+        (WebKit::WebPageProxy::pluginScaleFactorDidChange):
+        (WebKit::WebPageProxy::pluginZoomFactorDidChange):
+        (WebKit::WebPageProxy::didCommitLoadForFrame):
+        (WebKit::WebPageProxy::pageZoomFactorDidChange): Deleted.
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::pageZoomFactor): Deleted.
+        (WebKit::WebPageProxy::pageScaleFactor): Deleted.
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::setPageScaleFactor):
+
 2015-02-14  Brian J. Burg  <burg@cs.washington.edu>
 
         REGRESSION(r179573): Web Inspector toolbar is completely messed up on Mavericks
index 761b6ab..07dad60 100644 (file)
@@ -307,6 +307,8 @@ WebPageProxy::WebPageProxy(PageClient& pageClient, WebProcessProxy& process, uin
     , m_textZoomFactor(1)
     , m_pageZoomFactor(1)
     , m_pageScaleFactor(1)
+    , m_pluginZoomFactor(1)
+    , m_pluginScaleFactor(1)
     , m_intrinsicDeviceScaleFactor(1)
     , m_customDeviceScaleFactor(0)
     , m_topContentInset(0)
@@ -2129,6 +2131,24 @@ void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZ
     m_process->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID); 
 }
 
+double WebPageProxy::pageZoomFactor() const
+{
+    // Zoom factor for non-PDF pages persists across page loads. We maintain a separate member variable for PDF
+    // zoom which ensures that we don't use the PDF zoom for a normal page.
+    if (m_mainFrame && m_mainFrame->isDisplayingPDFDocument())
+        return m_pluginZoomFactor;
+    return m_pageZoomFactor;
+}
+
+double WebPageProxy::pageScaleFactor() const
+{
+    // PDF documents use zoom and scale factors to size themselves appropriately in the window. We store them
+    // separately but decide which to return based on the main frame.
+    if (m_mainFrame && m_mainFrame->isDisplayingPDFDocument())
+        return m_pluginScaleFactor;
+    return m_pageScaleFactor;
+}
+
 void WebPageProxy::scalePage(double scale, const IntPoint& origin)
 {
     if (!isValid())
@@ -2389,9 +2409,14 @@ void WebPageProxy::pageScaleFactorDidChange(double scaleFactor)
     m_pageScaleFactor = scaleFactor;
 }
 
-void WebPageProxy::pageZoomFactorDidChange(double zoomFactor)
+void WebPageProxy::pluginScaleFactorDidChange(double pluginScaleFactor)
 {
-    m_pageZoomFactor = zoomFactor;
+    m_pluginScaleFactor = pluginScaleFactor;
+}
+
+void WebPageProxy::pluginZoomFactorDidChange(double pluginZoomFactor)
+{
+    m_pluginZoomFactor = pluginZoomFactor;
 }
 
 void WebPageProxy::findStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
@@ -2811,8 +2836,10 @@ void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID
     // WebPageProxy's cache of the value can get out of sync (e.g. in the case where a
     // plugin is handling page scaling itself) so we should reset it to the default
     // for standard main frame loads.
-    if (frame->isMainFrame() && static_cast<FrameLoadType>(opaqueFrameLoadType) == FrameLoadType::Standard)
+    if (frame->isMainFrame() && static_cast<FrameLoadType>(opaqueFrameLoadType) == FrameLoadType::Standard) {
         m_pageScaleFactor = 1;
+        m_pluginScaleFactor = 1;
+    }
 
     m_pageLoadState.commitChanges();
     if (m_navigationClient) {
index 53b734e..553be9e 100644 (file)
@@ -617,13 +617,13 @@ public:
     bool supportsTextZoom() const;
     double textZoomFactor() const { return m_textZoomFactor; }
     void setTextZoomFactor(double);
-    double pageZoomFactor() const { return m_pageZoomFactor; }
+    double pageZoomFactor() const;
     void setPageZoomFactor(double);
     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
 
     void scalePage(double scale, const WebCore::IntPoint& origin);
     void scalePageInViewCoordinates(double scale, const WebCore::IntPoint& centerInViewCoordinates);
-    double pageScaleFactor() const { return m_pageScaleFactor; }
+    double pageScaleFactor() const;
 
     float deviceScaleFactor() const;
     void setIntrinsicDeviceScaleFactor(float);
@@ -696,7 +696,8 @@ public:
 #endif
 
     void pageScaleFactorDidChange(double);
-    void pageZoomFactorDidChange(double);
+    void pluginScaleFactorDidChange(double);
+    void pluginZoomFactorDidChange(double);
 
     // Find.
     void findString(const String&, FindOptions, unsigned maxMatchCount);
@@ -1484,6 +1485,8 @@ private:
     double m_textZoomFactor;
     double m_pageZoomFactor;
     double m_pageScaleFactor;
+    double m_pluginZoomFactor;
+    double m_pluginScaleFactor;
     float m_intrinsicDeviceScaleFactor;
     float m_customDeviceScaleFactor;
     float m_topContentInset;
index 0035af8..6c5069c 100644 (file)
@@ -194,7 +194,8 @@ messages -> WebPageProxy {
 #endif
 
     PageScaleFactorDidChange(double scaleFactor)
-    PageZoomFactorDidChange(double zoomFactor)
+    PluginScaleFactorDidChange(double zoomFactor)
+    PluginZoomFactorDidChange(double zoomFactor)
 
 #if PLATFORM(GTK)
     # Support for GTK+ platform keybindings
index 1864233..59397cb 100644 (file)
@@ -483,8 +483,8 @@ void PluginView::topContentInsetDidChange()
 void PluginView::setPageScaleFactor(double scaleFactor, IntPoint)
 {
     m_pageScaleFactor = scaleFactor;
-    m_webPage->send(Messages::WebPageProxy::PageScaleFactorDidChange(scaleFactor));
-    m_webPage->send(Messages::WebPageProxy::PageZoomFactorDidChange(scaleFactor));
+    m_webPage->send(Messages::WebPageProxy::PluginScaleFactorDidChange(scaleFactor));
+    m_webPage->send(Messages::WebPageProxy::PluginZoomFactorDidChange(scaleFactor));
     pageScaleFactorDidChange();
 }