Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 201d691c2124b002de6280430852e50e0f9f997e
      
https://github.com/WebKit/WebKit/commit/201d691c2124b002de6280430852e50e0f9f997e
  Author: Simon Fraser <simon.fra...@apple.com>
  Date:   2024-02-14 (Wed, 14 Feb 2024)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  [UnifiedPDF] Choose a good initial scale, and fix various scaling issues
https://bugs.webkit.org/show_bug.cgi?id=269333
rdar://122907238

Reviewed by Tim Horton.

Fix various scaling issues with PDFs:
1. On first load, try to display at actual size, as long as that doesn't cause 
it to
   zoom in. Otherwise try to fix the entire height in the view. Implemented via 
the
   `AdjustScaleAfterLayout` argument to `updateLayout()`.

2. When changing layout modes, rescale using the same logic as first load.

3. When the PDF content is shorter than the view, vertically center it. 
Implemented
   by renaming and changing `sidePaddingWidth()` to return a FloatSize. It also 
now
   always computes padding, even when scaled above 1.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::installPDFDocument):
(WebKit::UnifiedPDFPlugin::attemptToUnlockPDF):
(WebKit::UnifiedPDFPlugin::updatePageBackgroundLayers):
(WebKit::UnifiedPDFPlugin::scaleForFitToView const):
(WebKit::UnifiedPDFPlugin::initialScale const):
(WebKit::UnifiedPDFPlugin::setPageScaleFactor):
(WebKit::UnifiedPDFPlugin::updateLayout):
(WebKit::UnifiedPDFPlugin::centeringOffset const):
(WebKit::UnifiedPDFPlugin::convertFromPluginToDocument const):
(WebKit::UnifiedPDFPlugin::convertFromDocumentToPlugin const):
(WebKit::UnifiedPDFPlugin::convertFromPageToContents const):
(WebKit::UnifiedPDFPlugin::performContextMenuAction):
(WebKit::UnifiedPDFPlugin::sidePaddingWidth const): Deleted.

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to