⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 246431 in webkit


Ignore:
Timestamp:
Jun 14, 2019, 1:02:54 AM (7 years ago)
Author:
Carlos Garcia Campos
Message:

[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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r246428 r246431  
     12019-06-14  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [cairo] Entering text into forms on github.com creates a trapezoid artifact
     4        https://bugs.webkit.org/show_bug.cgi?id=126124
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Mixing antialiasing modes in the same clip is not actually supported by cairo. In the case of rectangle clips we
     9        are already ignoring the current antialiasing to not do any antialiasing. We could do the opposite for clips
     10        receiving a path, we want to enforce antialiasing in that case since the paths might contain curves. Doing that
     11        we ensure all calls to clip with a path use the same antialiasing, which is the case of the github bug.
     12
     13        * platform/graphics/cairo/CairoOperations.cpp:
     14        (WebCore::Cairo::doClipWithAntialias): Helper to call cairo_clip() with the given antialising mode.
     15        (WebCore::Cairo::clip): Use doClipWithAntialias().
     16        (WebCore::Cairo::clipOut): Ditto.
     17        (WebCore::Cairo::clipPath): Ditto.
     18
    1192019-06-13  Myles C. Maxfield  <mmaxfield@apple.com>
    220
  • trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp

    r244913 r246431  
    12521252}
    12531253
     1254static void doClipWithAntialias(cairo_t* cr, cairo_antialias_t antialias)
     1255{
     1256    auto savedAntialiasRule = cairo_get_antialias(cr);
     1257    cairo_set_antialias(cr, antialias);
     1258    cairo_clip(cr);
     1259    cairo_set_antialias(cr, savedAntialiasRule);
     1260}
     1261
    12541262void clip(PlatformContextCairo& platformContext, const FloatRect& rect)
    12551263{
     
    12631271    // when a transformation is applied to the GraphicsContext
    12641272    // while drawing the transformed layer.
    1265     cairo_antialias_t savedAntialiasRule = cairo_get_antialias(cr);
    1266     cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
    1267     cairo_clip(cr);
     1273    doClipWithAntialias(cr, CAIRO_ANTIALIAS_NONE);
    12681274    cairo_set_fill_rule(cr, savedFillRule);
    1269     cairo_set_antialias(cr, savedAntialiasRule);
    12701275
    12711276    if (auto* graphicsContextPrivate = platformContext.graphicsContextPrivate())
     
    12821287    cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);
    12831288    cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
    1284     cairo_clip(cr);
     1289    doClipWithAntialias(cr, CAIRO_ANTIALIAS_NONE);
    12851290    cairo_set_fill_rule(cr, savedFillRule);
    12861291}
     
    12961301    cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);
    12971302    cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
    1298     cairo_clip(cr);
     1303    // Enforce default antialias when clipping paths, since they can contain curves.
     1304    doClipWithAntialias(cr, CAIRO_ANTIALIAS_DEFAULT);
    12991305    cairo_set_fill_rule(cr, savedFillRule);
    13001306}
     
    13091315    cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr);
    13101316    cairo_set_fill_rule(cr, clipRule == WindRule::EvenOdd ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING);
    1311     cairo_clip(cr);
     1317    // Enforce default antialias when clipping paths, since they can contain curves.
     1318    doClipWithAntialias(cr, CAIRO_ANTIALIAS_DEFAULT);
    13121319    cairo_set_fill_rule(cr, savedFillRule);
    13131320
Note: See TracChangeset for help on using the changeset viewer.