Diff
Modified: trunk/Source/WebCore/Sources.txt (295666 => 295667)
--- trunk/Source/WebCore/Sources.txt 2022-06-20 04:25:46 UTC (rev 295666)
+++ trunk/Source/WebCore/Sources.txt 2022-06-20 04:27:35 UTC (rev 295667)
@@ -2023,6 +2023,7 @@
platform/graphics/ColorBlending.cpp
platform/graphics/ColorConversion.cpp
platform/graphics/ColorInterpolation.cpp
+platform/graphics/ColorInterpolationMethod.cpp
platform/graphics/ColorLuminance.cpp
platform/graphics/ColorSerialization.cpp
platform/graphics/ColorSpace.cpp
@@ -2060,6 +2061,8 @@
platform/graphics/GeneratedImage.cpp
platform/graphics/GeometryUtilities.cpp
platform/graphics/Gradient.cpp
+platform/graphics/GradientColorStop.cpp
+platform/graphics/GradientColorStops.cpp
platform/graphics/GradientImage.cpp
platform/graphics/GraphicsContext.cpp
platform/graphics/GraphicsContextGL.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (295666 => 295667)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2022-06-20 04:25:46 UTC (rev 295666)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2022-06-20 04:27:35 UTC (rev 295667)
@@ -8509,6 +8509,9 @@
32A70D552836138D0080060C /* PositionedGlyphs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PositionedGlyphs.cpp; sourceTree = "<group>"; };
32A70D562836138D0080060C /* PositionedGlyphs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PositionedGlyphs.h; sourceTree = "<group>"; };
32B0B0CF283C7483006217C6 /* GlyphDisplayListCache.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GlyphDisplayListCache.cpp; sourceTree = "<group>"; };
+ 32B17614285FDDA100ED6DB8 /* GradientColorStop.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GradientColorStop.cpp; sourceTree = "<group>"; };
+ 32B17615285FDDA100ED6DB8 /* GradientColorStops.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GradientColorStops.cpp; sourceTree = "<group>"; };
+ 32E268FC285FC8F7004660BB /* ColorInterpolationMethod.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ColorInterpolationMethod.cpp; sourceTree = "<group>"; };
331FF67DE197B57393C46A7F /* RenderMathMLPadded.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLPadded.h; sourceTree = "<group>"; };
331FF67DE197B57393C46AA7 /* RenderMathMLSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLSpace.h; sourceTree = "<group>"; };
333F704E0FB49CA2008E12A6 /* Notification.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Notification.idl; sourceTree = "<group>"; };
@@ -29199,6 +29202,7 @@
3103B7DE1DB01556008BB890 /* ColorHash.h */,
BCDC642427517B040038FB39 /* ColorInterpolation.cpp */,
BCDC642527517B040038FB39 /* ColorInterpolation.h */,
+ 32E268FC285FC8F7004660BB /* ColorInterpolationMethod.cpp */,
BC2EE8E82765942A0077768B /* ColorInterpolationMethod.h */,
BC6EB84526266B61003225A7 /* ColorLuminance.cpp */,
BC4A23EB25EC160200AAC630 /* ColorLuminance.h */,
@@ -29301,7 +29305,9 @@
0873B86A136064EA00A522C2 /* GlyphPage.h */,
BC53C6070DA56C570021EB5D /* Gradient.cpp */,
BC53C5F40DA56B920021EB5D /* Gradient.h */,
+ 32B17614285FDDA100ED6DB8 /* GradientColorStop.cpp */,
BC19CDF3277106390053F734 /* GradientColorStop.h */,
+ 32B17615285FDDA100ED6DB8 /* GradientColorStops.cpp */,
BC19CE292772BF770053F734 /* GradientColorStops.h */,
2D2FC0561460CD6F00263633 /* GradientImage.cpp */,
2D2FC0571460CD6F00263633 /* GradientImage.h */,
Added: trunk/Source/WebCore/platform/graphics/ColorInterpolationMethod.cpp (0 => 295667)
--- trunk/Source/WebCore/platform/graphics/ColorInterpolationMethod.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/ColorInterpolationMethod.cpp 2022-06-20 04:27:35 UTC (rev 295667)
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ColorInterpolationMethod.h"
+
+#include <wtf/text/TextStream.h>
+
+namespace WebCore {
+
+TextStream& operator<<(TextStream& ts, ColorInterpolationColorSpace interpolationColorSpace)
+{
+ switch (interpolationColorSpace) {
+ case ColorInterpolationColorSpace::HSL:
+ ts << "HSL";
+ break;
+ case ColorInterpolationColorSpace::HWB:
+ ts << "HWB";
+ break;
+ case ColorInterpolationColorSpace::LCH:
+ ts << "LCH";
+ break;
+ case ColorInterpolationColorSpace::Lab:
+ ts << "Lab";
+ break;
+ case ColorInterpolationColorSpace::OKLCH:
+ ts << "OKLCH";
+ break;
+ case ColorInterpolationColorSpace::OKLab:
+ ts << "OKLab";
+ break;
+ case ColorInterpolationColorSpace::SRGB:
+ ts << "sRGB";
+ break;
+ case ColorInterpolationColorSpace::SRGBLinear:
+ ts << "sRGB linear";
+ break;
+ case ColorInterpolationColorSpace::XYZD50:
+ ts << "XYZ D50";
+ break;
+ case ColorInterpolationColorSpace::XYZD65:
+ ts << "XYZ D65";
+ break;
+ }
+ return ts;
+}
+
+TextStream& operator<<(TextStream& ts, HueInterpolationMethod hueInterpolationMethod)
+{
+ switch (hueInterpolationMethod) {
+ case HueInterpolationMethod::Shorter:
+ ts << "shorter";
+ break;
+ case HueInterpolationMethod::Longer:
+ ts << "longer";
+ break;
+ case HueInterpolationMethod::Increasing:
+ ts << "increasing";
+ break;
+ case HueInterpolationMethod::Decreasing:
+ ts << "decreasing";
+ break;
+ case HueInterpolationMethod::Specified:
+ ts << "specified";
+ break;
+ }
+ return ts;
+}
+
+TextStream& operator<<(TextStream& ts, const ColorInterpolationMethod& method)
+{
+ WTF::switchOn(method.colorSpace,
+ [&] (auto& type) {
+ ts << type.interpolationColorSpace;
+ if constexpr (hasHueInterpolationMethod<decltype(type)>)
+ ts << ' ' << type.hueInterpolationMethod;
+ ts << ' ' << method.alphaPremultiplication;
+ }
+ );
+ return ts;
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/ColorInterpolationMethod.h (295666 => 295667)
--- trunk/Source/WebCore/platform/graphics/ColorInterpolationMethod.h 2022-06-20 04:25:46 UTC (rev 295666)
+++ trunk/Source/WebCore/platform/graphics/ColorInterpolationMethod.h 2022-06-20 04:27:35 UTC (rev 295667)
@@ -32,6 +32,10 @@
#include <wtf/EnumTraits.h>
#include <wtf/Hasher.h>
+namespace WTF {
+class TextStream;
+}
+
namespace WebCore {
enum class HueInterpolationMethod : uint8_t {
@@ -55,6 +59,15 @@
XYZD65
};
+template <typename T, typename = void>
+struct HasHueInterpolationMethod : std::false_type { };
+
+template <typename T>
+struct HasHueInterpolationMethod<T, std::void_t<decltype(T::hueInterpolationMethod)>> : std::true_type { };
+
+template <typename T>
+inline constexpr bool hasHueInterpolationMethod = HasHueInterpolationMethod<T>::value;
+
struct ColorInterpolationMethod {
struct HSL {
static constexpr auto interpolationColorSpace = ColorInterpolationColorSpace::HSL;
@@ -253,6 +266,10 @@
return a.alphaPremultiplication == b.alphaPremultiplication && a.colorSpace == b.colorSpace;
}
+WTF::TextStream& operator<<(WTF::TextStream&, ColorInterpolationColorSpace);
+WTF::TextStream& operator<<(WTF::TextStream&, HueInterpolationMethod);
+WTF::TextStream& operator<<(WTF::TextStream&, const ColorInterpolationMethod&);
+
}
namespace WTF {
Modified: trunk/Source/WebCore/platform/graphics/Gradient.cpp (295666 => 295667)
--- trunk/Source/WebCore/platform/graphics/Gradient.cpp 2022-06-20 04:25:46 UTC (rev 295666)
+++ trunk/Source/WebCore/platform/graphics/Gradient.cpp 2022-06-20 04:27:35 UTC (rev 295667)
@@ -30,6 +30,8 @@
#include "FloatRect.h"
#include <wtf/HashFunctions.h>
#include <wtf/Hasher.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/text/TextStream.h>
namespace WebCore {
@@ -120,4 +122,29 @@
return m_cachedHash;
}
+TextStream& operator<<(TextStream& ts, const Gradient& gradient)
+{
+ WTF::switchOn(gradient.m_data,
+ [&] (const Gradient::LinearData& data) {
+ ts.dumpProperty("p0", data.point0);
+ ts.dumpProperty("p1", data.point1);
+ },
+ [&] (const Gradient::RadialData& data) {
+ ts.dumpProperty("p0", data.point0);
+ ts.dumpProperty("p1", data.point1);
+ ts.dumpProperty("start-radius", data.startRadius);
+ ts.dumpProperty("end-radius", data.endRadius);
+ ts.dumpProperty("aspect-ratio", data.aspectRatio);
+ },
+ [&] (const Gradient::ConicData& data) {
+ ts.dumpProperty("p0", data.point0);
+ ts.dumpProperty("angle-radians", data.angleRadians);
+ }
+ );
+ ts.dumpProperty("color-interpolation-method", gradient.m_colorInterpolationMethod);
+ ts.dumpProperty("spread-method", gradient.m_spreadMethod);
+ ts.dumpProperty("stops", gradient.m_stops);
+ return ts;
}
+
+}
Modified: trunk/Source/WebCore/platform/graphics/Gradient.h (295666 => 295667)
--- trunk/Source/WebCore/platform/graphics/Gradient.h 2022-06-20 04:25:46 UTC (rev 295666)
+++ trunk/Source/WebCore/platform/graphics/Gradient.h 2022-06-20 04:27:35 UTC (rev 295667)
@@ -47,6 +47,10 @@
typedef struct _cairo_pattern cairo_pattern_t;
#endif
+namespace WTF {
+class TextStream;
+}
+
namespace WebCore {
class AffineTransform;
@@ -54,6 +58,7 @@
class GraphicsContext;
class Gradient : public RefCounted<Gradient> {
+ friend WTF::TextStream& operator<<(WTF::TextStream&, const Gradient&);
public:
struct LinearData {
FloatPoint point0;
Copied: trunk/Source/WebCore/platform/graphics/GradientColorStop.cpp (from rev 295666, trunk/Source/WebCore/platform/graphics/GradientColorStop.h) (0 => 295667)
--- trunk/Source/WebCore/platform/graphics/GradientColorStop.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/GradientColorStop.cpp 2022-06-20 04:27:35 UTC (rev 295667)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GradientColorStop.h"
+
+#include <wtf/text/TextStream.h>
+
+namespace WebCore {
+
+TextStream& operator<<(TextStream& ts, const GradientColorStop& stop)
+{
+ ts << stop.color << " at " << stop.offset;
+ return ts;
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/GradientColorStop.h (295666 => 295667)
--- trunk/Source/WebCore/platform/graphics/GradientColorStop.h 2022-06-20 04:25:46 UTC (rev 295666)
+++ trunk/Source/WebCore/platform/graphics/GradientColorStop.h 2022-06-20 04:27:35 UTC (rev 295667)
@@ -27,6 +27,7 @@
#include "Color.h"
#include <optional>
+#include <wtf/Forward.h>
#include <wtf/Hasher.h>
namespace WebCore {
@@ -65,4 +66,6 @@
add(hasher, stop.offset, stop.color);
}
-}
+TextStream& operator<<(TextStream&, const GradientColorStop&);
+
+} // namespace WebCore
Copied: trunk/Source/WebCore/platform/graphics/GradientColorStops.cpp (from rev 295666, trunk/Source/WebCore/platform/graphics/GradientColorStop.h) (0 => 295667)
--- trunk/Source/WebCore/platform/graphics/GradientColorStops.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/GradientColorStops.cpp 2022-06-20 04:27:35 UTC (rev 295667)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GradientColorStops.h"
+
+#include <wtf/text/TextStream.h>
+
+namespace WebCore {
+
+TextStream& operator<<(TextStream& ts, const GradientColorStops& stops)
+{
+ ts << stops.stops();
+ return ts;
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/GradientColorStops.h (295666 => 295667)
--- trunk/Source/WebCore/platform/graphics/GradientColorStops.h 2022-06-20 04:25:46 UTC (rev 295666)
+++ trunk/Source/WebCore/platform/graphics/GradientColorStops.h 2022-06-20 04:27:35 UTC (rev 295667)
@@ -28,6 +28,7 @@
#include "GradientColorStop.h"
#include <algorithm>
#include <optional>
+#include <wtf/Forward.h>
#include <wtf/Vector.h>
namespace WebCore {
@@ -138,4 +139,6 @@
return {{ WTFMove(*stops) }};
}
-}
+TextStream& operator<<(TextStream&, const GradientColorStops&);
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/GraphicsTypes.cpp (295666 => 295667)
--- trunk/Source/WebCore/platform/graphics/GraphicsTypes.cpp 2022-06-20 04:25:46 UTC (rev 295666)
+++ trunk/Source/WebCore/platform/graphics/GraphicsTypes.cpp 2022-06-20 04:27:35 UTC (rev 295667)
@@ -152,6 +152,22 @@
return ts;
}
+TextStream& operator<<(TextStream& ts, GradientSpreadMethod spreadMethod)
+{
+ switch (spreadMethod) {
+ case GradientSpreadMethod::Pad:
+ ts << "pad";
+ break;
+ case GradientSpreadMethod::Reflect:
+ ts << "reflect";
+ break;
+ case GradientSpreadMethod::Repeat:
+ ts << "repeat";
+ break;
+ }
+ return ts;
+}
+
TextStream& operator<<(TextStream& ts, InterpolationQuality interpolationQuality)
{
switch (interpolationQuality) {
Modified: trunk/Source/WebCore/platform/graphics/GraphicsTypes.h (295666 => 295667)
--- trunk/Source/WebCore/platform/graphics/GraphicsTypes.h 2022-06-20 04:25:46 UTC (rev 295666)
+++ trunk/Source/WebCore/platform/graphics/GraphicsTypes.h 2022-06-20 04:27:35 UTC (rev 295667)
@@ -293,6 +293,7 @@
WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, WebCore::CompositeOperator);
WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, CompositeMode);
WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, const DropShadow&);
+WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, GradientSpreadMethod);
WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, InterpolationQuality);
WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, LineCap);
WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, LineJoin);
Modified: trunk/Source/WebCore/platform/graphics/SourceBrush.cpp (295666 => 295667)
--- trunk/Source/WebCore/platform/graphics/SourceBrush.cpp 2022-06-20 04:25:46 UTC (rev 295666)
+++ trunk/Source/WebCore/platform/graphics/SourceBrush.cpp 2022-06-20 04:27:35 UTC (rev 295667)
@@ -79,7 +79,7 @@
ts.dumpProperty("color", brush.color());
if (auto gradient = brush.gradient())
- ts.dumpProperty("gradient", gradient);
+ ts.dumpProperty("gradient", *gradient);
if (auto pattern = brush.pattern())
ts.dumpProperty("pattern", pattern);