Modified: trunk/Source/WebCore/ChangeLog (246430 => 246431)
--- trunk/Source/WebCore/ChangeLog 2019-06-14 06:52:07 UTC (rev 246430)
+++ trunk/Source/WebCore/ChangeLog 2019-06-14 08:02:54 UTC (rev 246431)
@@ -1,3 +1,21 @@
+2019-06-14 Carlos Garcia Campos <[email protected]>
+
+ [cairo] Entering text into forms on github.com creates a trapezoid artifact
+ https://bugs.webkit.org/show_bug.cgi?id=126124
+
+ Reviewed by Michael Catanzaro.
+
+ Mixing antialiasing modes in the same clip is not actually supported by cairo. In the case of rectangle clips we
+ are already ignoring the current antialiasing to not do any antialiasing. We could do the opposite for clips
+ receiving a path, we want to enforce antialiasing in that case since the paths might contain curves. Doing that
+ we ensure all calls to clip with a path use the same antialiasing, which is the case of the github bug.
+
+ * platform/graphics/cairo/CairoOperations.cpp:
+ (WebCore::Cairo::doClipWithAntialias): Helper to call cairo_clip() with the given antialising mode.
+ (WebCore::Cairo::clip): Use doClipWithAntialias().
+ (WebCore::Cairo::clipOut): Ditto.
+ (WebCore::Cairo::clipPath): Ditto.
+
2019-06-13 Myles C. Maxfield <[email protected]>
[WHLSL] Remove unnecessary ASSERT()s and clean up visitor lambdas
Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp (246430 => 246431)
--- trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp 2019-06-14 06:52:07 UTC (rev 246430)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp 2019-06-14 08:02:54 UTC (rev 246431)
@@ -1251,6 +1251,14 @@
cairo_paint_with_alpha(cr, platformContext.layers().takeLast());
}
+static void doClipWithAntialias(cairo_t* cr, cairo_antialias_t antialias)
+{
+ auto savedAntialiasRule = cairo_get_antialias(cr);
+ cairo_set_antialias(cr, antialias);
+ cairo_clip(cr);
+ cairo_set_antialias(cr, savedAntialiasRule);
+}
+
void clip(PlatformContextCairo& platformContext, const FloatRect& rect)
{
cairo_t* cr = platformContext.cr();
@@ -1262,11 +1270,8 @@
// edge fringe artifacts may occur at the layer edges
// when a transformation is applied to the GraphicsContext
// while drawing the transformed layer.
- cairo_antialias_t savedAntialiasRule = cairo_get_antialias(cr);
- cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
- cairo_clip(cr);
+ doClipWithAntialias(cr, CAIRO_ANTIALIAS_NONE);
cairo_set_fill_rule(cr, savedFillRule);
- cairo_set_antialias(cr, savedAntialiasRule);
if (auto* graphicsContextPrivate = platformContext.graphicsContextPrivate())
graphicsContextPrivate->clip(rect);
@@ -1281,7 +1286,7 @@
cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height());
cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
- cairo_clip(cr);
+ doClipWithAntialias(cr, CAIRO_ANTIALIAS_NONE);
cairo_set_fill_rule(cr, savedFillRule);
}
@@ -1295,7 +1300,8 @@
cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
- cairo_clip(cr);
+ // Enforce default antialias when clipping paths, since they can contain curves.
+ doClipWithAntialias(cr, CAIRO_ANTIALIAS_DEFAULT);
cairo_set_fill_rule(cr, savedFillRule);
}
@@ -1308,7 +1314,8 @@
cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);
cairo_set_fill_rule(cr, clipRule == WindRule::EvenOdd ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
- cairo_clip(cr);
+ // Enforce default antialias when clipping paths, since they can contain curves.
+ doClipWithAntialias(cr, CAIRO_ANTIALIAS_DEFAULT);
cairo_set_fill_rule(cr, savedFillRule);
if (auto* graphicsContextPrivate = platformContext.graphicsContextPrivate())