[webkit-changes] [WebKit/WebKit] 56db50: UnifiedPDF: Support for unlocking locked PDFs

Tim Horton noreply at github.com
Mon Feb 12 20:40:30 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 56db500c6ff59a3ce287cdbce3a2a1dbc23f3db9
      https://github.com/WebKit/WebKit/commit/56db500c6ff59a3ce287cdbce3a2a1dbc23f3db9
  Author: Tim Horton <thorton at apple.com>
  Date:   2024-02-12 (Mon, 12 Feb 2024)

  Changed paths:
    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

  Log Message:
  -----------
  UnifiedPDF: Support for unlocking locked PDFs
https://bugs.webkit.org/show_bug.cgi?id=269260
rdar://118551131

Reviewed by Simon Fraser.

Add support for unlocking PDFs. Right now the UI is just a lone text field,
a future patch will add more appropriate instructions.

Also fix a bug where we'd show the HUD on top of a locked PDF.

* Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::installPDFDocument):
(WebKit::PDFPlugin::attemptToUnlockPDF):
(WebKit::PDFPlugin::geometryDidChange):
(WebKit::PDFPlugin::notifyContentScaleFactorChanged):
(WebKit::PDFPlugin::notifyDisplayModeChanged):
Update visibility of the HUD when unlocking a PDF.
Also, rename "PDFHUD" to "HUD" in the context of PDFPlugin classes.

* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm:
(WebKit::PDFPluginBase::geometryDidChange):
(WebKit::PDFPluginBase::shouldShowHUD const):
(WebKit::PDFPluginBase::updateHUDVisibility):
(WebKit::PDFPluginBase::visibilityDidChange):
(WebKit::PDFPluginBase::updateHUDLocation):
(WebKit::PDFPluginBase::updatePDFHUDLocation): Deleted.
Make HUD visibility a "pull" thing, with an update method that we can call
from anywhere.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::installPDFDocument):
Hide the HUD once we get a PDFDocument and find out it's locked.
Also create a password field in the same case.

(WebKit::UnifiedPDFPlugin::createPasswordEntryForm):
(WebKit::UnifiedPDFPlugin::attemptToUnlockPDF):
Roughly borrowed from PDFPlugin; try unlocking the PDF, and rebuild the world
if it works out.

(WebKit::UnifiedPDFPlugin::updatePageBackgroundLayers):
Don't paint any page backgrounds if we are locked. The grey is better.

(WebKit::UnifiedPDFPlugin::scrollToFragmentIfNeeded):
Wait for the document to be unlocked before scrolling to the fragment.

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




More information about the webkit-changes mailing list