[webkit-changes] [WebKit/WebKit] 4fd244: [UnifiedPDF] When zooming out below 1, the content...

Simon Fraser noreply at github.com
Mon Jan 29 22:00:06 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4fd2440d7ed92da3cc44cfcb64bc01137a492ba3
      https://github.com/WebKit/WebKit/commit/4fd2440d7ed92da3cc44cfcb64bc01137a492ba3
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2024-01-29 (Mon, 29 Jan 2024)

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

  Log Message:
  -----------
  [UnifiedPDF] When zooming out below 1, the content should be centered
https://bugs.webkit.org/show_bug.cgi?id=268355
rdar://121900997

Reviewed by Tim Horton.

In `UnifiedPDFPlugin::setPageScaleFactor()`, when the scale is less than 1, compute the extra
space, and add half on the left size via a post-scale translate on the contents layer. We also
need to clamp scroll positions from prevent them from going negative.

In `UnifiedPDFPlugin::updateLayerHierarchy()`, the contents layer size is pre-scaling, so
we should use `documentSize()`. This fixes truncated tiles when zoomed out.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::updateLayerHierarchy):
(WebKit::UnifiedPDFPlugin::setPageScaleFactor):
(WebKit::UnifiedPDFPlugin::documentSize const):
(WebKit::UnifiedPDFPlugin::contentsSize const):

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




More information about the webkit-changes mailing list