[webkit-changes] [WebKit/WebKit] 83e647: [UnifiedPDF] Printing a main frame containing a PD...

Abrar Rahman Protyasha noreply at github.com
Tue Jan 23 07:02:45 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 83e647adbd3621ba3de4e883189ebb4c0c4ea500
      https://github.com/WebKit/WebKit/commit/83e647adbd3621ba3de4e883189ebb4c0c4ea500
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2024-01-23 (Tue, 23 Jan 2024)

  Changed paths:
    M Source/WebKit/WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.mm
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm

  Log Message:
  -----------
  [UnifiedPDF] Printing a main frame containing a PDF should print the PDF and not the plugin
https://bugs.webkit.org/show_bug.cgi?id=267898
rdar://119632457

Reviewed by Tim Horton.

UnifiedPDFPlugin returns a nil PDFDocumentRef (and an empty size) when a
print is initiated, which means that a print operation on a main frame
PDF yields unexpected results.

This patch addresses the issue by devirtualizing the
pdfDocument[size]forPrinting family of functions, and instead letting
both PDF plugin implementations share the definition now housed in
PDFPluginBase.

Furthermore, we remove some conditional code in WebPage and WKBundlePage
that avoided querying the UnifiedPDF plugin for the associated PDF
document size and reference.

* Source/WebKit/WebProcess/InjectedBundle/API/c/mac/WKBundlePageMac.mm:
(WKBundlePageGetPDFDocumentInFrame):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::pdfDocumentSizeForPrinting const): Deleted.
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
(WebKit::PDFPluginBase::pdfDocumentForPrinting const):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm:
(WebKit::PDFPluginBase::pdfDocumentSizeForPrinting const):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::pdfDocumentForPrinting const): Deleted.
(WebKit::UnifiedPDFPlugin::pdfDocumentSizeForPrinting const): Deleted.
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::getPDFFirstPageSize):

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




More information about the webkit-changes mailing list