[webkit-changes] [WebKit/WebKit] 36b398: [UnifiedPDF] Add support for scaling to "Actual Size"

Simon Fraser noreply at github.com
Fri Feb 2 23:56:10 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 36b3983cdb3ffbf14af36378f00937c7f1ec92aa
      https://github.com/WebKit/WebKit/commit/36b3983cdb3ffbf14af36378f00937c7f1ec92aa
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2024-02-02 (Fri, 02 Feb 2024)

  Changed paths:
    M Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h
    M Source/WebCore/platform/PlatformScreen.h
    M Source/WebCore/platform/ScreenProperties.h
    M Source/WebCore/platform/mac/PlatformScreenMac.mm
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  [UnifiedPDF] Add support for scaling to "Actual Size"
https://bugs.webkit.org/show_bug.cgi?id=268665
rdar://122208262

Reviewed by Tim Horton.

Make it possible to display a PDF at "Actual Size", which results in the UnifiedPDFPlugin
choosing a scale that makes the PDF page size match physical screen inches.

To do this we need the screen DPI plumbed through from ScreenData (this will be
read in the UI Process, and fed to the Web Process via ScreenProperties).

Then we read the size of the first PDF page in points, convert to inches using the fixed
72DPI resolution that PDFs assume, and then scale via screenDPI.

* Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h:
* Source/WebCore/platform/PlatformScreen.h:
* Source/WebCore/platform/ScreenProperties.h:
* Source/WebCore/platform/mac/PlatformScreenMac.mm:
(WebCore::collectScreenProperties):
(WebCore::ScreenData::screenDPI const):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::scaleForActualSize const):
(WebKit::UnifiedPDFPlugin::performContextMenuAction):

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




More information about the webkit-changes mailing list