Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 815f89b9a45b74461caa2e42ffcda9c8a49c93e9
      
https://github.com/WebKit/WebKit/commit/815f89b9a45b74461caa2e42ffcda9c8a49c93e9
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2025-02-28 (Fri, 28 Feb 2025)

  Changed paths:
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm
    M 
Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPresentationController.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Source/WebKit/WebProcess/Plugins/PluginView.cpp
    M Source/WebKit/WebProcess/Plugins/PluginView.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

  Log Message:
  -----------
  [iOS] [UnifiedPDF] PDF documents sometimes flicker during rotation (reenable 
dynamic viewport size updates)
https://bugs.webkit.org/show_bug.cgi?id=288868
rdar://145881576

Reviewed by Abrar Rahman Protyasha.

Reenable dynamic viewport size updates for unified PDF — see below for more 
details.

* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _beginAnimatedResizeWithUpdates:]):

Remove the `-_isDisplayingPDF` check when deciding whether or not to bail 
immediately from animated
resize. Instead, only avoid maintaining the current content width when Stage 
Manager is enabled,
when computing `animatedResizeOriginalContentWidth` (this prevents us from 
intentionally allowing
horizontal scrolling when resizing the window to a width narrower than the 
minimum content width).

* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
(WebKit::PDFPluginBase::didChangeSettings):

Remove all the plumbing added to hook Unified PDF into 
`finalizeRenderingUpdate`, now that we no
longer rely on `UnifiedPDFPlugin` to restore scroll positions.

(WebKit::PDFPluginBase::finalizeRenderingUpdate): Deleted.
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm:
(WebKit::PDFPluginBase::webPage const):

Add a helper method to grab the `WebPage`.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPresentationController.mm:
(WebKit::PDFPresentationController::pdfPositionForCurrentView const):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::geometryDidChange):

Add a call to `scheduleFullEditorStateUpdate` (i.e. update selection geometry), 
in the case where
there's a selection and the size is changing. This ensures that the selection 
never shows up out of
place after resize, now that we no longer scroll as a result of restoring the 
anchor (which
previously updated the selection highlight as a byproduct).

(WebKit::UnifiedPDFPlugin::updateLayout):

Revert some now-unnecessary logic for restoring the anchor, in the 
`shouldSizeToFitContent` case.
Rather than using `PDFPresentationController::restorePDFPosition`, we now just 
use the same dynamic
viewport resize codepath that we use for normal webpages, which guarantees a 
smooth transition
(covered by an animated snapshot view) during rotation while keeping the center 
of the viewport
stable before and after the animated resize.

(WebKit::UnifiedPDFPlugin::finalizeRenderingUpdate): Deleted.
* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::finalizeRenderingUpdate): Deleted.
* Source/WebKit/WebProcess/Plugins/PluginView.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::finalizeRenderingUpdate):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::setViewportConfigurationViewLayoutSize):

Pull this check for `plugin && !plugin->pluginHandlesPageScaleFactor()` out 
into a separate helper
method, which case can also use below.

(WebKit::WebPage::mainFramePlugInDefersScalingToViewport const):
(WebKit::WebPage::shouldEnableViewportBehaviorsForResizableWindows const):

Opt out of the normal "resizable windows" codepath for unified PDF, when Stage 
Manager is enabled.
This ensures that the width of the embed element always fits the viewport 
width, regardless of
window size (as opposed to falling back to horizontal scrolling).

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



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

Reply via email to