Title: [290679] trunk
Revision
290679
Author
[email protected]
Date
2022-03-01 15:16:43 -0800 (Tue, 01 Mar 2022)

Log Message

Source/WebCore:
[macOS][REGRESSION] (r289518): Form controls are scaled twice on Retina display
https://bugs.webkit.org/show_bug.cgi?id=237128
rdar://89064642

Reviewed by Darin Adler.

Using the name GraphicsContext::createImageBuffer() for different behaviors
was a mistake in r289518. To clean this up, the createImageBuffer() version
which scales the GraphicsContext of the ImageBuffer will be renamed
createScaledImageBuffer(). and the existing createCompatibleImageBuffer()
will be renamed createAlignedImageBuffer(). So we will have these three
methods in GraphicsContext:

1) createImageBuffer(): The default behavior of this method is to create
   an ImageBuffer similar to the underlying ImageBuffer of GraphicsContext.
   But it gives ability to change the renderingMode and the renderingMethod.
   It can be forced to create a non-accelerated local ImageBuffer for example.

   The caller of this method usually uses a framework to draw some custom
   drawing and it just needs a scratch buffer to be drawn in the place of
   a render object. The caller does not require any transformation to be
   applied to the GraphicsContext of the ImageBuffer before starting its
   custom drawing. Drawing the form controls using AppKit is an example
   of such case.

2) createScaledImageBuffer(): This is similar to createImageBuffer() but
   it always creates the ImageBuffer with resolutionScale = 1 so it has
   to scale the size by the scaleFactor before calling createImageBuffer().
   It also scales the GraphicsContext of the created ImageBuffer with the
   scaleFactor and it translates its coordinates origin for the FloatRect
   version. It also handles the clamping if needed.

   This method is suitable for cases when the overall scaleFatcor
   (device ScaleFactor + clamping ScaleFactor) has be known to the caller
   in advance. No clamping will be required in this case. SVG filter,
   masker, clipper and gradient are the callers to this function.

3) createAlignedImageBuffer(): This is similar to createScaledImageBuffer()
   but it does not take a scaling factor argument. It inherits it from
   the GraphicsContext.

   Usually the purpose of this method is to transfer the drawing from a
   layer to a scratch ImageBuffer temporarily then draw the scratch
   ImageBuffer in the place of the original drawing. Drawing a PDFDocument
   image, for example, requires using this method.

To fix this bug:

Form controls have to use the first version of createImageBuffer() which
still has the same name instead of using the second version which will
be renamed createScaledImageBuffer().

Another cleaning is to pass RenderingMethod as an std::optional argument
the three methods. This means we do not need the value "Default" since
passing std::nullopt will have the same meaning.

Test: fast/hidpi/hidpi-form-controls-drawing-size.html

* html/CustomPaintCanvas.cpp:
(WebCore::CustomPaintCanvas::replayDisplayList const):
* html/CustomPaintImage.cpp:
(WebCore::CustomPaintImage::drawPattern):
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::drawImage):
(WebCore::CanvasRenderingContext2DBase::drawTextUnchecked):
* platform/cocoa/ThemeCocoa.mm:
(WebCore::drawApplePayButton):
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::drawPattern):
* platform/graphics/GradientImage.cpp:
(WebCore::GradientImage::drawPattern):
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::createImageBuffer const):
(WebCore::GraphicsContext::createScaledImageBuffer const):
(WebCore::GraphicsContext::createAlignedImageBuffer const):
(WebCore::GraphicsContext::createCompatibleImageBuffer const): Deleted.
* platform/graphics/GraphicsContext.h:
(WebCore::GraphicsContext::createScaledImageBuffer):
(WebCore::GraphicsContext::createImageBuffer): Deleted.
* platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::clone const):
* platform/graphics/NamedImageGeneratedImage.cpp:
(WebCore::NamedImageGeneratedImage::drawPattern):
* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::updateCachedImageIfNeeded):
(WebCore::PDFDocumentImage::draw):
* platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp:
(WebCore::DrawGlyphsRecorder::drawOTSVGRun):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::createImageBuffer const):
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/mac/ThemeMac.mm:
(WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
* rendering/RenderLayerBacking.cpp:
(WebCore::patternForDescription):
* rendering/RenderLayerFilters.cpp:
(WebCore::RenderLayerFilters::allocateBackingStoreIfNeeded):
* rendering/RenderThemeCocoa.mm:
(WebCore::RenderThemeCocoa::paintApplePayButton):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintListButtonForInput):
(WebCore::RenderThemeMac::paintProgressBar):
* rendering/svg/RenderSVGResourceClipper.cpp:
(WebCore::RenderSVGResourceClipper::applyClippingToContext):
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::applyResource):
* rendering/svg/RenderSVGResourceGradient.cpp:
(WebCore::createMaskAndSwapContextForTextGradient):
* rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::applyResource):
* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::createTileImage const):
* rendering/svg/SVGRenderingContext.cpp:
(WebCore::SVGRenderingContext::bufferForeground):

Source/WebKit:
[macOS][REGRESSION] (rr289518): Form controls are scaled twice on Retina display
https://bugs.webkit.org/show_bug.cgi?id=237128
rdar://89064642

Reviewed by Darin Adler.

* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::createImageBuffer const):
(WebKit::RemoteDisplayListRecorderProxy::createAlignedImageBuffer const):
(WebKit::RemoteDisplayListRecorderProxy::createCompatibleImageBuffer const): Deleted.
* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:

LayoutTests:
[macOS][REGRESSION] (rr289518): Form controls are scaled twice on Retina display
https://bugs.webkit.org/show_bug.cgi?id=237128
rdar://89064642

Reviewed by Darin Adler.

* fast/hidpi/hidpi-form-controls-drawing-size-expected.html: Added.
* fast/hidpi/hidpi-form-controls-drawing-size.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (290678 => 290679)


--- trunk/LayoutTests/ChangeLog	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/LayoutTests/ChangeLog	2022-03-01 23:16:43 UTC (rev 290679)
@@ -1,3 +1,14 @@
+2022-03-01  Said Abou-Hallawa  <[email protected]>
+
+        [macOS][REGRESSION] (rr289518): Form controls are scaled twice on Retina display
+        https://bugs.webkit.org/show_bug.cgi?id=237128
+        rdar://89064642
+
+        Reviewed by Darin Adler.
+
+        * fast/hidpi/hidpi-form-controls-drawing-size-expected.html: Added.
+        * fast/hidpi/hidpi-form-controls-drawing-size.html: Added.
+
 2022-03-01  Robert Jenner  <[email protected]>
 
         [ Win ] 4X imported/mozilla/svg/blend(layout-tests) are constant Image Only Failures

Added: trunk/LayoutTests/fast/hidpi/hidpi-form-controls-drawing-size-expected.html (0 => 290679)


--- trunk/LayoutTests/fast/hidpi/hidpi-form-controls-drawing-size-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/hidpi/hidpi-form-controls-drawing-size-expected.html	2022-03-01 23:16:43 UTC (rev 290679)
@@ -0,0 +1,12 @@
+<style>
+    .box {
+        position: absolute;
+        width: 100px;
+        height: 100px;
+    }
+</style>
+<script src=""
+<body>
+    <div class="box" style="left: 0px; top: 0px; background-color: green;"></div>
+    <div class="box" style="left: 110px; top: 0px; background-color: green;"></div>
+</body>

Added: trunk/LayoutTests/fast/hidpi/hidpi-form-controls-drawing-size.html (0 => 290679)


--- trunk/LayoutTests/fast/hidpi/hidpi-form-controls-drawing-size.html	                        (rev 0)
+++ trunk/LayoutTests/fast/hidpi/hidpi-form-controls-drawing-size.html	2022-03-01 23:16:43 UTC (rev 290679)
@@ -0,0 +1,16 @@
+<style>
+    .box {
+        position: absolute;
+        width: 100px;
+        height: 100px;
+    }
+</style>
+<script src=""
+<body>
+    <progress class="box" style="left: 0px; top: 0px;" min="0" max="100" value="100"></progress>
+    <div class="box" style="left: 0px; top: 0px; background-color: green;"></div>
+
+    <datalist id="list"></datalist>
+    <input class="box" style="left: 110px; top: 0px;" type="search" list="list">
+    <div class="box" style="left: 110px; top: 0px; background-color: green;"></div>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (290678 => 290679)


--- trunk/Source/WebCore/ChangeLog	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/ChangeLog	2022-03-01 23:16:43 UTC (rev 290679)
@@ -1,3 +1,122 @@
+2022-03-01  Said Abou-Hallawa  <[email protected]>
+
+        [macOS][REGRESSION] (r289518): Form controls are scaled twice on Retina display
+        https://bugs.webkit.org/show_bug.cgi?id=237128
+        rdar://89064642
+
+        Reviewed by Darin Adler.
+
+        Using the name GraphicsContext::createImageBuffer() for different behaviors
+        was a mistake in r289518. To clean this up, the createImageBuffer() version
+        which scales the GraphicsContext of the ImageBuffer will be renamed
+        createScaledImageBuffer(). and the existing createCompatibleImageBuffer()
+        will be renamed createAlignedImageBuffer(). So we will have these three
+        methods in GraphicsContext:
+
+        1) createImageBuffer(): The default behavior of this method is to create
+           an ImageBuffer similar to the underlying ImageBuffer of GraphicsContext.
+           But it gives ability to change the renderingMode and the renderingMethod.
+           It can be forced to create a non-accelerated local ImageBuffer for example.
+           
+           The caller of this method usually uses a framework to draw some custom
+           drawing and it just needs a scratch buffer to be drawn in the place of
+           a render object. The caller does not require any transformation to be
+           applied to the GraphicsContext of the ImageBuffer before starting its
+           custom drawing. Drawing the form controls using AppKit is an example
+           of such case.
+
+        2) createScaledImageBuffer(): This is similar to createImageBuffer() but
+           it always creates the ImageBuffer with resolutionScale = 1 so it has
+           to scale the size by the scaleFactor before calling createImageBuffer().
+           It also scales the GraphicsContext of the created ImageBuffer with the
+           scaleFactor and it translates its coordinates origin for the FloatRect
+           version. It also handles the clamping if needed. 
+
+           This method is suitable for cases when the overall scaleFatcor
+           (device ScaleFactor + clamping ScaleFactor) has be known to the caller
+           in advance. No clamping will be required in this case. SVG filter,
+           masker, clipper and gradient are the callers to this function.
+
+        3) createAlignedImageBuffer(): This is similar to createScaledImageBuffer()
+           but it does not take a scaling factor argument. It inherits it from
+           the GraphicsContext.
+
+           Usually the purpose of this method is to transfer the drawing from a
+           layer to a scratch ImageBuffer temporarily then draw the scratch
+           ImageBuffer in the place of the original drawing. Drawing a PDFDocument
+           image, for example, requires using this method.
+
+        To fix this bug:
+
+        Form controls have to use the first version of createImageBuffer() which
+        still has the same name instead of using the second version which will
+        be renamed createScaledImageBuffer().
+
+        Another cleaning is to pass RenderingMethod as an std::optional argument
+        the three methods. This means we do not need the value "Default" since
+        passing std::nullopt will have the same meaning.
+
+        Test: fast/hidpi/hidpi-form-controls-drawing-size.html
+
+        * html/CustomPaintCanvas.cpp:
+        (WebCore::CustomPaintCanvas::replayDisplayList const):
+        * html/CustomPaintImage.cpp:
+        (WebCore::CustomPaintImage::drawPattern):
+        * html/canvas/CanvasRenderingContext2DBase.cpp:
+        (WebCore::CanvasRenderingContext2DBase::drawImage):
+        (WebCore::CanvasRenderingContext2DBase::drawTextUnchecked):
+        * platform/cocoa/ThemeCocoa.mm:
+        (WebCore::drawApplePayButton):
+        * platform/graphics/BitmapImage.cpp:
+        (WebCore::BitmapImage::drawPattern):
+        * platform/graphics/GradientImage.cpp:
+        (WebCore::GradientImage::drawPattern):
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::createImageBuffer const):
+        (WebCore::GraphicsContext::createScaledImageBuffer const):
+        (WebCore::GraphicsContext::createAlignedImageBuffer const):
+        (WebCore::GraphicsContext::createCompatibleImageBuffer const): Deleted.
+        * platform/graphics/GraphicsContext.h:
+        (WebCore::GraphicsContext::createScaledImageBuffer):
+        (WebCore::GraphicsContext::createImageBuffer): Deleted.
+        * platform/graphics/ImageBuffer.cpp:
+        (WebCore::ImageBuffer::clone const):
+        * platform/graphics/NamedImageGeneratedImage.cpp:
+        (WebCore::NamedImageGeneratedImage::drawPattern):
+        * platform/graphics/cg/PDFDocumentImage.cpp:
+        (WebCore::PDFDocumentImage::updateCachedImageIfNeeded):
+        (WebCore::PDFDocumentImage::draw):
+        * platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp:
+        (WebCore::DrawGlyphsRecorder::drawOTSVGRun):
+        * platform/graphics/displaylists/DisplayListRecorder.cpp:
+        (WebCore::DisplayList::Recorder::createImageBuffer const):
+        * platform/graphics/displaylists/DisplayListRecorder.h:
+        * platform/mac/ThemeMac.mm:
+        (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::patternForDescription):
+        * rendering/RenderLayerFilters.cpp:
+        (WebCore::RenderLayerFilters::allocateBackingStoreIfNeeded):
+        * rendering/RenderThemeCocoa.mm:
+        (WebCore::RenderThemeCocoa::paintApplePayButton):
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::paintListButtonForInput):
+        (WebCore::RenderThemeMac::paintProgressBar):
+        * rendering/svg/RenderSVGResourceClipper.cpp:
+        (WebCore::RenderSVGResourceClipper::applyClippingToContext):
+        * rendering/svg/RenderSVGResourceFilter.cpp:
+        (WebCore::RenderSVGResourceFilter::applyResource):
+        * rendering/svg/RenderSVGResourceGradient.cpp:
+        (WebCore::createMaskAndSwapContextForTextGradient):
+        * rendering/svg/RenderSVGResourceMasker.cpp:
+        (WebCore::RenderSVGResourceMasker::applyResource):
+        * rendering/svg/RenderSVGResourcePattern.cpp:
+        (WebCore::RenderSVGResourcePattern::createTileImage const):
+        * rendering/svg/SVGRenderingContext.cpp:
+        (WebCore::SVGRenderingContext::bufferForeground):
+
 2022-03-01  Eric Carlson  <[email protected]>
 
         [Cocoa] HLS stream currentTime sometimes jumps backwards

Modified: trunk/Source/WebCore/html/CustomPaintCanvas.cpp (290678 => 290679)


--- trunk/Source/WebCore/html/CustomPaintCanvas.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/html/CustomPaintCanvas.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -73,7 +73,7 @@
     // FIXME: Using an intermediate buffer is not needed if there are no composite operations.
     auto clipBounds = ctx->clipBounds();
 
-    auto image = ctx->createCompatibleImageBuffer(clipBounds.size());
+    auto image = ctx->createAlignedImageBuffer(clipBounds.size());
     if (!image)
         return;
 

Modified: trunk/Source/WebCore/html/CustomPaintImage.cpp (290678 => 290679)


--- trunk/Source/WebCore/html/CustomPaintImage.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/html/CustomPaintImage.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -199,7 +199,7 @@
     adjustedPatternCTM.scale(1.0 / xScale, 1.0 / yScale);
     adjustedSrcRect.scale(xScale, yScale);
 
-    auto buffer = destContext.createCompatibleImageBuffer(adjustedSize);
+    auto buffer = destContext.createAlignedImageBuffer(adjustedSize);
     if (!buffer)
         return;
     doCustomPaint(buffer->context(), adjustedSize);

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp (290678 => 290679)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -1611,7 +1611,7 @@
         repaintEntireCanvas = true;
     } else if (state().globalComposite == CompositeOperator::Copy) {
         if (&sourceCanvas == &canvasBase()) {
-            if (auto copy = c->createCompatibleImageBuffer(srcRect.size(), colorSpace())) {
+            if (auto copy = c->createAlignedImageBuffer(srcRect.size(), colorSpace())) {
                 copy->context().drawImageBuffer(*buffer, -srcRect.location());
                 clearCanvas();
                 c->drawImageBuffer(*copy, dstRect, { { }, srcRect.size() }, { state().globalComposite, state().globalBlend });
@@ -2459,7 +2459,7 @@
             fontProxy.drawBidiText(*c, textRun, location + offset, FontCascade::UseFallbackIfFontNotReady);
         }
 
-        auto maskImage = c->createCompatibleImageBuffer(maskRect.size());
+        auto maskImage = c->createAlignedImageBuffer(maskRect.size());
         if (!maskImage)
             return;
 

Modified: trunk/Source/WebCore/platform/cocoa/ThemeCocoa.mm (290678 => 290679)


--- trunk/Source/WebCore/platform/cocoa/ThemeCocoa.mm	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/platform/cocoa/ThemeCocoa.mm	2022-03-01 23:16:43 UTC (rev 290679)
@@ -111,7 +111,7 @@
 static void drawApplePayButton(GraphicsContext& context, CGPDFPageRef page, const FloatSize& size)
 {
     // Create a local ImageBuffer because decoding the PDF images has to happen in WebProcess.
-    auto imageBuffer = context.createCompatibleImageBuffer(size, DestinationColorSpace::SRGB(), RenderingMethod::Local);
+    auto imageBuffer = context.createAlignedImageBuffer(size, DestinationColorSpace::SRGB(), RenderingMethod::Local);
     if (!imageBuffer)
         return;
 

Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (290678 => 290679)


--- trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -348,7 +348,7 @@
     }
 
     if (!m_cachedImage) {
-        auto buffer = ctxt.createCompatibleImageBuffer(expandedIntSize(tileRect.size()));
+        auto buffer = ctxt.createAlignedImageBuffer(expandedIntSize(tileRect.size()));
         if (!buffer)
             return;
 

Modified: trunk/Source/WebCore/platform/graphics/GradientImage.cpp (290678 => 290679)


--- trunk/Source/WebCore/platform/graphics/GradientImage.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/platform/graphics/GradientImage.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -72,7 +72,7 @@
     unsigned generatorHash = m_gradient->hash();
 
     if (!m_cachedImage || m_cachedGeneratorHash != generatorHash || m_cachedAdjustedSize != adjustedSize || !areEssentiallyEqual(destContext.scaleFactor(), m_cachedScaleFactor)) {
-        auto imageBuffer = destContext.createCompatibleImageBuffer(adjustedSize);
+        auto imageBuffer = destContext.createAlignedImageBuffer(adjustedSize);
         if (!imageBuffer)
             return;
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (290678 => 290679)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -577,15 +577,15 @@
     return scaledImageBufferSize(size, scaleFactor());
 }
 
-RefPtr<ImageBuffer> GraphicsContext::createImageBuffer(const FloatSize& size, const DestinationColorSpace& colorSpace, RenderingMode renderingMode, RenderingMethod renderingMethod) const
+RefPtr<ImageBuffer> GraphicsContext::createImageBuffer(const FloatSize& size, float resolutionScale, const DestinationColorSpace& colorSpace, std::optional<RenderingMode> renderingMode, std::optional<RenderingMethod> renderingMethod) const
 {
-    if (renderingMethod == RenderingMethod::DisplayList)
-        return ImageBuffer::create(size, renderingMode, ShouldUseDisplayList::Yes, RenderingPurpose::Unspecified, 1, colorSpace, PixelFormat::BGRA8);
+    if (!renderingMethod || *renderingMethod == RenderingMethod::Local)
+        return ImageBuffer::create(size, renderingMode.value_or(this->renderingMode()), resolutionScale, colorSpace, PixelFormat::BGRA8);
 
-    return ImageBuffer::create(size, renderingMode, 1, colorSpace, PixelFormat::BGRA8);
+    return ImageBuffer::create(size, renderingMode.value_or(this->renderingMode()), ShouldUseDisplayList::Yes, RenderingPurpose::Unspecified, resolutionScale, colorSpace, PixelFormat::BGRA8);
 }
 
-RefPtr<ImageBuffer> GraphicsContext::createImageBuffer(const FloatSize& size, const FloatSize& scale, const DestinationColorSpace& colorSpace, std::optional<RenderingMode> renderingMode, RenderingMethod renderingMethod) const
+RefPtr<ImageBuffer> GraphicsContext::createScaledImageBuffer(const FloatSize& size, const FloatSize& scale, const DestinationColorSpace& colorSpace, std::optional<RenderingMode> renderingMode, std::optional<RenderingMethod> renderingMethod) const
 {
     auto expandedScaledSize = scaledImageBufferSize(size, scale);
     if (expandedScaledSize.isEmpty())
@@ -593,7 +593,7 @@
 
     auto clampingScale = clampingScaleForImageBufferSize(expandedScaledSize);
 
-    auto imageBuffer = createImageBuffer(expandedScaledSize * clampingScale, colorSpace, renderingMode.value_or(this->renderingMode()), renderingMethod);
+    auto imageBuffer = createImageBuffer(expandedScaledSize * clampingScale, 1, colorSpace, renderingMode, renderingMethod);
     if (!imageBuffer)
         return nullptr;
 
@@ -605,7 +605,7 @@
     return imageBuffer;
 }
 
-RefPtr<ImageBuffer> GraphicsContext::createImageBuffer(const FloatRect& rect, const FloatSize& scale, const DestinationColorSpace& colorSpace, std::optional<RenderingMode> renderingMode, RenderingMethod renderingMethod) const
+RefPtr<ImageBuffer> GraphicsContext::createScaledImageBuffer(const FloatRect& rect, const FloatSize& scale, const DestinationColorSpace& colorSpace, std::optional<RenderingMode> renderingMode, std::optional<RenderingMethod> renderingMethod) const
 {
     auto expandedScaledRect = scaledImageBufferRect(rect, scale);
     if (expandedScaledRect.isEmpty())
@@ -613,7 +613,7 @@
 
     auto clampingScale = clampingScaleForImageBufferSize(expandedScaledRect.size());
 
-    auto imageBuffer = createImageBuffer(expandedScaledRect.size() * clampingScale, colorSpace, renderingMode.value_or(this->renderingMode()), renderingMethod);
+    auto imageBuffer = createImageBuffer(expandedScaledRect.size() * clampingScale, 1, colorSpace, renderingMode, renderingMethod);
     if (!imageBuffer)
         return nullptr;
 
@@ -628,14 +628,14 @@
     return imageBuffer;
 }
 
-RefPtr<ImageBuffer> GraphicsContext::createCompatibleImageBuffer(const FloatSize& size, const DestinationColorSpace& colorSpace, RenderingMethod renderingMethod) const
+RefPtr<ImageBuffer> GraphicsContext::createAlignedImageBuffer(const FloatSize& size, const DestinationColorSpace& colorSpace, std::optional<RenderingMethod> renderingMethod) const
 {
-    return createImageBuffer(size, scaleFactor(), colorSpace, renderingMode(), renderingMethod);
+    return createScaledImageBuffer(size, scaleFactor(), colorSpace, renderingMode(), renderingMethod);
 }
 
-RefPtr<ImageBuffer> GraphicsContext::createCompatibleImageBuffer(const FloatRect& rect, const DestinationColorSpace& colorSpace, RenderingMethod renderingMethod) const
+RefPtr<ImageBuffer> GraphicsContext::createAlignedImageBuffer(const FloatRect& rect, const DestinationColorSpace& colorSpace, std::optional<RenderingMethod> renderingMethod) const
 {
-    return createImageBuffer(rect, scaleFactor(), colorSpace, renderingMode(), renderingMethod);
+    return createScaledImageBuffer(rect, scaleFactor(), colorSpace, renderingMode(), renderingMethod);
 }
 
 ImageDrawResult GraphicsContext::drawImage(Image& image, const FloatPoint& destination, const ImagePaintingOptions& imagePaintingOptions)

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (290678 => 290679)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2022-03-01 23:16:43 UTC (rev 290679)
@@ -418,12 +418,14 @@
 
     IntSize compatibleImageBufferSize(const FloatSize&) const;
 
-    WEBCORE_EXPORT RefPtr<ImageBuffer> createImageBuffer(const FloatSize&, const FloatSize& scale = { 1, 1 }, const DestinationColorSpace& = DestinationColorSpace::SRGB(), std::optional<RenderingMode> = std::nullopt, RenderingMethod = RenderingMethod::Default) const;
-    WEBCORE_EXPORT RefPtr<ImageBuffer> createImageBuffer(const FloatRect&, const FloatSize& scale = { 1, 1 }, const DestinationColorSpace& = DestinationColorSpace::SRGB(), std::optional<RenderingMode> = std::nullopt, RenderingMethod = RenderingMethod::Default) const;
+    WEBCORE_EXPORT virtual RefPtr<ImageBuffer> createImageBuffer(const FloatSize&, float resolutionScale = 1, const DestinationColorSpace& = DestinationColorSpace::SRGB(), std::optional<RenderingMode> = std::nullopt, std::optional<RenderingMethod> = std::nullopt) const;
 
-    WEBCORE_EXPORT virtual RefPtr<ImageBuffer> createCompatibleImageBuffer(const FloatSize&, const DestinationColorSpace& = DestinationColorSpace::SRGB(), RenderingMethod = RenderingMethod::Default) const;
-    WEBCORE_EXPORT virtual RefPtr<ImageBuffer> createCompatibleImageBuffer(const FloatRect&, const DestinationColorSpace& = DestinationColorSpace::SRGB(), RenderingMethod = RenderingMethod::Default) const;
+    WEBCORE_EXPORT RefPtr<ImageBuffer> createScaledImageBuffer(const FloatSize&, const FloatSize& scale = { 1, 1 }, const DestinationColorSpace& = DestinationColorSpace::SRGB(), std::optional<RenderingMode> = std::nullopt, std::optional<RenderingMethod> = std::nullopt) const;
+    WEBCORE_EXPORT RefPtr<ImageBuffer> createScaledImageBuffer(const FloatRect&, const FloatSize& scale = { 1, 1 }, const DestinationColorSpace& = DestinationColorSpace::SRGB(), std::optional<RenderingMode> = std::nullopt, std::optional<RenderingMethod> = std::nullopt) const;
 
+    WEBCORE_EXPORT virtual RefPtr<ImageBuffer> createAlignedImageBuffer(const FloatSize&, const DestinationColorSpace& = DestinationColorSpace::SRGB(), std::optional<RenderingMethod> = std::nullopt) const;
+    WEBCORE_EXPORT virtual RefPtr<ImageBuffer> createAlignedImageBuffer(const FloatRect&, const DestinationColorSpace& = DestinationColorSpace::SRGB(), std::optional<RenderingMethod> = std::nullopt) const;
+
     virtual void drawNativeImage(NativeImage&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }) = 0;
 
     WEBCORE_EXPORT ImageDrawResult drawImage(Image&, const FloatPoint& destination, const ImagePaintingOptions& = { ImageOrientation::FromImage });
@@ -549,8 +551,6 @@
     void fillEllipseAsPath(const FloatRect&);
     void strokeEllipseAsPath(const FloatRect&);
 
-    WEBCORE_EXPORT virtual RefPtr<ImageBuffer> createImageBuffer(const FloatSize&, const DestinationColorSpace&, RenderingMode, RenderingMethod) const;
-
     FloatRect computeLineBoundsAndAntialiasingModeForText(const FloatRect&, bool printing, Color&);
 
     float dashedLineCornerWidthForStrokeWidth(float) const;

Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp (290678 => 290679)


--- trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -74,7 +74,7 @@
 
 RefPtr<ImageBuffer> ImageBuffer::clone() const
 {
-    auto clone = context().createCompatibleImageBuffer(logicalSize(), colorSpace());
+    auto clone = context().createAlignedImageBuffer(logicalSize(), colorSpace());
     if (!clone)
         return nullptr;
 

Modified: trunk/Source/WebCore/platform/graphics/NamedImageGeneratedImage.cpp (290678 => 290679)


--- trunk/Source/WebCore/platform/graphics/NamedImageGeneratedImage.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/platform/graphics/NamedImageGeneratedImage.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -65,7 +65,7 @@
 void NamedImageGeneratedImage::drawPattern(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
 {
 #if USE(NEW_THEME)
-    auto imageBuffer = context.createCompatibleImageBuffer(size());
+    auto imageBuffer = context.createAlignedImageBuffer(size());
     if (!imageBuffer)
         return;
 

Modified: trunk/Source/WebCore/platform/graphics/RenderingMode.h (290678 => 290679)


--- trunk/Source/WebCore/platform/graphics/RenderingMode.h	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/platform/graphics/RenderingMode.h	2022-03-01 23:16:43 UTC (rev 290679)
@@ -36,11 +36,6 @@
 
 enum class ShouldUseDisplayList : bool { No, Yes };
 enum class RenderingMode : bool { Unaccelerated, Accelerated };
+enum class RenderingMethod : bool { Local, DisplayList };
 
-enum class RenderingMethod : uint8_t {
-    Default,
-    Local,
-    DisplayList
-};
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp (290678 => 290679)


--- trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -240,7 +240,7 @@
     }
 
     // Create a local ImageBuffer because decoding the PDF images has to happen in WebProcess.
-    m_cachedImageBuffer = context.createCompatibleImageBuffer(cachedImageSize, DestinationColorSpace::SRGB(), RenderingMethod::Local);
+    m_cachedImageBuffer = context.createAlignedImageBuffer(cachedImageSize, DestinationColorSpace::SRGB(), RenderingMethod::Local);
     if (!m_cachedImageBuffer) {
         destroyDecodedData();
         return;
@@ -293,7 +293,7 @@
             // scalar = sqrt(max number of pixels / (width * height))
             auto scalar = std::min(1.f, std::sqrt(static_cast<float>(s_maxCachedImageArea) / (dstRect.width() * dstRect.height())));
             FloatRect localDestinationRect(FloatPoint(), dstRect.size() * scalar);
-            if (auto imageBuffer = context.createCompatibleImageBuffer(localDestinationRect.size(), DestinationColorSpace::SRGB(), RenderingMethod::Local)) {
+            if (auto imageBuffer = context.createAlignedImageBuffer(localDestinationRect.size(), DestinationColorSpace::SRGB(), RenderingMethod::Local)) {
                 auto& bufferContext = imageBuffer->context();
                 transformContextForPainting(bufferContext, localDestinationRect, srcRect);
                 drawPDFPage(bufferContext);

Modified: trunk/Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp (290678 => 290679)


--- trunk/Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/platform/graphics/coretext/DrawGlyphsRecorderCoreText.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -379,7 +379,7 @@
         auto bounds = font.boundsForGlyph(glyphs[i]);
 
         // Create a local ImageBuffer because decoding the SVG fonts has to happen in WebProcess.
-        if (auto imageBuffer = m_owner.createCompatibleImageBuffer(bounds, DestinationColorSpace::SRGB(), RenderingMethod::Local)) {
+        if (auto imageBuffer = m_owner.createAlignedImageBuffer(bounds, DestinationColorSpace::SRGB(), RenderingMethod::Local)) {
             FontCascade::drawGlyphs(imageBuffer->context(), font, glyphs + i, advances + i, 1, FloatPoint(), smoothingMode);
 
             FloatRect destinationRect = enclosingIntRect(bounds);

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp (290678 => 290679)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -492,12 +492,9 @@
     recordClipToImageBuffer(imageBuffer, destRect);
 }
 
-RefPtr<ImageBuffer> Recorder::createImageBuffer(const FloatSize& size, const DestinationColorSpace& colorSpace, RenderingMode renderingMode, RenderingMethod renderingMethod) const
+RefPtr<ImageBuffer> Recorder::createImageBuffer(const FloatSize& size, float resolutionScale, const DestinationColorSpace& colorSpace, std::optional<RenderingMode> renderingMode, std::optional<RenderingMethod> renderingMethod) const
 {
-    if (renderingMethod == RenderingMethod::Default)
-        renderingMethod = RenderingMethod::DisplayList;
-
-    return GraphicsContext::createImageBuffer(size, colorSpace, renderingMode, renderingMethod);
+    return GraphicsContext::createImageBuffer(size, resolutionScale, colorSpace, renderingMode, renderingMethod.value_or(RenderingMethod::DisplayList));
 }
 
 #if ENABLE(VIDEO)

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h (290678 => 290679)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2022-03-01 23:16:43 UTC (rev 290679)
@@ -172,7 +172,7 @@
     const ContextState& currentState() const;
     ContextState& currentState();
 
-    WEBCORE_EXPORT RefPtr<ImageBuffer> createImageBuffer(const FloatSize&, const DestinationColorSpace&, RenderingMode, RenderingMethod) const override;
+    WEBCORE_EXPORT RefPtr<ImageBuffer> createImageBuffer(const FloatSize&, float resolutionScale, const DestinationColorSpace&, std::optional<RenderingMode>, std::optional<RenderingMethod>) const override;
 
 private:
     bool hasPlatformContext() const final { return false; }

Modified: trunk/Source/WebCore/platform/mac/ThemeMac.mm (290678 => 290679)


--- trunk/Source/WebCore/platform/mac/ThemeMac.mm	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.mm	2022-03-01 23:16:43 UTC (rev 290679)
@@ -734,7 +734,7 @@
 
     if (useImageBuffer) {
         NSRect imageBufferDrawRect = NSRect(FloatRect(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth, rect.width(), rect.height()));
-        auto imageBuffer = context.createImageBuffer(rect.size() + 2 * FloatSize(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth), { deviceScaleFactor, deviceScaleFactor });
+        auto imageBuffer = context.createImageBuffer(rect.size() + 2 * FloatSize(buttonFocusRectOutlineWidth, buttonFocusRectOutlineWidth), deviceScaleFactor);
         if (!imageBuffer)
             return needsRepaint;
         {

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (290678 => 290679)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -894,7 +894,7 @@
         maskRect.intersect(snapRectToDevicePixels(paintInfo.rect, deviceScaleFactor));
 
         // Now create the mask.
-        maskImage = context.createCompatibleImageBuffer(maskRect.size());
+        maskImage = context.createAlignedImageBuffer(maskRect.size());
         if (!maskImage)
             return;
         paintMaskForTextFillBox(maskImage.get(), maskRect, box, scrolledPaintRect);

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (290678 => 290679)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -3324,7 +3324,7 @@
 {
     const FloatSize tileSize { 32, 18 };
 
-    auto imageBuffer = destContext.createCompatibleImageBuffer(tileSize);
+    auto imageBuffer = destContext.createAlignedImageBuffer(tileSize);
     if (!imageBuffer)
         return nullptr;
 

Modified: trunk/Source/WebCore/rendering/RenderLayerFilters.cpp (290678 => 290679)


--- trunk/Source/WebCore/rendering/RenderLayerFilters.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/rendering/RenderLayerFilters.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -135,7 +135,7 @@
     auto logicalSize = filter.scaledByFilterScale(m_filterRegion.size());
 
     if (!m_sourceImage || m_sourceImage->logicalSize() != logicalSize)
-        m_sourceImage = context.createImageBuffer(m_filterRegion.size(), filter.filterScale(), DestinationColorSpace::SRGB(), filter.renderingMode());
+        m_sourceImage = context.createScaledImageBuffer(m_filterRegion.size(), filter.filterScale(), DestinationColorSpace::SRGB(), filter.renderingMode());
 }
 
 GraphicsContext* RenderLayerFilters::beginFilterEffect(RenderElement& renderer, GraphicsContext& context, const LayoutRect& filterBoxRect, const LayoutRect& dirtyRect, const LayoutRect& layerRepaintRect)

Modified: trunk/Source/WebCore/rendering/RenderThemeCocoa.mm (290678 => 290679)


--- trunk/Source/WebCore/rendering/RenderThemeCocoa.mm	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/rendering/RenderThemeCocoa.mm	2022-03-01 23:16:43 UTC (rev 290679)
@@ -154,7 +154,7 @@
 {
     auto& destinationContext = paintInfo.context();
 
-    auto imageBuffer = destinationContext.createCompatibleImageBuffer(paintRect.size());
+    auto imageBuffer = destinationContext.createAlignedImageBuffer(paintRect.size());
     if (!imageBuffer)
         return false;
 

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (290678 => 290679)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2022-03-01 23:16:43 UTC (rev 290679)
@@ -994,7 +994,7 @@
 
     float deviceScaleFactor = o.document().deviceScaleFactor();
 
-    auto comboBoxImageBuffer = context.createImageBuffer(comboBoxSize, { deviceScaleFactor, deviceScaleFactor });
+    auto comboBoxImageBuffer = context.createImageBuffer(comboBoxSize, deviceScaleFactor);
     if (!comboBoxImageBuffer)
         return;
 
@@ -1018,7 +1018,7 @@
         (__bridge NSString *)kCUIUserInterfaceLayoutDirectionKey : (__bridge NSString *)kCUIUserInterfaceLayoutDirectionLeftToRight,
     }];
 
-    auto comboBoxButtonImageBuffer = context.createImageBuffer(desiredComboBoxButtonSize, { deviceScaleFactor, deviceScaleFactor });
+    auto comboBoxButtonImageBuffer = context.createImageBuffer(desiredComboBoxButtonSize, deviceScaleFactor);
     if (!comboBoxButtonImageBuffer)
         return;
 
@@ -1402,7 +1402,7 @@
     const auto& renderProgress = downcast<RenderProgress>(renderObject);
     float deviceScaleFactor = renderObject.document().deviceScaleFactor();
     bool isIndeterminate = renderProgress.position() < 0;
-    auto imageBuffer = paintInfo.context().createImageBuffer(inflatedRect.size(), { deviceScaleFactor, deviceScaleFactor });
+    auto imageBuffer = paintInfo.context().createImageBuffer(inflatedRect.size(), deviceScaleFactor);
     if (!imageBuffer)
         return true;
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp (290678 => 290679)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -162,7 +162,7 @@
 
     if (!clipperData.isValidForGeometry(objectBoundingBox, clippedContentBounds, absoluteTransform)) {
         // FIXME (149469): This image buffer should not be unconditionally unaccelerated. Making it match the context breaks nested clipping, though.
-        auto maskImage = context.createImageBuffer(clippedContentBounds, scale, DestinationColorSpace::SRGB(), RenderingMode::Unaccelerated);
+        auto maskImage = context.createScaledImageBuffer(clippedContentBounds, scale, DestinationColorSpace::SRGB(), RenderingMode::Unaccelerated);
         if (!maskImage)
             return false;
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp (290678 => 290679)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -153,7 +153,7 @@
     auto colorSpace = DestinationColorSpace::SRGB();
 #endif
 
-    auto sourceGraphic = context->createImageBuffer(filterData->drawingRegion, filterScale, colorSpace, filterData->filter->renderingMode());
+    auto sourceGraphic = context->createScaledImageBuffer(filterData->drawingRegion, filterScale, colorSpace, filterData->filter->renderingMode());
     if (!sourceGraphic) {
         ASSERT(m_rendererFilterDataMap.contains(&renderer));
         filterData->savedContext = context;

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp (290678 => 290679)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -67,7 +67,7 @@
     // Determine scale factor for the clipper. The size of intermediate ImageBuffers shouldn't be bigger than kMaxFilterSize.
     ImageBuffer::sizeNeedsClamping(repaintRect.size(), scale);
 
-    auto maskImage = context->createImageBuffer(repaintRect, scale);
+    auto maskImage = context->createScaledImageBuffer(repaintRect, scale);
     if (!maskImage)
         return false;
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp (290678 => 290679)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -90,7 +90,7 @@
         }
 #endif
         // FIXME (149470): This image buffer should not be unconditionally unaccelerated. Making it match the context breaks alpha masking, though.
-        maskerData->maskImage = context->createImageBuffer(repaintRect, scale, maskColorSpace, RenderingMode::Unaccelerated);
+        maskerData->maskImage = context->createScaledImageBuffer(repaintRect, scale, maskColorSpace, RenderingMode::Unaccelerated);
         if (!maskerData->maskImage)
             return false;
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp (290678 => 290679)


--- trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -243,7 +243,7 @@
     auto tileSize = roundedUnscaledImageBufferSize(size, scale);
 
     // FIXME: Use createImageBuffer(rect, scale), delete the above calculations and fix 'tileImageTransform'
-    auto tileImage = context.createImageBuffer(tileSize, scale);
+    auto tileImage = context.createScaledImageBuffer(tileSize, scale);
     if (!tileImage)
         return nullptr;
 

Modified: trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp (290678 => 290679)


--- trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -282,7 +282,7 @@
 
     // Create a new buffer and paint the foreground into it.
     if (!imageBuffer) {
-        imageBuffer = m_paintInfo->context().createCompatibleImageBuffer(expandedIntSize(boundingBox.size()));
+        imageBuffer = m_paintInfo->context().createAlignedImageBuffer(expandedIntSize(boundingBox.size()));
         if (!imageBuffer)
             return false;
     }

Modified: trunk/Source/WebKit/ChangeLog (290678 => 290679)


--- trunk/Source/WebKit/ChangeLog	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebKit/ChangeLog	2022-03-01 23:16:43 UTC (rev 290679)
@@ -1,3 +1,17 @@
+2022-03-01  Said Abou-Hallawa  <[email protected]>
+
+        [macOS][REGRESSION] (rr289518): Form controls are scaled twice on Retina display
+        https://bugs.webkit.org/show_bug.cgi?id=237128
+        rdar://89064642
+
+        Reviewed by Darin Adler.
+
+        * WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
+        (WebKit::RemoteDisplayListRecorderProxy::createImageBuffer const):
+        (WebKit::RemoteDisplayListRecorderProxy::createAlignedImageBuffer const):
+        (WebKit::RemoteDisplayListRecorderProxy::createCompatibleImageBuffer const): Deleted.
+        * WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:
+
 2022-03-01  Eric Carlson  <[email protected]>
 
         [Cocoa] HLS stream currentTime sometimes jumps backwards

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp (290678 => 290679)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp	2022-03-01 23:16:43 UTC (rev 290679)
@@ -434,7 +434,7 @@
     send(Messages::RemoteDisplayListRecorder::FlushContext(identifier));
 }
 
-RefPtr<ImageBuffer> RemoteDisplayListRecorderProxy::createImageBuffer(const FloatSize& size, const DestinationColorSpace& colorSpace, RenderingMode renderingMode, RenderingMethod renderingMethod) const
+RefPtr<ImageBuffer> RemoteDisplayListRecorderProxy::createImageBuffer(const FloatSize& size, float resolutionScale, const DestinationColorSpace& colorSpace, std::optional<RenderingMode> renderingMode, std::optional<RenderingMethod> renderingMethod) const
 {
     if (UNLIKELY(!m_renderingBackend)) {
         ASSERT_NOT_REACHED();
@@ -441,22 +441,22 @@
         return nullptr;
     }
 
-    if (renderingMethod != RenderingMethod::Default)
-        return Recorder::createImageBuffer(size, colorSpace, renderingMode, renderingMethod);
+    if (renderingMethod)
+        return Recorder::createImageBuffer(size, resolutionScale, colorSpace, renderingMode, renderingMethod);
 
-    return m_renderingBackend->createImageBuffer(size, renderingMode, 1, colorSpace, PixelFormat::BGRA8);
+    return m_renderingBackend->createImageBuffer(size, renderingMode.value_or(this->renderingMode()), resolutionScale, colorSpace, PixelFormat::BGRA8);
 }
 
-RefPtr<ImageBuffer> RemoteDisplayListRecorderProxy::createCompatibleImageBuffer(const FloatSize& size, const DestinationColorSpace& colorSpace, RenderingMethod renderingMethod) const
+RefPtr<ImageBuffer> RemoteDisplayListRecorderProxy::createAlignedImageBuffer(const FloatSize& size, const DestinationColorSpace& colorSpace, std::optional<RenderingMethod> renderingMethod) const
 {
-    auto renderingMode = renderingMethod == RenderingMethod::Default ? this->renderingMode() : RenderingMode::Unaccelerated;
-    return GraphicsContext::createImageBuffer(size, scaleFactor(), colorSpace, renderingMode, renderingMethod);
+    auto renderingMode = !renderingMethod ? this->renderingMode() : RenderingMode::Unaccelerated;
+    return GraphicsContext::createScaledImageBuffer(size, scaleFactor(), colorSpace, renderingMode, renderingMethod);
 }
 
-RefPtr<ImageBuffer> RemoteDisplayListRecorderProxy::createCompatibleImageBuffer(const FloatRect& rect, const DestinationColorSpace& colorSpace, RenderingMethod renderingMethod) const
+RefPtr<ImageBuffer> RemoteDisplayListRecorderProxy::createAlignedImageBuffer(const FloatRect& rect, const DestinationColorSpace& colorSpace, std::optional<RenderingMethod> renderingMethod) const
 {
-    auto renderingMode = renderingMethod == RenderingMethod::Default ? this->renderingMode() : RenderingMode::Unaccelerated;
-    return GraphicsContext::createImageBuffer(rect, scaleFactor(), colorSpace, renderingMode, renderingMethod);
+    auto renderingMode = !renderingMethod ? this->renderingMode() : RenderingMode::Unaccelerated;
+    return GraphicsContext::createScaledImageBuffer(rect, scaleFactor(), colorSpace, renderingMode, renderingMethod);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h (290678 => 290679)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h	2022-03-01 23:07:20 UTC (rev 290678)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h	2022-03-01 23:16:43 UTC (rev 290679)
@@ -136,9 +136,9 @@
     bool recordResourceUse(const WebCore::SourceImage&) final;
     bool recordResourceUse(WebCore::Font&) final;
 
-    RefPtr<WebCore::ImageBuffer> createImageBuffer(const WebCore::FloatSize&, const WebCore::DestinationColorSpace&, WebCore::RenderingMode, WebCore::RenderingMethod) const final;
-    RefPtr<WebCore::ImageBuffer> createCompatibleImageBuffer(const WebCore::FloatSize&, const WebCore::DestinationColorSpace& = WebCore::DestinationColorSpace::SRGB(), WebCore::RenderingMethod = WebCore::RenderingMethod::Default) const final;
-    RefPtr<WebCore::ImageBuffer> createCompatibleImageBuffer(const WebCore::FloatRect&, const WebCore::DestinationColorSpace& = WebCore::DestinationColorSpace::SRGB(), WebCore::RenderingMethod = WebCore::RenderingMethod::Default) const final;
+    RefPtr<WebCore::ImageBuffer> createImageBuffer(const WebCore::FloatSize&, float resolutionScale, const WebCore::DestinationColorSpace&, std::optional<WebCore::RenderingMode>, std::optional<WebCore::RenderingMethod>) const final;
+    RefPtr<WebCore::ImageBuffer> createAlignedImageBuffer(const WebCore::FloatSize&, const WebCore::DestinationColorSpace&, std::optional<WebCore::RenderingMethod>) const final;
+    RefPtr<WebCore::ImageBuffer> createAlignedImageBuffer(const WebCore::FloatRect&, const WebCore::DestinationColorSpace&, std::optional<WebCore::RenderingMethod>) const final;
 
     WebCore::RenderingResourceIdentifier m_destinationBufferIdentifier;
     WeakPtr<WebCore::ImageBuffer> m_imageBuffer;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to