[webkit-changes] [WebKit/WebKit] a30c57: [Unified PDF] Zoom not working in WKWebView

Tim Horton noreply at github.com
Fri Feb 21 02:08:37 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a30c570b4fcbafa412fed2b96ec5fe45f46fb52f
      https://github.com/WebKit/WebKit/commit/a30c570b4fcbafa412fed2b96ec5fe45f46fb52f
  Author: Tim Horton <thorton at apple.com>
  Date:   2025-02-21 (Fri, 21 Feb 2025)

  Changed paths:
    M Source/WebCore/dom/ViewportArguments.h
    M Source/WebCore/html/PluginDocument.cpp
    M Source/WebCore/page/ViewportConfiguration.cpp
    M Source/WebCore/page/ViewportConfiguration.h
    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
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

  Log Message:
  -----------
  [Unified PDF] Zoom not working in WKWebView
https://bugs.webkit.org/show_bug.cgi?id=288186
rdar://145047812

Reviewed by Abrar Rahman Protyasha.

By default, WebKit respects "user-scalable=no". Safari overrides this to force
pages to always be scalable. For multiple different reasons, all fixed in this patch,
the default viewport configuration for main frame UnifiedPDFPlugin had "user-scalable=no" set.

* Source/WebCore/html/PluginDocument.cpp:
Don't explicitly set user-scalable=no...

* Source/WebCore/page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::pluginDocumentParameters): Deleted.
Remove this PDFPlugin-specific code from WebCore.

* Source/WebCore/page/ViewportConfiguration.h:
(WebCore::ViewportConfiguration::forceAlwaysUserScalableMaximumScale const):
(WebCore::ViewportConfiguration::forceAlwaysUserScalableMinimumScale const):
Don't let "force always user-scalable" to ever *reduce* the available scale range, only increase it.
This prevents it from reducing our PDF maximum scale from 6x to 5x.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::viewportParameters):
Move the UnifiedPDFPlugin default viewport parameters computation to a static method on UnifiedPDFPlugin.
Critically, change the maximum scale to match UnifiedPDFPlugin's normal maximum scale,
and set `allowsUserScaling` to true (e.g. "user-scalable=yes"). The combination
of these two things make scaling work when in the default "do not force always user-scalable" state.

* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::resetViewportDefaultConfiguration):
Ask UnifiedPDFPlugin for its viewport configuration instead of WebCore.

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list