Diff
Modified: trunk/Source/WebCore/ChangeLog (283746 => 283747)
--- trunk/Source/WebCore/ChangeLog 2021-10-07 22:12:34 UTC (rev 283746)
+++ trunk/Source/WebCore/ChangeLog 2021-10-07 22:18:49 UTC (rev 283747)
@@ -1,3 +1,31 @@
+2021-10-07 Tim Horton <timothy_hor...@apple.com>
+
+ BifurcatedGraphicsContext doesn't bifurcate draw{Tiled}Image
+ https://bugs.webkit.org/show_bug.cgi?id=231385
+ <rdar://problem/83922633>
+
+ Reviewed by Devin Rousso.
+
+ New API Test: BifurcatedGraphicsContextTests.DrawGradientImage, DrawTiledGradientImage
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/GradientImage.h:
+ Export GradientImage's constructor and GradientImage and GeneratedImage headers.
+
+ * platform/graphics/BifurcatedGraphicsContext.cpp:
+ (WebCore::BifurcatedGraphicsContext::drawTiledImage):
+ (WebCore::BifurcatedGraphicsContext::drawImage):
+ (WebCore::BifurcatedGraphicsContext::drawImageForCanvas):
+ * platform/graphics/BifurcatedGraphicsContext.h:
+ Forward draw{Tiled}Image to both GraphicsContext instances.
+
+ I had initially avoided it because I assumed drawNativeImage would
+ be the eventual result, but because of the non-BitmapImage subclasses
+ that is actually not the case! For example, in the gradient case,
+ drawing the image results in GradientCG directly interacting with the
+ platform context, not round-tripping back through GraphicsContext,
+ so the commands are not replicated.
+
2021-10-07 Aditya Keerthi <akeer...@apple.com>
[css-ui] Parsing support for accent-color
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (283746 => 283747)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-10-07 22:12:34 UTC (rev 283746)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-10-07 22:18:49 UTC (rev 283747)
@@ -799,7 +799,7 @@
2D4150DE1C1F868C000A3BA2 /* JSMockPageOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D6F3E921C1F85550061DBD4 /* JSMockPageOverlay.cpp */; };
2D4150DE1C1F868C000A3BA3 /* JSInternalsSetLike.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D6F3E921C1F85550061DBD5 /* JSInternalsSetLike.cpp */; };
2D481F02146B5C5500AA7834 /* CrossfadeGeneratedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D2FC0551460CD6F00263633 /* CrossfadeGeneratedImage.h */; };
- 2D481F04146B5C6B00AA7834 /* GradientImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D2FC0571460CD6F00263633 /* GradientImage.h */; };
+ 2D481F04146B5C6B00AA7834 /* GradientImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D2FC0571460CD6F00263633 /* GradientImage.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D4F96F61A1ECC240098BF88 /* TextIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D4F96F21A1ECC240098BF88 /* TextIndicator.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D4F96F71A1ECC240098BF88 /* TextIndicatorWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D4F96F31A1ECC240098BF88 /* TextIndicatorWindow.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D5002FC1B56D7990020AAF7 /* PathUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D5002FA1B56D7990020AAF7 /* PathUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -4058,7 +4058,7 @@
BC2274790E8366E200E7F975 /* SVGRenderStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2274750E8366E200E7F975 /* SVGRenderStyle.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC22747B0E8366E200E7F975 /* SVGRenderStyleDefs.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2274770E8366E200E7F975 /* SVGRenderStyleDefs.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC23EE920DAED2BC009FDC91 /* CSSImageGeneratorValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC23EE910DAED2BC009FDC91 /* CSSImageGeneratorValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
- BC23F0DB0DAFF4A4009FDC91 /* GeneratedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BC23F0DA0DAFF4A4009FDC91 /* GeneratedImage.h */; };
+ BC23F0DB0DAFF4A4009FDC91 /* GeneratedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BC23F0DA0DAFF4A4009FDC91 /* GeneratedImage.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC274B2F140EBEB200EADFA6 /* CSSBorderImageSliceValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC274B2E140EBEB200EADFA6 /* CSSBorderImageSliceValue.h */; };
BC2CBF4E140F1ABD003879BE /* JSWebGLContextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2CBF4B140F1A65003879BE /* JSWebGLContextEvent.h */; };
BC2CCA102655DDB200B8C035 /* DestinationColorSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2CCA0E2655DDB200B8C035 /* DestinationColorSpace.h */; settings = {ATTRIBUTES = (Private, ); }; };
Modified: trunk/Source/WebCore/platform/graphics/BifurcatedGraphicsContext.cpp (283746 => 283747)
--- trunk/Source/WebCore/platform/graphics/BifurcatedGraphicsContext.cpp 2021-10-07 22:12:34 UTC (rev 283746)
+++ trunk/Source/WebCore/platform/graphics/BifurcatedGraphicsContext.cpp 2021-10-07 22:18:49 UTC (rev 283747)
@@ -269,6 +269,34 @@
m_secondaryContext.drawPattern(nativeImage, imageSize, destRect, tileRect, patternTransform, phase, spacing, options);
}
+ImageDrawResult BifurcatedGraphicsContext::drawImage(Image& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& options)
+{
+ auto result = m_primaryContext.drawImage(image, destination, source, options);
+ m_secondaryContext.drawImage(image, destination, source, options);
+ return result;
+}
+
+ImageDrawResult BifurcatedGraphicsContext::drawImageForCanvas(Image& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& options, DestinationColorSpace canvasColorSpace)
+{
+ auto result = m_primaryContext.drawImageForCanvas(image, destination, source, options, canvasColorSpace);
+ m_secondaryContext.drawImageForCanvas(image, destination, source, options, canvasColorSpace);
+ return result;
+}
+
+ImageDrawResult BifurcatedGraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& options)
+{
+ auto result = m_primaryContext.drawTiledImage(image, destination, source, tileSize, spacing, options);
+ m_secondaryContext.drawTiledImage(image, destination, source, tileSize, spacing, options);
+ return result;
+}
+
+ImageDrawResult BifurcatedGraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions& options)
+{
+ auto result = m_primaryContext.drawTiledImage(image, destination, source, tileScaleFactor, hRule, vRule, options);
+ m_secondaryContext.drawTiledImage(image, destination, source, tileScaleFactor, hRule, vRule, options);
+ return result;
+}
+
void BifurcatedGraphicsContext::paintFrameForMedia(MediaPlayer& player, const FloatRect& destination)
{
m_primaryContext.paintFrameForMedia(player, destination);
Modified: trunk/Source/WebCore/platform/graphics/BifurcatedGraphicsContext.h (283746 => 283747)
--- trunk/Source/WebCore/platform/graphics/BifurcatedGraphicsContext.h 2021-10-07 22:12:34 UTC (rev 283746)
+++ trunk/Source/WebCore/platform/graphics/BifurcatedGraphicsContext.h 2021-10-07 22:18:49 UTC (rev 283747)
@@ -99,6 +99,10 @@
void drawNativeImage(NativeImage&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }) final;
void drawPattern(NativeImage&, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) final;
+ ImageDrawResult drawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = { ImageOrientation::FromImage }) final;
+ ImageDrawResult drawImageForCanvas(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&, DestinationColorSpace canvasColorSpace) final;
+ ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& = { }) final;
+ ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule, Image::TileRule, const ImagePaintingOptions& = { }) final;
#if ENABLE(VIDEO)
void paintFrameForMedia(MediaPlayer&, const FloatRect& destination) final;
Modified: trunk/Source/WebCore/platform/graphics/GradientImage.h (283746 => 283747)
--- trunk/Source/WebCore/platform/graphics/GradientImage.h 2021-10-07 22:12:34 UTC (rev 283746)
+++ trunk/Source/WebCore/platform/graphics/GradientImage.h 2021-10-07 22:18:49 UTC (rev 283747)
@@ -44,7 +44,7 @@
const Gradient& gradient() const { return m_gradient.get(); }
private:
- GradientImage(Gradient&, const FloatSize&);
+ WEBCORE_EXPORT GradientImage(Gradient&, const FloatSize&);
ImageDrawResult draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const ImagePaintingOptions& = { }) final;
void drawPattern(GraphicsContext&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) final;
Modified: trunk/Tools/ChangeLog (283746 => 283747)
--- trunk/Tools/ChangeLog 2021-10-07 22:12:34 UTC (rev 283746)
+++ trunk/Tools/ChangeLog 2021-10-07 22:18:49 UTC (rev 283747)
@@ -1,3 +1,15 @@
+2021-10-07 Tim Horton <timothy_hor...@apple.com>
+
+ BifurcatedGraphicsContext doesn't bifurcate draw{Tiled}Image
+ https://bugs.webkit.org/show_bug.cgi?id=231385
+ <rdar://problem/83922633>
+
+ Reviewed by Devin Rousso.
+
+ * TestWebKitAPI/Tests/WebCore/cg/BifurcatedGraphicsContextTestsCG.cpp:
+ (TestWebKitAPI::TEST):
+ Add some test.
+
2021-10-07 Jonathan Bedard <jbed...@apple.com>
[build.webkit.org] Build iOS 15 as universal binary
Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/cg/BifurcatedGraphicsContextTestsCG.cpp (283746 => 283747)
--- trunk/Tools/TestWebKitAPI/Tests/WebCore/cg/BifurcatedGraphicsContextTestsCG.cpp 2021-10-07 22:12:34 UTC (rev 283746)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/cg/BifurcatedGraphicsContextTestsCG.cpp 2021-10-07 22:18:49 UTC (rev 283747)
@@ -34,6 +34,7 @@
#include <WebCore/DisplayListIterator.h>
#include <WebCore/DisplayListRecorder.h>
#include <WebCore/FontCascade.h>
+#include <WebCore/GradientImage.h>
#include <WebCore/GraphicsContextCG.h>
#include <WebCore/InMemoryDisplayList.h>
@@ -129,6 +130,70 @@
runTest(secondaryDisplayList);
}
+TEST(BifurcatedGraphicsContextTests, DrawTiledGradientImage)
+{
+ auto colorSpace = DestinationColorSpace::SRGB();
+ auto primaryCGContext = adoptCF(CGBitmapContextCreate(nullptr, contextWidth, contextHeight, 8, 4 * contextWidth, colorSpace.platformColorSpace(), kCGImageAlphaPremultipliedLast));
+ auto secondaryCGContext = adoptCF(CGBitmapContextCreate(nullptr, contextWidth, contextHeight, 8, 4 * contextWidth, colorSpace.platformColorSpace(), kCGImageAlphaPremultipliedLast));
+
+ GraphicsContextCG primaryContext(primaryCGContext.get());
+ GraphicsContextCG secondaryContext(secondaryCGContext.get());
+ BifurcatedGraphicsContext ctx(primaryContext, secondaryContext);
+
+ auto gradient = Gradient::create(Gradient::LinearData { { 0, 0 }, { 1, 1 } });
+ gradient->addColorStop({ 0, Color::red });
+
+ auto gradientImage = GradientImage::create(gradient, FloatSize { 1, 1 });
+
+ ctx.drawTiledImage(gradientImage.get(), FloatRect { 0, 0, 100, 100 }, FloatRect { 0, 0, 1, 1 }, FloatSize { 1, 1 }, Image::RepeatTile, Image::RepeatTile);
+
+ // The primary context should be red.
+ CGContextFlush(primaryCGContext.get());
+ uint8_t* primaryData = static_cast<uint8_t*>(CGBitmapContextGetData(primaryCGContext.get()));
+ EXPECT_EQ(primaryData[0], 255);
+ EXPECT_EQ(primaryData[1], 0);
+ EXPECT_EQ(primaryData[2], 0);
+
+ // The secondary context should be red.
+ CGContextFlush(secondaryCGContext.get());
+ uint8_t* secondaryData = static_cast<uint8_t*>(CGBitmapContextGetData(secondaryCGContext.get()));
+ EXPECT_EQ(secondaryData[0], 255);
+ EXPECT_EQ(secondaryData[1], 0);
+ EXPECT_EQ(secondaryData[2], 0);
+}
+
+TEST(BifurcatedGraphicsContextTests, DrawGradientImage)
+{
+ auto colorSpace = DestinationColorSpace::SRGB();
+ auto primaryCGContext = adoptCF(CGBitmapContextCreate(nullptr, contextWidth, contextHeight, 8, 4 * contextWidth, colorSpace.platformColorSpace(), kCGImageAlphaPremultipliedLast));
+ auto secondaryCGContext = adoptCF(CGBitmapContextCreate(nullptr, contextWidth, contextHeight, 8, 4 * contextWidth, colorSpace.platformColorSpace(), kCGImageAlphaPremultipliedLast));
+
+ GraphicsContextCG primaryContext(primaryCGContext.get());
+ GraphicsContextCG secondaryContext(secondaryCGContext.get());
+ BifurcatedGraphicsContext ctx(primaryContext, secondaryContext);
+
+ auto gradient = Gradient::create(Gradient::LinearData { { 0, 0 }, { 1, 1 } });
+ gradient->addColorStop({ 0, Color::red });
+
+ auto gradientImage = GradientImage::create(gradient, FloatSize { 1, 1 });
+
+ ctx.drawImage(gradientImage.get(), FloatRect { 0, 0, 100, 100 }, FloatRect { 0, 0, 1, 1 });
+
+ // The primary context should be red.
+ CGContextFlush(primaryCGContext.get());
+ uint8_t* primaryData = static_cast<uint8_t*>(CGBitmapContextGetData(primaryCGContext.get()));
+ EXPECT_EQ(primaryData[0], 255);
+ EXPECT_EQ(primaryData[1], 0);
+ EXPECT_EQ(primaryData[2], 0);
+
+ // The secondary context should be red.
+ CGContextFlush(secondaryCGContext.get());
+ uint8_t* secondaryData = static_cast<uint8_t*>(CGBitmapContextGetData(secondaryCGContext.get()));
+ EXPECT_EQ(secondaryData[0], 255);
+ EXPECT_EQ(secondaryData[1], 0);
+ EXPECT_EQ(secondaryData[2], 0);
+}
+
} // namespace TestWebKitAPI
#endif // USE(CG)