Title: [97233] trunk/Source/WebKit/chromium
Revision
97233
Author
commit-qu...@webkit.org
Date
2011-10-11 22:56:19 -0700 (Tue, 11 Oct 2011)

Log Message

[chromium] Add accessor for plugin request to not scale print output.
https://bugs.webkit.org/show_bug.cgi?id=68853

Patch by Steve VanDeBogart <vand...@chromium.org> on 2011-10-11
Reviewed by Darin Fisher.

* public/WebFrame.h:
* public/WebPlugin.h:
(WebKit::WebPlugin::isPrintScalingDisabled):
* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::isPrintScalingDisabledForPlugin):
* src/WebFrameImpl.h:
* src/WebPluginContainerImpl.cpp:
(WebKit::WebPluginContainerImpl::isPrintScalingDisabled):
* src/WebPluginContainerImpl.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (97232 => 97233)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-10-12 05:35:44 UTC (rev 97232)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-10-12 05:56:19 UTC (rev 97233)
@@ -1,3 +1,20 @@
+2011-10-11  Steve VanDeBogart  <vand...@chromium.org>
+
+        [chromium] Add accessor for plugin request to not scale print output.
+        https://bugs.webkit.org/show_bug.cgi?id=68853
+
+        Reviewed by Darin Fisher.
+
+        * public/WebFrame.h:
+        * public/WebPlugin.h:
+        (WebKit::WebPlugin::isPrintScalingDisabled):
+        * src/WebFrameImpl.cpp:
+        (WebKit::WebFrameImpl::isPrintScalingDisabledForPlugin):
+        * src/WebFrameImpl.h:
+        * src/WebPluginContainerImpl.cpp:
+        (WebKit::WebPluginContainerImpl::isPrintScalingDisabled):
+        * src/WebPluginContainerImpl.h:
+
 2011-10-11  Antoine Labour  <pi...@chromium.org>
 
         Separate compositor client thread from webkit's main thread.

Modified: trunk/Source/WebKit/chromium/public/WebFrame.h (97232 => 97233)


--- trunk/Source/WebKit/chromium/public/WebFrame.h	2011-10-12 05:35:44 UTC (rev 97232)
+++ trunk/Source/WebKit/chromium/public/WebFrame.h	2011-10-12 05:56:19 UTC (rev 97233)
@@ -448,6 +448,11 @@
     // Reformats the WebFrame for screen display.
     virtual void printEnd() = 0;
 
+    // If the frame contains a full-frame plugin or the given node refers to a
+    // plugin whose content indicates that printed output should not be scaled,
+    // return true, otherwise return false.
+    virtual bool isPrintScalingDisabledForPlugin(const WebNode& = WebNode()) = 0;
+
     // CSS3 Paged Media ----------------------------------------------------
 
     // Returns true if page box (margin boxes and page borders) is visible.

Modified: trunk/Source/WebKit/chromium/public/WebPlugin.h (97232 => 97233)


--- trunk/Source/WebKit/chromium/public/WebPlugin.h	2011-10-12 05:35:44 UTC (rev 97232)
+++ trunk/Source/WebKit/chromium/public/WebPlugin.h	2011-10-12 05:56:19 UTC (rev 97233)
@@ -86,6 +86,9 @@
     // Whether the plugin supports its own paginated print. The other print
     // interface methods are called only if this method returns true.
     virtual bool supportsPaginatedPrint() { return false; }
+    // Returns true if the printed content should not be scaled to
+    // the printer's printable area.
+    virtual bool isPrintScalingDisabled() { return false; }
     // Sets up printing at the given print rect and printer DPI. printableArea
     // is in points (a point is 1/72 of an inch).Returns the number of pages to
     // be printed at these settings.

Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (97232 => 97233)


--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2011-10-12 05:35:44 UTC (rev 97232)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2011-10-12 05:56:19 UTC (rev 97233)
@@ -1395,6 +1395,20 @@
     m_printContext.clear();
 }
 
+bool WebFrameImpl::isPrintScalingDisabledForPlugin(const WebNode& node)
+{
+    WebPluginContainerImpl* pluginContainer = 0;
+    if (node.isNull())
+        pluginContainer = pluginContainerFromFrame(frame());
+    else
+        pluginContainer = pluginContainerFromNode(node);
+
+    if (!pluginContainer || !pluginContainer->supportsPaginatedPrint())
+        return false;
+
+    return pluginContainer->isPrintScalingDisabled();
+}
+
 bool WebFrameImpl::isPageBoxVisible(int pageIndex)
 {
     return frame()->document()->isPageBoxVisible(pageIndex);

Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.h (97232 => 97233)


--- trunk/Source/WebKit/chromium/src/WebFrameImpl.h	2011-10-12 05:35:44 UTC (rev 97232)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.h	2011-10-12 05:56:19 UTC (rev 97233)
@@ -168,6 +168,7 @@
     virtual float printPage(int pageToPrint, WebCanvas*);
     virtual float getPrintPageShrink(int page);
     virtual void printEnd();
+    virtual bool isPrintScalingDisabledForPlugin(const WebNode&);
     virtual bool isPageBoxVisible(int pageIndex);
     virtual void pageSizeAndMarginsInPixels(int pageIndex,
                                             WebSize& pageSize,

Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp (97232 => 97233)


--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2011-10-12 05:35:44 UTC (rev 97232)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2011-10-12 05:56:19 UTC (rev 97233)
@@ -244,6 +244,11 @@
     return m_webPlugin->supportsPaginatedPrint();
 }
 
+bool WebPluginContainerImpl::isPrintScalingDisabled() const
+{
+    return m_webPlugin->isPrintScalingDisabled();
+}
+
 int WebPluginContainerImpl::printBegin(const IntRect& printableArea,
                                        int printerDPI) const
 {

Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h (97232 => 97233)


--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h	2011-10-12 05:35:44 UTC (rev 97232)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.h	2011-10-12 05:56:19 UTC (rev 97233)
@@ -107,6 +107,9 @@
     // Whether the plugin supports its own paginated print. The other print
     // interface methods are called only if this method returns true.
     bool supportsPaginatedPrint() const;
+    // If the plugin content should not be scaled to the printable area of
+    // the page, then this method should return true.
+    bool isPrintScalingDisabled() const;
     // Sets up printing at the given print rect and printer DPI. printableArea
     // is in points (a point is 1/72 of an inch).Returns the number of pages to
     // be printed at these settings.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to