Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 8382d4d3c6e3e691c2c1e1d0efc7d2a535898c93
https://github.com/WebKit/WebKit/commit/8382d4d3c6e3e691c2c1e1d0efc7d2a535898c93
Author: Said Abou-Hallawa <[email protected]>
Date: 2023-02-06 (Mon, 06 Feb 2023)
Changed paths:
M LayoutTests/fast/images/cached-clipped-pdf-expected.html
M LayoutTests/fast/images/cached-clipped-pdf.html
M LayoutTests/fast/images/displaced-non-cached-pdf.html
M LayoutTests/fast/images/pdf-as-image-dest-rect-change-expected.txt
M LayoutTests/fast/images/pdf-as-image-dest-rect-change.html
M LayoutTests/fast/images/pdf-in-canvas.html
M Source/WebCore/Headers.cmake
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
R Source/WebCore/page/PDFImageCachingPolicy.h
M Source/WebCore/page/Settings.yaml
M Source/WebCore/page/SettingsBase.h
A Source/WebCore/platform/graphics/CachedSubimage.cpp
A Source/WebCore/platform/graphics/CachedSubimage.h
M Source/WebCore/platform/graphics/FloatRect.h
M Source/WebCore/platform/graphics/GeneratedImage.h
M Source/WebCore/platform/graphics/GraphicsContext.cpp
M Source/WebCore/platform/graphics/Image.cpp
M Source/WebCore/platform/graphics/Image.h
M Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp
M Source/WebCore/platform/graphics/cg/PDFDocumentImage.h
M Source/WebCore/platform/mediastream/WebRTCProvider.h
M Source/WebCore/rendering/RenderImage.cpp
M Source/WebCore/svg/graphics/SVGImage.h
M Source/WebCore/svg/graphics/SVGImageForContainer.h
M Source/WebCore/testing/InternalSettings.cpp
M Source/WebCore/testing/InternalSettings.h
M Source/WebCore/testing/InternalSettings.idl
M Source/WebCore/testing/Internals.cpp
M Source/WebCore/testing/Internals.h
M Source/WebCore/testing/Internals.idl
Log Message:
-----------
[CG] A large PDFDocumentImage may be displayed pixelated
https://bugs.webkit.org/show_bug.cgi?id=245664
rdar://97254192
Reviewed by Simon Fraser.
Introduce a new class called CachedSubimage. This class will be responsible of
creating a local ImageBuffer, drawing the source rectangle of the Image to the
ImageBuffer then drawing this ImageBuffer to the destination GraphicsContext.
The geometry of CachedSubimage will be calculated such that the resolution of
the CachedSubimage ImageBuffer matches the effective resolution of the
destination
retangle when it is drawm to GraphicsContext.
For GPU Process rendering, we have to draw the PDF image in WebProcess into a
local
ImageBuffer, get a NativeImage from this ImageBuffer and then send it to
GPUProcess.
CachedSubimage will be used to do this seemlessly for all PDFDocumentImages
regardless
of their size.
If Image::shouldDrawFromCachedSubimage() is true, a CachedSubimage of the Image
with the current resolution will be generated. If the local ImageBuffer can't be
created and Image::mustDrawFromCachedSubimage() is true, a pixelated
CachedSubimage
of the Image will be created. If the pixelated CachedSubimage could not be
created,
the Image will not be drawn.
* LayoutTests/fast/images/cached-clipped-pdf-expected.html:
* LayoutTests/fast/images/cached-clipped-pdf.html:
* LayoutTests/fast/images/displaced-non-cached-pdf.html:
* LayoutTests/fast/images/pdf-as-image-dest-rect-change-expected.txt:
* LayoutTests/fast/images/pdf-as-image-dest-rect-change.html:
* LayoutTests/fast/images/pdf-in-canvas.html:
* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/page/PDFImageCachingPolicy.h: Removed.
* Source/WebCore/page/Settings.yaml:
* Source/WebCore/page/SettingsBase.h:
* Source/WebCore/platform/graphics/CachedSubimage.cpp: Added.
(WebCore::CachedSubimage::create):
(WebCore::calculateCachedSubimageSourceRect):
(WebCore::CachedSubimage::createCachedSubimage):
(WebCore::CachedSubimage::createPixelatedCachedSubimage):
(WebCore::CachedSubimage::CachedSubimage):
(WebCore::CachedSubimage::canBeUsed const):
(WebCore::CachedSubimage::draw):
* Source/WebCore/platform/graphics/CachedSubimage.h: Added.
* Source/WebCore/platform/graphics/FloatRect.h:
(WebCore::areEssentiallyEqual):
* Source/WebCore/platform/graphics/GeneratedImage.h:
* Source/WebCore/platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawImage):
* Source/WebCore/platform/graphics/Image.cpp:
(WebCore::Image::drawCachedSubimage):
(WebCore::Image::destroyDecodedData):
* Source/WebCore/platform/graphics/Image.h:
(WebCore::Image::cachedSubimageCreateCountForTesting const):
(WebCore::Image::cachedSubimageDrawCountForTesting const):
(WebCore::Image::shouldDrawFromCachedSubimage const):
(WebCore::Image::mustDrawFromCachedSubimage const):
(WebCore::Image::drawCachedSubimage):
* Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::decodedSizeChanged):
(WebCore::PDFDocumentImage::shouldDrawFromCachedSubimage const):
(WebCore::PDFDocumentImage::mustDrawFromCachedSubimage const):
(WebCore::PDFDocumentImage::draw):
(WebCore::PDFDocumentImage::destroyDecodedData):
(WebCore::PDFDocumentImage::createPDFDocument):
(WebCore::PDFDocumentImage::setPdfImageCachingPolicy): Deleted.
(WebCore::PDFDocumentImage::cacheParametersMatch const): Deleted.
(WebCore::transformContextForPainting): Deleted.
(WebCore::cachedImageRect): Deleted.
(WebCore::PDFDocumentImage::updateCachedImageIfNeeded): Deleted.
* Source/WebCore/platform/graphics/cg/PDFDocumentImage.h:
* Source/WebCore/platform/mediastream/WebRTCProvider.h:
* Source/WebCore/rendering/RenderImage.cpp:
(WebCore::RenderImage::paintIntoRect):
* Source/WebCore/svg/graphics/SVGImage.h:
* Source/WebCore/svg/graphics/SVGImageForContainer.h:
* Source/WebCore/testing/InternalSettings.cpp:
(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
(WebCore::InternalSettings::setStorageBlockingPolicy):
(WebCore::InternalSettings::setPDFImageCachingPolicy): Deleted.
* Source/WebCore/testing/InternalSettings.h:
* Source/WebCore/testing/InternalSettings.idl:
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::imageCachedSubimageCreateCount):
(WebCore::pdfDocumentImageFromImageElement): Deleted.
(WebCore::Internals::pdfDocumentCachingCount): Deleted.
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
Canonical link: https://commits.webkit.org/259928@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes