[webkit-changes] [WebKit/WebKit] 2de957: Cherry-pick 277671 at main (fd47d132791d). https://bu...
Georges Basile Stavracas Neto
noreply at github.com
Thu Apr 18 12:45:40 PDT 2024
Branch: refs/heads/webkitglib/2.44
Home: https://github.com/WebKit/WebKit
Commit: 2de9573a67b1089e9ac02ef63594996287ac47a0
https://github.com/WebKit/WebKit/commit/2de9573a67b1089e9ac02ef63594996287ac47a0
Author: Georges Basile Stavracas Neto <feaneron at 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:
-----------
Cherry-pick 277671 at main (fd47d132791d). https://bugs.webkit.org/show_bug.cgi?id=192748
[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
Canonical link: https://commits.webkit.org/274313.141@webkitglib/2.44
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list