Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8992eaa3fbdf4b0f158c5dfdf114d7437e8cb9a7
      
https://github.com/WebKit/WebKit/commit/8992eaa3fbdf4b0f158c5dfdf114d7437e8cb9a7
  Author: Sammy Gill <[email protected]>
  Date:   2024-10-16 (Wed, 16 Oct 2024)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PluginView.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

  Log Message:
  -----------
  [UnifiedPDF][iOS] PDF sometimes appears zoomed in and at wrong scroll 
position.
https://bugs.webkit.org/show_bug.cgi?id=281352
rdar://136502394

Reviewed by Abrar Rahman Protyasha.

Every now and then when a PDF is loaded, it may appear at the wrong scale 
(zoomed in) and
also at the wrong scroll position (top left). In 284976@main, we attempted to 
address this
by creating a plugin-specific viewport configuration as we were supplying 
incorrect
dimensions to the content, which was causing the plugin to be sized 
incorrectly. This
solved the problem for the most part, but on occasion, the plugin would still 
get sized
incorrectly.

This is due to the fact that the following two events could occur in any order 
under
certain circumstances:

- Setting the viewport configuration to the plugin-specific one
- The PDF being installed in the plugin, which results in us computing an 
initial scale based off the PDF geometry and plugin size

When the PDF is installed after the viewport configuration is set properly, 
then the
document loads and appears just fine. However, when the document is first 
installed, then
we compute a document-fitting scale based off the incorrect plugin size and do 
not recover
after the viewport configuration changes since we do not automatically adjust 
the
document-fitting scale by default.

To hopefully set the viewport configuration before the PluginView is created 
and the plugin
is initialized, let's make 2 changes:

1.) Stop trying to change the configuration after the plugin has been 
initialized. It is
possible that the document was installed, and we could have computed a scale 
using incorrect
geometry, so this is too late.
2.) In WebPage::resetViewportDefaultConfiguration, check to see if the document 
is a
PluginDocument instead of whether a main frame plugin exists. When the web page 
is notified
that the load has been committed and it resets the viewport default 
configuration, we
should be able to take advantage of the fact that we should have a 
PluginDocument at this
point.

* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::setParent):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::resetViewportDefaultConfiguration):
(WebKit::WebPage::didInitializePlugin): Deleted.

Canonical link: https://commits.webkit.org/285273@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