[webkit-changes] [WebKit/WebKit] de23e7: [iOS] [UnifiedPDF] Maintain zoom scale and scroll ...
Wenson Hsieh
noreply at github.com
Thu Feb 27 07:45:10 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: de23e754c4523e1b036bb1dda5529874ecf12d8f
https://github.com/WebKit/WebKit/commit/de23e754c4523e1b036bb1dda5529874ecf12d8f
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2025-02-27 (Thu, 27 Feb 2025)
Changed paths:
M Source/WebCore/page/ViewportConfiguration.cpp
M Source/WebCore/page/ViewportConfiguration.h
M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPresentationController.h
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
Log Message:
-----------
[iOS] [UnifiedPDF] Maintain zoom scale and scroll position during rotation
https://bugs.webkit.org/show_bug.cgi?id=288676
rdar://143047345
Reviewed by Tim Horton and Abrar Rahman Protyasha.
Add support for keeping the zoom scale and scroll position stable, before and after device rotation
on iOS when viewing unified PDF. See below for more details. API test to come, once the dynamic
viewport size update codepath is reenabled below.
* Source/WebCore/page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::minimumScale const):
(WebCore::operator<<):
* Source/WebCore/page/ViewportConfiguration.h:
Add a new viewport configuration flag to ignore the content dimensions, for the purposes of
determining the minimum scale; in unified PDF, this should always be fixed at 1, since the plugin
element itself expands to exactly fit the width of the viewport.
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _beginAnimatedResizeWithUpdates:]):
Disable dynamic viewport size updates in unified PDF for the time being; the web-process-side logic
doesn't work well with this mechanism yet, and results in both the scroll position being lost, and
extra space to the left/right of the plugin element.
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
(WebKit::PDFPluginBase::finalizeRenderingUpdate):
Add a hook to call into `UnifiedPDFPlugin` when finalizing a rendering update.
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPresentationController.h:
(): Deleted.
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPresentationController.mm:
(WebKit::PDFPresentationController::pdfPositionForCurrentView const):
Teach this to handle the `shouldSizeToFitContent` case by using the unobscured content rect instead
of the bounds of the plugin element.
(WebKit::PDFPresentationController::anchorPointInDocumentSpace const):
Similarly, teach this to handle the `shouldSizeToFitContent` case, by returning an anchor point
based on the unobscured rect, rather than the plugin element rect (which expands to fill the entire
root view on iOS).
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::frameView const):
(WebKit::UnifiedPDFPlugin::setScaleFactor):
(WebKit::UnifiedPDFPlugin::setPageScaleFactor):
Force the viewport scale to auto-update on iOS.
(WebKit::UnifiedPDFPlugin::updateLayout):
Anchor to the center instead of the top left corner, which roughly matches the behavior of dynamic
viewport size updates for regular web content.
(WebKit::UnifiedPDFPlugin::finalizeRenderingUpdate):
Batch "restore anchoring information" requests until the next rendering update. See the `FIXME` in
`updateLayout` for more details.
* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::finalizeRenderingUpdate):
* Source/WebKit/WebProcess/Plugins/PluginView.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::finalizeRenderingUpdate):
Canonical link: https://commits.webkit.org/291223@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