Title: [132512] trunk/Source/WebKit2
Revision
132512
Author
[email protected]
Date
2012-10-25 12:11:25 -0700 (Thu, 25 Oct 2012)

Log Message

Only full-page PDFPlugins should purport to handle page scale changes
https://bugs.webkit.org/show_bug.cgi?id=99635

Reviewed by Sam Weinig.

PDFPlugin should only handle page scale factor changes itself if it's in the main frame.
Subframe PDFs will act like images, zooming with the page.

* WebProcess/Plugins/PDF/PDFPlugin.h:
(PDFPlugin): Move implementation of handlesPageScaleFactor() to PDFPlugin.mm.
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::pdfDocumentDidLoad): Only copy PDFLayerController's default autoscale magnification to PluginView's
notion of the current scale factor if we're supposed to be handling page scale factor changes.
(WebKit::PDFPlugin::geometryDidChange): Only update PDFLayerController's magnification from the page scale factor
if we're supposed to be handling page scale factor changes.
(WebKit::PDFPlugin::handlesPageScaleFactor): We should only handle page scale factor changes if we're in the main frame.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (132511 => 132512)


--- trunk/Source/WebKit2/ChangeLog	2012-10-25 19:07:02 UTC (rev 132511)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-25 19:11:25 UTC (rev 132512)
@@ -1,3 +1,22 @@
+2012-10-25  Tim Horton  <[email protected]>
+
+        Only full-page PDFPlugins should purport to handle page scale changes
+        https://bugs.webkit.org/show_bug.cgi?id=99635
+
+        Reviewed by Sam Weinig.
+
+        PDFPlugin should only handle page scale factor changes itself if it's in the main frame.
+        Subframe PDFs will act like images, zooming with the page.
+
+        * WebProcess/Plugins/PDF/PDFPlugin.h:
+        (PDFPlugin): Move implementation of handlesPageScaleFactor() to PDFPlugin.mm.
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::pdfDocumentDidLoad): Only copy PDFLayerController's default autoscale magnification to PluginView's
+        notion of the current scale factor if we're supposed to be handling page scale factor changes.
+        (WebKit::PDFPlugin::geometryDidChange): Only update PDFLayerController's magnification from the page scale factor
+        if we're supposed to be handling page scale factor changes.
+        (WebKit::PDFPlugin::handlesPageScaleFactor): We should only handle page scale factor changes if we're in the main frame.
+
 2012-10-25  Christophe Dumez  <[email protected]>
 
         [EFL][WK2] Move non-API classes out of UIProcess/API/efl

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h (132511 => 132512)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h	2012-10-25 19:07:02 UTC (rev 132511)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h	2012-10-25 19:11:25 UTC (rev 132512)
@@ -77,7 +77,7 @@
     virtual bool handleKeyboardEvent(const WebKeyboardEvent&) OVERRIDE;
     virtual bool handleEditingCommand(const String& commandName, const String& argument) OVERRIDE;
     virtual bool isEditingCommandEnabled(const String&) OVERRIDE;
-    virtual bool handlesPageScaleFactor() OVERRIDE { return true; }
+    virtual bool handlesPageScaleFactor() OVERRIDE;
 
     // ScrollableArea functions.
     virtual void setScrollOffset(const WebCore::IntPoint&) OVERRIDE;

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm (132511 => 132512)


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2012-10-25 19:07:02 UTC (rev 132511)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2012-10-25 19:11:25 UTC (rev 132512)
@@ -298,7 +298,8 @@
     [m_pdfLayerController.get() setFrameSize:size()];
     m_pdfLayerController.get().document = document.get();
     
-    pluginView()->setPageScaleFactor([m_pdfLayerController.get() tileScaleFactor], IntPoint());
+    if (handlesPageScaleFactor())
+        pluginView()->setPageScaleFactor([m_pdfLayerController.get() tileScaleFactor], IntPoint());
 
     calculateSizes();
     updateScrollbars();
@@ -400,12 +401,17 @@
     [CATransaction begin];
     [CATransaction setDisableActions:YES];
     CATransform3D transform = CATransform3DMakeScale(1, -1, 1);
+    transform = CATransform3DTranslate(transform, 0, -pluginSize.height(), 0);
     
-    CGFloat magnification = pluginView()->pageScaleFactor() - [m_pdfLayerController.get() tileScaleFactor];
-    
-    // FIXME: Instead of m_lastMousePoint, we should use the zoom origin from PluginView::setPageScaleFactor.
-    [m_pdfLayerController.get() magnifyWithMagnification:magnification atPoint:m_lastMousePoint immediately:YES];
-    [m_contentLayer.get() setSublayerTransform:CATransform3DTranslate(transform, 0, -pluginSize.height(), 0)];
+    if (handlesPageScaleFactor()) {
+        CGFloat magnification = pluginView()->pageScaleFactor() - [m_pdfLayerController.get() tileScaleFactor];
+
+        // FIXME: Instead of m_lastMousePoint, we should use the zoom origin from PluginView::setPageScaleFactor.
+        if (magnification)
+            [m_pdfLayerController.get() magnifyWithMagnification:magnification atPoint:m_lastMousePoint immediately:YES];
+    }
+
+    [m_contentLayer.get() setSublayerTransform:transform];
     [CATransaction commit];
 
     calculateSizes();
@@ -577,6 +583,11 @@
     [m_scrollCornerLayer.get() setNeedsDisplay];
 }
 
+bool PDFPlugin::handlesPageScaleFactor()
+{
+    return webFrame()->isMainFrame();
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(PDFKIT_PLUGIN)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to