Reviewed by Maciej.
[WebKit-https.git] / WebKit / Plugins / WebNetscapePluginDocumentView.m
index 9e48a3c9b2759b07cc0fcc8036f7846283f6ce98..487cde73a747e6f347753e7aab309cb1cc032145 100644 (file)
     [super viewDidMoveToHostWindow];
 }
 
+- (BOOL)documentViewShouldHandlePrint
+{
+    // Allow the plugin to take over printing if it defines an NPP_Print function
+    return (NPP_Print != NULL);
+}
+
+- (void)printDocumentView
+{
+    // The plugin cannot print if it does not have an NPP_Print function
+    if (!NPP_Print)
+        return;
+    
+    // Let the plugin take control of printing when in NP_FULL mode
+    NPPrint platformPrint;
+    platformPrint.mode = NP_FULL;
+    platformPrint.print.fullPrint.pluginPrinted = 0;
+    platformPrint.print.fullPrint.printOne = 0;
+    platformPrint.print.fullPrint.platformPrint = NULL;
+    NPP_Print(instance, &platformPrint);
+}
+
 @end