Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1b250632dd10ccbd858ea80f492228ce35148e8a
      
https://github.com/WebKit/WebKit/commit/1b250632dd10ccbd858ea80f492228ce35148e8a
  Author: Rupin Mittal <[email protected]>
  Date:   2025-02-21 (Fri, 21 Feb 2025)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.messages.in
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  [UnifiedPDF] [iOS] Possible for per-site zoom to get applied if it was 
previously set on a document
https://bugs.webkit.org/show_bug.cgi?id=288176
rdar://145099940

Reviewed by Abrar Rahman Protyasha.

The expected behavior is that PDFs are always loaded with a view scale of 1x.
But there is a case where this isn't happening:

Safari does view scale adjustments. If we set the scale to be 2x on one tab
and then load a PDF in another tab, Safari will attempt to use the same scale
on the PDF. Currently it (wrongly) succeeds because we don't know that we what
we're loading is a PDF. If we did know, we would have rejected this adjustment
and kept the scale at 1x.

To fix this, as the last step of loading the PDF, the WebProcess will notify
the UIProcess that it's loading a PDF and the UIProcess will ensure that the
viewing scale is 1x.

* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setViewScale:]):

_setViewScale is the function Safari calls to make a view scale adjument.
The current implementation of this function checks if what we're loading
should override the view scale (like a PDF) and do so if needed (PDFs
override to 1x). But if we don't know that we're loading a PDF, we won't
do this (hence our bug).

We move the overriding logic from here to it's own encapsulated function
and have _setViewScale call that function.

* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::pluginDidInstallPDFDocument):
(WebKit::WebPageProxy::resetViewportConfigurationForPDFPluginIfNeeded):

This is the new function that is called by both _setViewScale and
UnifiedPDFPlugin::installPDFDocument() to reset the view scale if needed.

* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::installPDFDocument):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to