コード例 #1
0
void GraphicsContext::drawLineForTextChecking(const FloatPoint& origin, float width, TextCheckingLineStyle style)
{
    if (paintingDisabled())
        return;

    cairo_t* cr = platformContext()->cr();
    cairo_save(cr);

    switch (style) {
    case TextCheckingSpellingLineStyle:
        cairo_set_source_rgb(cr, 1, 0, 0);
        break;
    case TextCheckingGrammarLineStyle:
        cairo_set_source_rgb(cr, 0, 1, 0);
        break;
    default:
        cairo_restore(cr);
        return;
    }

#if PLATFORM(GTK)
    // We ignore most of the provided constants in favour of the platform style
    pango_cairo_show_error_underline(cr, origin.x(), origin.y(), width, cMisspellingLineThickness);
#else
    drawErrorUnderline(cr, origin.x(), origin.y(), width, cMisspellingLineThickness);
#endif

    cairo_restore(cr);
}
コード例 #2
0
void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& origin, float width, DocumentMarkerLineStyle style)
{
    if (paintingDisabled())
        return;

    cairo_t* cr = platformContext()->cr();
    cairo_save(cr);

    switch (style) {
    case DocumentMarkerSpellingLineStyle:
        cairo_set_source_rgb(cr, 1, 0, 0);
        break;
    case DocumentMarkerGrammarLineStyle:
        cairo_set_source_rgb(cr, 0, 1, 0);
        break;
    default:
        cairo_restore(cr);
        return;
    }

    drawErrorUnderline(cr, origin.x(), origin.y(), width, cMisspellingLineThickness);

    cairo_restore(cr);
}