Title: [264273] trunk
Revision
264273
Author
[email protected]
Date
2020-07-11 19:51:02 -0700 (Sat, 11 Jul 2020)

Log Message

[WinCairo] Conic gradients support
https://bugs.webkit.org/show_bug.cgi?id=214216

Reviewed by Sam Weinig.

.:

* Source/cmake/OptionsWin.cmake: Turn ENABLE_CSS_CONIC_GRADIENTS on.

Source/WebCore:

* platform/graphics/cairo/GradientCairo.cpp:
(WebCore::addConicSector): Replaced M_PI with piDouble of WTF.
(WebCore::Gradient::createPlatformGradient): Don't use C++20 designated initializers.

LayoutTests:

* platform/wincairo/TestExpectations: Marked some conic-gradient tests Pass.

Modified Paths

Diff

Modified: trunk/ChangeLog (264272 => 264273)


--- trunk/ChangeLog	2020-07-12 01:01:25 UTC (rev 264272)
+++ trunk/ChangeLog	2020-07-12 02:51:02 UTC (rev 264273)
@@ -1,3 +1,12 @@
+2020-07-11  Fujii Hironori  <[email protected]>
+
+        [WinCairo] Conic gradients support
+        https://bugs.webkit.org/show_bug.cgi?id=214216
+
+        Reviewed by Sam Weinig.
+
+        * Source/cmake/OptionsWin.cmake: Turn ENABLE_CSS_CONIC_GRADIENTS on.
+
 2020-07-10  Don Olmstead  <[email protected]> and Fujii Hironori  <[email protected]>
 
         [WinCairo] WOFF2 font support

Modified: trunk/LayoutTests/ChangeLog (264272 => 264273)


--- trunk/LayoutTests/ChangeLog	2020-07-12 01:01:25 UTC (rev 264272)
+++ trunk/LayoutTests/ChangeLog	2020-07-12 02:51:02 UTC (rev 264273)
@@ -1,3 +1,12 @@
+2020-07-11  Fujii Hironori  <[email protected]>
+
+        [WinCairo] Conic gradients support
+        https://bugs.webkit.org/show_bug.cgi?id=214216
+
+        Reviewed by Sam Weinig.
+
+        * platform/wincairo/TestExpectations: Marked some conic-gradient tests Pass.
+
 2020-07-11  Simon Fraser  <[email protected]>
 
         REGRESSION(r260276): Overflow scrolling layers misplaced inside SVG foreign object

Modified: trunk/LayoutTests/platform/wincairo/TestExpectations (264272 => 264273)


--- trunk/LayoutTests/platform/wincairo/TestExpectations	2020-07-12 01:01:25 UTC (rev 264272)
+++ trunk/LayoutTests/platform/wincairo/TestExpectations	2020-07-12 02:51:02 UTC (rev 264273)
@@ -758,6 +758,15 @@
 fast/images/animated-gif-window-resizing.html [ Timeout ]
 fast/picture/viewport-resize.html [ Timeout ]
 
+http/wpt/css/css-images-4/conic-gradient-parsing.html [ Pass ]
+fast/gradients/conic-repeating.html [ Pass ]
+fast/gradients/conic.html [ Pass ]
+fast/gradients/conic-off-center.html [ Pass ]
+fast/gradients/conic-center-outside-box.html [ Pass ]
+fast/gradients/conic-extended-stops.html [ Pass ]
+fast/gradients/conic-from-angle.html [ Pass ]
+fast/gradients/conic-two-hints.html [ Pass ]
+
 [ Debug ] animations/CSSKeyframesRule-name-null.html [ Pass Timeout ]
 
 [ Debug ] css3/filters/filter-property-computed-style.html [ Pass Timeout ]

Modified: trunk/Source/WebCore/ChangeLog (264272 => 264273)


--- trunk/Source/WebCore/ChangeLog	2020-07-12 01:01:25 UTC (rev 264272)
+++ trunk/Source/WebCore/ChangeLog	2020-07-12 02:51:02 UTC (rev 264273)
@@ -1,3 +1,14 @@
+2020-07-11  Fujii Hironori  <[email protected]>
+
+        [WinCairo] Conic gradients support
+        https://bugs.webkit.org/show_bug.cgi?id=214216
+
+        Reviewed by Sam Weinig.
+
+        * platform/graphics/cairo/GradientCairo.cpp:
+        (WebCore::addConicSector): Replaced M_PI with piDouble of WTF.
+        (WebCore::Gradient::createPlatformGradient): Don't use C++20 designated initializers.
+
 2020-07-11  Sam Weinig  <[email protected]>
 
         Reduce surface area of the ExtendedColor class to a bare minimum

Modified: trunk/Source/WebCore/platform/graphics/cairo/GradientCairo.cpp (264272 => 264273)


--- trunk/Source/WebCore/platform/graphics/cairo/GradientCairo.cpp	2020-07-12 01:01:25 UTC (rev 264272)
+++ trunk/Source/WebCore/platform/graphics/cairo/GradientCairo.cpp	2020-07-12 02:51:02 UTC (rev 264273)
@@ -34,6 +34,7 @@
 #include "CairoUtilities.h"
 #include "GraphicsContext.h"
 #include "PlatformContextCairo.h"
+#include <wtf/MathExtras.h>
 
 namespace WebCore {
 
@@ -47,8 +48,6 @@
     cairo_pattern_add_color_stop_rgba(gradient, stop.offset, r, g, b, a * globalAlpha);
 }
 
-#if PLATFORM(GTK) || PLATFORM(WPE)
-
 typedef struct point_t {
     double x, y;
 } point_t;
@@ -66,8 +65,8 @@
 
     // Substract 90 degrees so angles start from top left.
     // Convert to radians and add angleRadians offset.
-    double angleStart = ((from.offset - angOffset) * 2 * M_PI) + angleRadians;
-    double angleEnd = ((to.offset - angOffset) * 2 * M_PI) + angleRadians;
+    double angleStart = ((from.offset - angOffset) * 2 * piDouble) + angleRadians;
+    double angleEnd = ((to.offset - angOffset) * 2 * piDouble) + angleRadians;
 
     // Calculate center offset depending on quadrant.
     //
@@ -105,20 +104,20 @@
     // Calculate starting point, ending point and control points of Bezier curve.
     double f = 4 * tan((angleEnd - angleStart) / 4) / 3;
     point_t p0 = {
-        .x = cx + (r * cos(angleStart)),
-        .y = cy + (r * sin(angleStart)),
+        cx + (r * cos(angleStart)),
+        cy + (r * sin(angleStart)),
     };
     point_t p1 = {
-        .x = cx + (r * cos(angleStart)) - f * (r * sin(angleStart)),
-        .y = cy + (r * sin(angleStart)) + f * (r * cos(angleStart)),
+        cx + (r * cos(angleStart)) - f * (r * sin(angleStart)),
+        cy + (r * sin(angleStart)) + f * (r * cos(angleStart)),
     };
     point_t p2 = {
-        .x = cx + (r * cos(angleEnd)) + f * (r * sin(angleEnd)),
-        .y = cy + (r * sin(angleEnd)) - f * (r * cos(angleEnd)),
+        cx + (r * cos(angleEnd)) + f * (r * sin(angleEnd)),
+        cy + (r * sin(angleEnd)) - f * (r * cos(angleEnd)),
     };
     point_t p3 = {
-        .x = cx + (r * cos(angleEnd)),
-        .y = cy + (r * sin(angleEnd)),
+        cx + (r * cos(angleEnd)),
+        cy + (r * sin(angleEnd)),
     };
 
     // Add patch with shape of the sector and gradient colors.
@@ -183,8 +182,6 @@
     return gradient;
 }
 
-#endif
-
 cairo_pattern_t* Gradient::createPlatformGradient(float globalAlpha)
 {
     cairo_pattern_t* gradient = WTF::switchOn(m_data,
@@ -194,7 +191,6 @@
         [&] (const RadialData& data) -> cairo_pattern_t* {
             return cairo_pattern_create_radial(data.point0.x(), data.point0.y(), data.startRadius, data.point1.x(), data.point1.y(), data.endRadius);
         },
-#if PLATFORM(GTK) || PLATFORM(WPE)
         [&] (const ConicData& data)  -> cairo_pattern_t* {
             // FIXME: data passed for a Conic gradient doesn't contain a radius. That's apparently correct because the W3C spec
             // (https://www.w3.org/TR/css-images-4/#conic-gradients) states a conic gradient is only defined by its position and angle.
@@ -202,11 +198,6 @@
             // An alternative solution could be to change the API and pass a rect's width and height to optimize the computation of the radius.
             const float radius = 4096;
             return createConic(data.point0.x(), data.point0.y(), radius, data.angleRadians, stops(), globalAlpha);
-#else
-        [&] (const ConicData&)  -> cairo_pattern_t* {
-            // FIXME: implement conic gradient rendering.
-            return nullptr;
-#endif
         }
     );
 

Modified: trunk/Source/cmake/OptionsWin.cmake (264272 => 264273)


--- trunk/Source/cmake/OptionsWin.cmake	2020-07-12 01:01:25 UTC (rev 264272)
+++ trunk/Source/cmake/OptionsWin.cmake	2020-07-12 02:51:02 UTC (rev 264273)
@@ -70,6 +70,7 @@
 if (${WTF_PLATFORM_WIN_CAIRO})
     WEBKIT_OPTION_DEFINE(ENABLE_TLS_DEBUG "Enable TLS key log support" PRIVATE OFF)
 
+    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_CONIC_GRADIENTS PRIVATE ON)
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_ENCRYPTED_MEDIA PUBLIC OFF)
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PUBLIC_SUFFIX_LIST PRIVATE ON)
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE ON)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to