[webkit-gtk] Printing frames

Carlos Garcia Campos cgarcia at igalia.com
Mon Sep 28 05:34:22 PDT 2015


With the current WebKit2 API it's impossible to print a particular
frame other than the main frame. In WebKit1, the printing API was in
the WebKitFrame class, but in WebKit2 we don't expose frames in the UI
process API. Many websites include a print button when using iframes,
for example, but that's not always the case, so we need a way to allow
applications to print a particular frame.

We have several options:

 * Make webkit_print_operation methods print the currently focused
frame. This is what Safari (and I think IE too) does, for example.
Chromium does the same only when there's something selected in the
frame (that's pretty weird in my opinion). This is the easiest solution
because it doesn't require any API update, but it would be a change in
the behaviour, although consistent with other browsers. This woulnd't
be a problem if we had inline print preview, because you would see what
is going to be printed before clicking on print button.

 * Add a custom tab to the print dialog that allows the user to print
the main or focused frame. We could use this tab to expose some other
printing options like print backgrounds. We could expose this as a
print setting that would be set in the GtkPrintSettings, so that it
would also work when printing without showing the print dialog. 

 * Add custom methods to print the focused frame:
 webkit_print_operation_run_dialog_for_focused_frame() and
 webkit_print_operation_print_focused_frame(), for example.

 * Add a print policy API, something like
webkit_print_operation_set_policy() that receives printing flags (for
now only 0 or PRINT_FOCUSED_FRAME).

We could probably expose a print frame action the context menu, but for
now I'm only interested in what happens when you print using the
browser print action.

Opinions?

-- 
Carlos Garcia Campos
http://pgp.rediris.es:11371/pks/lookup?op=get&search=0xF3D322D0EC4582C3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <https://lists.webkit.org/pipermail/webkit-gtk/attachments/20150928/7e663a7d/attachment.sig>


More information about the webkit-gtk mailing list