Title: [136316] trunk/Source/WebKit2
Revision
136316
Author
[email protected]
Date
2012-12-01 23:51:36 -0800 (Sat, 01 Dec 2012)

Log Message

PDFPlugin: <embed> and <object> PDFs affect their parent frame's page scale
https://bugs.webkit.org/show_bug.cgi?id=103286
<rdar://problem/12752315>

Reviewed by Dan Bernstein.

Detecting whether or not a PDFPlugin is a full-page plugin or not is not
as simple as checking isMainFrame(), because <embed> and <object> will
cause PDFPlugin to live in the main frame, while still not being full-page.
We also have to check that the main frame's document is a PluginDocument,
and whether that PluginDocument's PluginWidget is our PDFPlugin's PluginView.

* WebProcess/Plugins/PDF/PDFPlugin.h:
(PDFPlugin): Add isFullFramePlugin.
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::isFullFramePlugin): Check whether the main frame is
backed by a PluginDocument, and that that PluginDocument corresponds
to this PDFPlugin.
(WebKit::PDFPlugin::handlesPageScaleFactor): Use isFullFramePlugin.
(WebKit::PDFPlugin::supportsForms): Use isFullFramePlugin.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (136315 => 136316)


--- trunk/Source/WebKit2/ChangeLog	2012-12-02 07:44:46 UTC (rev 136315)
+++ trunk/Source/WebKit2/ChangeLog	2012-12-02 07:51:36 UTC (rev 136316)
@@ -1,5 +1,28 @@
 2012-12-01  Tim Horton  <[email protected]>
 
+        PDFPlugin: <embed> and <object> PDFs affect their parent frame's page scale
+        https://bugs.webkit.org/show_bug.cgi?id=103286
+        <rdar://problem/12752315>
+
+        Reviewed by Dan Bernstein.
+
+        Detecting whether or not a PDFPlugin is a full-page plugin or not is not
+        as simple as checking isMainFrame(), because <embed> and <object> will
+        cause PDFPlugin to live in the main frame, while still not being full-page.
+        We also have to check that the main frame's document is a PluginDocument,
+        and whether that PluginDocument's PluginWidget is our PDFPlugin's PluginView.
+
+        * WebProcess/Plugins/PDF/PDFPlugin.h:
+        (PDFPlugin): Add isFullFramePlugin.
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::isFullFramePlugin): Check whether the main frame is
+        backed by a PluginDocument, and that that PluginDocument corresponds
+        to this PDFPlugin.
+        (WebKit::PDFPlugin::handlesPageScaleFactor): Use isFullFramePlugin.
+        (WebKit::PDFPlugin::supportsForms): Use isFullFramePlugin.
+
+2012-12-01  Tim Horton  <[email protected]>
+
         [wk2] Use spoolRect instead of snapshots for print preview
         https://bugs.webkit.org/show_bug.cgi?id=103798
         <rdar://problem/12686749>

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


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h	2012-12-02 07:44:46 UTC (rev 136315)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h	2012-12-02 07:51:36 UTC (rev 136316)
@@ -103,6 +103,7 @@
     WebCore::IntPoint convertFromRootViewToPlugin(const WebCore::IntPoint&) const;
     
     bool supportsForms();
+    bool isFullFramePlugin();
 
     void updatePageAndDeviceScaleFactors();
 

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


--- trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2012-12-02 07:44:46 UTC (rev 136315)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm	2012-12-02 07:51:36 UTC (rev 136316)
@@ -65,6 +65,7 @@
 #import <WebCore/Page.h>
 #import <WebCore/Pasteboard.h>
 #import <WebCore/PluginData.h>
+#import <WebCore/PluginDocument.h>
 #import <WebCore/RenderBoxModelObject.h>
 #import <WebCore/ScrollAnimator.h>
 #import <WebCore/ScrollbarTheme.h>
@@ -701,9 +702,20 @@
     [m_scrollCornerLayer.get() setNeedsDisplay];
 }
 
+bool PDFPlugin::isFullFramePlugin()
+{
+    // <object> or <embed> plugins will appear to be in their parent frame, so we have to
+    // check whether our frame's widget is exactly our PluginView.
+    Document* document = webFrame()->coreFrame()->document();
+    if (document->isPluginDocument())
+        return (static_cast<PluginDocument*>(document)->pluginWidget() == pluginView());
+
+    return false;
+}
+
 bool PDFPlugin::handlesPageScaleFactor()
 {
-    return webFrame()->isMainFrame();
+    return webFrame()->isMainFrame() && isFullFramePlugin();
 }
 
 void PDFPlugin::clickedLink(NSURL *url)
@@ -740,7 +752,7 @@
 bool PDFPlugin::supportsForms()
 {
     // FIXME: Should we support forms for inline PDFs? Since we touch the document, this might be difficult.
-    return webFrame()->isMainFrame();
+    return webFrame()->isMainFrame() && isFullFramePlugin();
 }
 
 void PDFPlugin::notifyContentScaleFactorChanged(CGFloat scaleFactor)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to