Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 3a5521b1d7ea8451a71bbbb05bdd32def99a3249 https://github.com/WebKit/WebKit/commit/3a5521b1d7ea8451a71bbbb05bdd32def99a3249 Author: Kimmo Kinnunen <kkinnu...@apple.com> Date: 2023-10-09 (Mon, 09 Oct 2023)
Changed paths: M Source/WebCore/Sources.txt M Source/WebCore/WebCore.xcodeproj/project.pbxproj M Source/WebCore/html/CustomPaintImage.cpp M Source/WebCore/html/CustomPaintImage.h M Source/WebCore/html/HTMLCanvasElement.cpp M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp M Source/WebCore/platform/graphics/BifurcatedGraphicsContext.cpp M Source/WebCore/platform/graphics/BifurcatedGraphicsContext.h M Source/WebCore/platform/graphics/BitmapImage.cpp M Source/WebCore/platform/graphics/BitmapImage.h M Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp M Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h M Source/WebCore/platform/graphics/DecodingOptions.h M Source/WebCore/platform/graphics/GeneratedImage.h M Source/WebCore/platform/graphics/GradientImage.cpp M Source/WebCore/platform/graphics/GradientImage.h M Source/WebCore/platform/graphics/GraphicsContext.cpp M Source/WebCore/platform/graphics/GraphicsContext.h M Source/WebCore/platform/graphics/GraphicsContextState.h M Source/WebCore/platform/graphics/Image.cpp M Source/WebCore/platform/graphics/Image.h M Source/WebCore/platform/graphics/ImageBuffer.cpp M Source/WebCore/platform/graphics/ImageOrientation.h A Source/WebCore/platform/graphics/ImagePaintingOptions.cpp M Source/WebCore/platform/graphics/ImagePaintingOptions.h M Source/WebCore/platform/graphics/NamedImageGeneratedImage.cpp M Source/WebCore/platform/graphics/NamedImageGeneratedImage.h M Source/WebCore/platform/graphics/NativeImage.h M Source/WebCore/platform/graphics/NullGraphicsContext.h M Source/WebCore/platform/graphics/cairo/CairoOperations.cpp M Source/WebCore/platform/graphics/cairo/CairoOperations.h M Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp M Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.h M Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp M Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp M Source/WebCore/platform/graphics/cg/GraphicsContextCG.h M Source/WebCore/platform/graphics/cg/NativeImageCG.cpp M Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp M Source/WebCore/platform/graphics/cg/PDFDocumentImage.h M Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp M Source/WebCore/platform/graphics/displaylists/DisplayListItems.h M Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp M Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h M Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp M Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h M Source/WebCore/platform/graphics/filters/software/FECompositeSoftwareApplier.cpp M Source/WebCore/platform/graphics/filters/software/SourceAlphaSoftwareApplier.cpp M Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp M Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h M Source/WebCore/rendering/BackgroundPainter.cpp M Source/WebCore/rendering/svg/RenderSVGImage.cpp M Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp M Source/WebCore/rendering/svg/RenderSVGResourceMasker.h M Source/WebCore/svg/graphics/SVGImage.cpp M Source/WebCore/svg/graphics/SVGImage.h M Source/WebCore/svg/graphics/SVGImageForContainer.cpp M Source/WebCore/svg/graphics/SVGImageForContainer.h M Source/WebCore/svg/graphics/SVGResourceImage.cpp M Source/WebCore/svg/graphics/SVGResourceImage.h M Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp M Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.h M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in M Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp M Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h M Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp M Tools/TestWebKitAPI/Tests/WebCore/ImageBufferTests.cpp Log Message: ----------- ImagePaintingOptions does not have TextStream <<operator https://bugs.webkit.org/show_bug.cgi?id=262772 rdar://116567502 Reviewed by Simon Fraser. Most likely TextStream& operator<<(TextStream&, ImagePaintingOptions) was not implemented sooner since it is a bit more involved. ImagePaintingOptions had variadic non-explicit constructor, that accepted, say, CompositeOperator. Since CompositeOperator had operator<<, adding operator<< to ImagePaintingOptions would create ambiguity wrt whether to operator<<(..., CompositeOperator) or operator<<(.., ImagePaintingOptions) and convert implicitly via ImagePaintingOptions(CompositeOperator). Making the single-parameter constructor explicit is cumbersome due to GraphicsContext::someMethod(..., const ImagePaintingOptions& = { param }) default parameter pattern. Due to C++ rules, this involves copy constructing the ImagePaintingOptions and if the single parameter constructor is explict, the copy won't happen. ImagePaintingOptions should not be passed as const& anyway, as: - the call sites do not reuse the object, so there's no downside constructing the original to the call stack of the callee - the object is just couple bytes of real data - the object is conceptually overriden in some call receivers and passed further. The override cannot reuse the same space in const& case. Fix by: - Shrink the ImagePaintingOptions so it's smaller than const ImagePaintingOptions&. Reorder fields, select bitfield sizes that are quite confortably higher than future theoretical additions to the enums (does not try to be optimal for today's enums). - Pass ImagePaintingOptions by value - Make the single-parameter constructor explicit - Implement the <<operator xcrun python3 Tools/Scripts/dump-class-layout -b ~/Build -c Debug WebCore WebCore::ImagePaintingOptions +0 < 3> WebCore::ImagePaintingOptions +0 < :5> WebCore::BlendMode m_blendMode : 5 +0 < :3> WebCore::DecodingMode m_decodingMode : 3 +1 < :4> WebCore::CompositeOperator m_compositeOperator : 4 +1 < :4> WebCore::ImageOrientation::Orientation m_orientation : 4 +2 < :4> WebCore::InterpolationQuality m_interpolationQuality : 4 +2 < :4> <UNUSED BITS: 4 bits> Total byte size: 3 Total pad bytes: 0 * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/html/CustomPaintImage.cpp: (WebCore::CustomPaintImage::draw): (WebCore::CustomPaintImage::drawPattern): * Source/WebCore/html/CustomPaintImage.h: * Source/WebCore/html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::paint): * Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::compositeBuffer): (WebCore::drawImageToContext): * Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::videoFrameToImage): * Source/WebCore/platform/graphics/BifurcatedGraphicsContext.cpp: (WebCore::BifurcatedGraphicsContext::drawNativeImageInternal): (WebCore::BifurcatedGraphicsContext::drawPattern): (WebCore::BifurcatedGraphicsContext::drawImage): (WebCore::BifurcatedGraphicsContext::drawTiledImage): * Source/WebCore/platform/graphics/BifurcatedGraphicsContext.h: * Source/WebCore/platform/graphics/BitmapImage.cpp: (WebCore::drawNativeImage): (WebCore::BitmapImage::draw): (WebCore::BitmapImage::drawPattern): * Source/WebCore/platform/graphics/BitmapImage.h: * Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp: (WebCore::CrossfadeGeneratedImage::draw): (WebCore::CrossfadeGeneratedImage::drawPattern): * Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h: * Source/WebCore/platform/graphics/DecodingOptions.h: * Source/WebCore/platform/graphics/GeneratedImage.h: (WebCore::GeneratedImage::draw): (WebCore::GeneratedImage::drawPattern): * Source/WebCore/platform/graphics/GradientImage.cpp: (WebCore::GradientImage::draw): (WebCore::GradientImage::drawPattern): * Source/WebCore/platform/graphics/GradientImage.h: * Source/WebCore/platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::drawNativeImage): (WebCore::GraphicsContext::drawImage): (WebCore::GraphicsContext::drawTiledImage): (WebCore::GraphicsContext::drawImageBuffer): (WebCore::GraphicsContext::drawConsumingImageBuffer): (WebCore::GraphicsContext::drawPattern): * Source/WebCore/platform/graphics/GraphicsContext.h: (WebCore::GraphicsContext::drawNativeImage): (WebCore::GraphicsContext::drawImage): (WebCore::GraphicsContext::drawTiledImage): (WebCore::GraphicsContext::drawImageBuffer): (WebCore::GraphicsContext::drawConsumingImageBuffer): (WebCore::GraphicsContext::drawPattern): (WebCore::GraphicsContext::drawNativeImageInternal): * Source/WebCore/platform/graphics/Image.cpp: (WebCore::Image::drawPattern): (WebCore::Image::drawTiled): * Source/WebCore/platform/graphics/Image.h: (WebCore::Image::drawPattern): (WebCore::Image::draw): (WebCore::Image::drawTiled): * Source/WebCore/platform/graphics/ImageBuffer.cpp: (WebCore::copyImageBuffer): * Source/WebCore/platform/graphics/ImageOrientation.h: * Source/WebCore/platform/graphics/ImagePaintingOptions.cpp: Added. (WebCore::operator<<): * Source/WebCore/platform/graphics/ImagePaintingOptions.h: (WebCore::ImagePaintingOptions::ImagePaintingOptions): (WebCore::ImagePaintingOptions::setOption): * Source/WebCore/platform/graphics/NamedImageGeneratedImage.cpp: (WebCore::NamedImageGeneratedImage::draw): (WebCore::NamedImageGeneratedImage::drawPattern): * Source/WebCore/platform/graphics/NamedImageGeneratedImage.h: * Source/WebCore/platform/graphics/NativeImage.h: * Source/WebCore/platform/graphics/NullGraphicsContext.h: (WebCore::NullGraphicsContext::drawImage): (WebCore::NullGraphicsContext::drawTiledImage): (WebCore::NullGraphicsContext::drawImageBuffer): * Source/WebCore/platform/graphics/cairo/CairoOperations.cpp: (WebCore::Cairo::drawPlatformImage): (WebCore::Cairo::drawPattern): * Source/WebCore/platform/graphics/cairo/CairoOperations.h: * Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContextCairo::drawNativeImageInternal): (WebCore::GraphicsContextCairo::drawPattern): * Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.h: * Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp: (WebCore::NativeImage::draw): * Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContextCG::drawNativeImageInternal): (WebCore::GraphicsContextCG::drawPattern): * Source/WebCore/platform/graphics/cg/GraphicsContextCG.h: * Source/WebCore/platform/graphics/cg/NativeImageCG.cpp: (WebCore::NativeImage::draw): * Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp: (WebCore::PDFDocumentImage::createCachedSubimage): (WebCore::PDFDocumentImage::drawPDFDocument): (WebCore::PDFDocumentImage::drawFromCachedSubimage): (WebCore::PDFDocumentImage::draw): * Source/WebCore/platform/graphics/cg/PDFDocumentImage.h: * Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp: (WebCore::DisplayList::DrawPattern::DrawPattern): * Source/WebCore/platform/graphics/displaylists/DisplayListItems.h: (WebCore::DisplayList::DrawImageBuffer::DrawImageBuffer): (WebCore::DisplayList::DrawNativeImage::DrawNativeImage): (WebCore::DisplayList::DrawPattern::DrawPattern): * Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp: (WebCore::DisplayList::Recorder::drawImageBuffer): (WebCore::DisplayList::Recorder::drawConsumingImageBuffer): (WebCore::DisplayList::Recorder::drawNativeImageInternal): (WebCore::DisplayList::Recorder::drawPattern): * Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h: (WebCore::DisplayList::Recorder::recordDrawPattern): * Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp: (WebCore::DisplayList::RecorderImpl::recordDrawImageBuffer): (WebCore::DisplayList::RecorderImpl::recordDrawNativeImage): (WebCore::DisplayList::RecorderImpl::recordDrawPattern): * Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h: (WebCore::DisplayList::RecorderImpl::recordDrawPattern): * Source/WebCore/platform/graphics/filters/software/FECompositeSoftwareApplier.cpp: (WebCore::FECompositeSoftwareApplier::applyNonArithmetic const): * Source/WebCore/platform/graphics/filters/software/SourceAlphaSoftwareApplier.cpp: (WebCore::SourceAlphaSoftwareApplier::apply const): * Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: (Nicosia::CairoOperationRecorder::drawImageBuffer): (Nicosia::CairoOperationRecorder::drawNativeImageInternal): (Nicosia::CairoOperationRecorder::drawPattern): * Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h: * Source/WebCore/rendering/BackgroundPainter.cpp: (WebCore::BackgroundPainter::paintFillLayer): * Source/WebCore/rendering/svg/RenderSVGImage.cpp: (WebCore::RenderSVGImage::paintIntoRect): * Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp: (WebCore::RenderSVGResourceMasker::drawContentIntoContext): * Source/WebCore/rendering/svg/RenderSVGResourceMasker.h: * Source/WebCore/svg/graphics/SVGImage.cpp: (WebCore::SVGImage::drawForContainer): (WebCore::SVGImage::drawPatternForContainer): (WebCore::SVGImage::draw): * Source/WebCore/svg/graphics/SVGImage.h: * Source/WebCore/svg/graphics/SVGImageForContainer.cpp: (WebCore::SVGImageForContainer::draw): (WebCore::SVGImageForContainer::drawPattern): * Source/WebCore/svg/graphics/SVGImageForContainer.h: * Source/WebCore/svg/graphics/SVGResourceImage.cpp: (WebCore::SVGResourceImage::draw): (WebCore::SVGResourceImage::drawPattern): * Source/WebCore/svg/graphics/SVGResourceImage.h: * Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp: (WebKit::RemoteDisplayListRecorder::drawImageBuffer): (WebKit::RemoteDisplayListRecorder::drawNativeImage): (WebKit::RemoteDisplayListRecorder::drawPattern): * Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.h: * Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in: Changes the argument coders because the member-wise argument coder asserts the object size == encoded size. It cannot account for the bitfields being used. * Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp: (WebKit::RemoteDisplayListRecorderProxy::recordDrawImageBuffer): (WebKit::RemoteDisplayListRecorderProxy::recordDrawNativeImage): (WebKit::RemoteDisplayListRecorderProxy::recordDrawPattern): * Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h: (WebKit::RemoteDisplayListRecorderProxy::recordDrawPattern): * Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp: (WebKit::RemoteImageBufferProxy::sinkIntoBufferForDifferentThread): * Tools/TestWebKitAPI/Tests/WebCore/ImageBufferTests.cpp: (TestWebKitAPI::TEST_P): Canonical link: https://commits.webkit.org/269066@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes