New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[UnifiedPDF] Get initial painting working #18359
[UnifiedPDF] Get initial painting working #18359
Conversation
EWS run on current version of this PR (hash 6dbd5dc) |
@@ -148,6 +148,11 @@ | |||
m_view->frame()->document()->loader()->addArchiveResource(resource.releaseNonNull()); | |||
} | |||
|
|||
void PDFPluginBase::geometryDidChange(const IntSize& pluginSize, const AffineTransform& pluginToRootViewTransform) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the compiler going to complain here about unused parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thankfully WebKit doesn't enable that silly warning
|
||
void UnifiedPDFPlugin::paint(GraphicsContext& context, const WebCore::IntRect& rect) | ||
{ | ||
ALWAYS_LOG_WITH_STREAM(stream << "UnifiedPDFPlugin::paint " << rect); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this log be here?
|
||
if (!m_view) | ||
return; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there something missing here?
|
||
auto imageBuffer = ImageBuffer::create(m_size, RenderingPurpose::Unspecified, 1.0, DestinationColorSpace::SRGB(), PixelFormat::BGRA8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this code going to deal with large PDF files? The maximum size of an ImageBuffer is 4096 x 4096 pixels. Beyond that ImageBuffer is going to scale the context. So the PDF will be pixelated.
https://bugs.webkit.org/show_bug.cgi?id=262311 rdar://116185973 Reviewed by Tim Horton. Start getting PDF drawing working for Unified PDF. Currently this just draws the first page via `CGPDFDocumentCreateWithProvider()` and `CGPDFDocumentGetPage()`. Move two bits of code into PDFPluginBase; first, have it handle `geometryDidChange()` so we can store the size. Second, because UnifiedPDFPlugin isn't layer-backed, we need to plumb through a `paint()` function from `PluginView`. * Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h: * Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm: (WebKit::PDFPlugin::geometryDidChange): * Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h: (WebKit::PDFPluginBase::paint): (WebKit::PDFPluginBase::size const): (WebKit::PDFPluginBase::geometryDidChange): Deleted. * Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm: (WebKit::PDFPluginBase::geometryDidChange): * Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h: * Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm: (WebKit::UnifiedPDFPlugin::createPDFDocument): (WebKit::UnifiedPDFPlugin::installPDFDocument): (WebKit::UnifiedPDFPlugin::paint): (WebKit::UnifiedPDFPlugin::geometryDidChange): * Source/WebKit/WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::paint): Canonical link: https://commits.webkit.org/268610@main
6dbd5dc
to
8b9d4c4
Compare
Committed 268610@main (8b9d4c4): https://commits.webkit.org/268610@main Reviewed commits have been landed. Closing PR #18359 and removing active labels. |
8b9d4c4
6dbd5dc
π§ͺ wpe-wk2