[webkit-changes] [WebKit/WebKit] d34e91: [UnifiedPDF] Make PDF plugin documents scrollable
Simon Fraser
noreply at github.com
Sat Sep 30 11:35:14 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d34e910dd2e203ec8fb4f1d734826e24063a534c
https://github.com/WebKit/WebKit/commit/d34e910dd2e203ec8fb4f1d734826e24063a534c
Author: Simon Fraser <simon.fraser at apple.com>
Date: 2023-09-30 (Sat, 30 Sep 2023)
Changed paths:
M Source/WebCore/html/PluginDocument.cpp
M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
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
Log Message:
-----------
[UnifiedPDF] Make PDF plugin documents scrollable
https://bugs.webkit.org/show_bug.cgi?id=262428
rdar://116268851
Reviewed by Tim Horton.
The UnifiedPDFPlugin expands to the size of the PDF, and scrolling is handled by the enclosing HTML
document.
To support this, modify the CSS in `PluginDocumentParser::createStyleElement()` to conditionalize
the old 100% height/width behavior based on a class on the `<html>` element; this classname is added
by `PluginView::updateDocumentForPluginSizingBehavior()` based on the value returned by
`m_plugin->pluginFillViewport()`.
The UnifiedPDFPlugin then sets its height and width based on the PDF dimensions after laying out the
PDF, making the page scrollable if necessary. A future patch will refine this to ensure that for
PDFs smaller than the viewport the plugin still fills it.
* Source/WebCore/html/PluginDocument.cpp:
(WebCore::PluginDocumentParser::createStyleElement):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
(WebKit::PDFPluginBase::pluginFillViewport const):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::installPDFDocument):
(WebKit::UnifiedPDFPlugin::sizeToFitContents):
(WebKit::UnifiedPDFPlugin::geometryDidChange):
* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::PluginView):
(WebKit::PluginView::updateDocumentForPluginSizingBehavior):
* Source/WebKit/WebProcess/Plugins/PluginView.h:
Canonical link: https://commits.webkit.org/268697@main
More information about the webkit-changes
mailing list