Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fd47d132791d1978fac5b3c2e39ed36486f9a0a6
      
https://github.com/WebKit/WebKit/commit/fd47d132791d1978fac5b3c2e39ed36486f9a0a6
  Author: Georges Basile Stavracas Neto <feane...@igalia.com>
  Date:   2024-04-18 (Thu, 18 Apr 2024)

  Changed paths:
    M Source/WebKit/UIProcess/API/gtk/WebKitPrintOperation.cpp
    M Source/WebKit/UIProcess/API/gtk/WebKitPrintOperation.h.in
    M Tools/TestWebKitAPI/Tests/WebKitGtk/TestPrinting.cpp

  Log Message:
  -----------
  [GTK] Implement printing using the Print portal
https://bugs.webkit.org/show_bug.cgi?id=192748

Reviewed by Michael Catanzaro.

When running inside a sandboxed environment - which is fairly common
nowadays - printing is severely limited due to using the legacy GTK
print API (GtkPrintUnixDialog & family).

Due to WebKit's multi-process architecture, using the modern alternative,
GtkPrintOperation, is not really possible, because GtkPrintOperation has
the enconded assumption that the rendering of the document pages happens
in the same process as of printing.

Implement manual support for the Print portal. The portal has two well
defined steps:

 1. PreparePrint() is where WebKit sends the settings and page setup
    that are stored in WebKitPrintOperation to the portal. The portal
    presents a dialog to let users choose their print preferences. This
    step returns WebKit a token, which is the "authentication" mechanism
    for the next step.

 2. Print() takes a token, and a file descriptor pointing to the file
    that will be send to the printer. The file descriptor can and often
    does point to an in-memory buffer! In WebKit's case, it's a tmpfile.

This effectively means that webkit_print_operation_print(), which assumes
that step 1 can be skipped - cannot work under a sandbox. Deprecate this
function, and adjust the tests to ignore this deprecation, as the tests
should be adapted separately.

* Source/WebKit/UIProcess/API/gtk/WebKitPrintOperation.cpp:
(webkitPrintOperationFinished):
(webkitPrintOperationFailed):
(webkitPrintOperationPrintPagesForFrame):
(findFilePrinter):
(webkitPrintOperationSendPagesToPrintPortal):
(webkitPrintOperationPreparePrint):
(webkitPrintOperationRunPortalDialog):
(webkitPrintOperationRunDialogForFrame):
* Source/WebKit/UIProcess/API/gtk/WebKitPrintOperation.h.in:
* Tools/TestWebKitAPI/Tests/WebKitGtk/TestPrinting.cpp:
(testPrintOperationPrint):
(testPrintOperationErrors):

Canonical link: https://commits.webkit.org/277671@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to