Title: [139340] trunk/Source/WebKit2
Revision
139340
Author
[email protected]
Date
2013-01-10 10:42:07 -0800 (Thu, 10 Jan 2013)

Log Message

PDFPlugin: Cmd-/+ should affect PDF page scale
https://bugs.webkit.org/show_bug.cgi?id=103285
<rdar://problem/12710469>

Reviewed by Darin Adler.

Plugins which support handling page scale themselves should also handle
page zoom, as it is a very similar concept.

This patch disables text zoom in the case of a main-frame plugin which supports
page scale factor changes, as it is not needed in the PDFPlugin case
(we can't do text-only scale for PDF), but it could be added later if needed.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::pageZoomFactorDidChange):
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* UIProcess/WebPageProxy.messages.in:
Add WebPageProxy::pageZoomFactorDidChange, to notify WebPageProxy of
out-of-band page zoom factor changes (in this case, from PluginView).

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::setPageScaleFactor):
Update WebPageProxy's notion of the current page zoom whenever PluginView
is notified of a page scale factor change.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setTextZoomFactor): We don't support text zoom in plugins, but
we also don't want it to silently act on the Frame if we have a plugin that
purports to handle page scale itself. Return early if this is the case.
(WebKit::WebPage::pageZoomFactor): For plugins that support page scale factor,
we equate page scale and page zoom. Return the PluginView's page scale factor
in place of the Frame's page zoom factor.
(WebKit::WebPage::setPageZoomFactor): Make page zoom changes in the aforementioned
case affect the PluginView's page scale.
(WebKit::WebPage::setPageAndTextZoomFactors): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (139339 => 139340)


--- trunk/Source/WebKit2/ChangeLog	2013-01-10 18:41:04 UTC (rev 139339)
+++ trunk/Source/WebKit2/ChangeLog	2013-01-10 18:42:07 UTC (rev 139340)
@@ -1,5 +1,44 @@
 2013-01-10  Tim Horton  <[email protected]>
 
+        PDFPlugin: Cmd-/+ should affect PDF page scale
+        https://bugs.webkit.org/show_bug.cgi?id=103285
+        <rdar://problem/12710469>
+
+        Reviewed by Darin Adler.
+
+        Plugins which support handling page scale themselves should also handle
+        page zoom, as it is a very similar concept.
+
+        This patch disables text zoom in the case of a main-frame plugin which supports
+        page scale factor changes, as it is not needed in the PDFPlugin case
+        (we can't do text-only scale for PDF), but it could be added later if needed.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::pageZoomFactorDidChange):
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy):
+        * UIProcess/WebPageProxy.messages.in:
+        Add WebPageProxy::pageZoomFactorDidChange, to notify WebPageProxy of
+        out-of-band page zoom factor changes (in this case, from PluginView).
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::setPageScaleFactor):
+        Update WebPageProxy's notion of the current page zoom whenever PluginView
+        is notified of a page scale factor change.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setTextZoomFactor): We don't support text zoom in plugins, but
+        we also don't want it to silently act on the Frame if we have a plugin that
+        purports to handle page scale itself. Return early if this is the case.
+        (WebKit::WebPage::pageZoomFactor): For plugins that support page scale factor,
+        we equate page scale and page zoom. Return the PluginView's page scale factor
+        in place of the Frame's page zoom factor.
+        (WebKit::WebPage::setPageZoomFactor): Make page zoom changes in the aforementioned
+        case affect the PluginView's page scale.
+        (WebKit::WebPage::setPageAndTextZoomFactors): Ditto.
+
+2013-01-10  Tim Horton  <[email protected]>
+
         PDFPlugin: Header cleanup
         https://bugs.webkit.org/show_bug.cgi?id=106540
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (139339 => 139340)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-01-10 18:41:04 UTC (rev 139339)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-01-10 18:42:07 UTC (rev 139340)
@@ -1665,6 +1665,11 @@
     m_pageScaleFactor = scaleFactor;
 }
 
+void WebPageProxy::pageZoomFactorDidChange(double zoomFactor)
+{
+    m_pageZoomFactor = zoomFactor;
+}
+
 void WebPageProxy::setMemoryCacheClientCallsEnabled(bool memoryCacheClientCallsEnabled)
 {
     if (!isValid())

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (139339 => 139340)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-01-10 18:41:04 UTC (rev 139339)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-01-10 18:42:07 UTC (rev 139340)
@@ -528,6 +528,7 @@
 #endif
 
     void pageScaleFactorDidChange(double);
+    void pageZoomFactorDidChange(double);
 
     void setMemoryCacheClientCallsEnabled(bool);
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (139339 => 139340)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-01-10 18:41:04 UTC (rev 139339)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-01-10 18:42:07 UTC (rev 139340)
@@ -175,6 +175,7 @@
 #endif
 
     PageScaleFactorDidChange(double scaleFactor)
+    PageZoomFactorDidChange(double zoomFactor)
 
 #if PLATFORM(GTK)
     # Support for GTK+ platform keybindings

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (139339 => 139340)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2013-01-10 18:41:04 UTC (rev 139339)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2013-01-10 18:42:07 UTC (rev 139340)
@@ -437,6 +437,7 @@
 {
     m_pageScaleFactor = scaleFactor;
     m_webPage->send(Messages::WebPageProxy::PageScaleFactorDidChange(scaleFactor));
+    m_webPage->send(Messages::WebPageProxy::PageZoomFactorDidChange(scaleFactor));
     pageScaleFactorDidChange();
 }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (139339 => 139340)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-01-10 18:41:04 UTC (rev 139339)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-01-10 18:42:07 UTC (rev 139340)
@@ -1136,6 +1136,10 @@
 
 void WebPage::setTextZoomFactor(double zoomFactor)
 {
+    PluginView* pluginView = pluginViewForFrame(m_page->mainFrame());
+    if (pluginView && pluginView->handlesPageScaleFactor())
+        return;
+
     Frame* frame = m_mainFrame->coreFrame();
     if (!frame)
         return;
@@ -1144,6 +1148,10 @@
 
 double WebPage::pageZoomFactor() const
 {
+    PluginView* pluginView = pluginViewForFrame(m_page->mainFrame());
+    if (pluginView && pluginView->handlesPageScaleFactor())
+        return pluginView->pageScaleFactor();
+
     Frame* frame = m_mainFrame->coreFrame();
     if (!frame)
         return 1;
@@ -1152,6 +1160,12 @@
 
 void WebPage::setPageZoomFactor(double zoomFactor)
 {
+    PluginView* pluginView = pluginViewForFrame(m_page->mainFrame());
+    if (pluginView && pluginView->handlesPageScaleFactor()) {
+        pluginView->setPageScaleFactor(zoomFactor, IntPoint());
+        return;
+    }
+
     Frame* frame = m_mainFrame->coreFrame();
     if (!frame)
         return;
@@ -1160,6 +1174,12 @@
 
 void WebPage::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor)
 {
+    PluginView* pluginView = pluginViewForFrame(m_page->mainFrame());
+    if (pluginView && pluginView->handlesPageScaleFactor()) {
+        pluginView->setPageScaleFactor(pageZoomFactor, IntPoint());
+        return;
+    }
+
     Frame* frame = m_mainFrame->coreFrame();
     if (!frame)
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to