If you apply a fill and a stroke color to the context, the last defined color is used to fill a path/rect (strokeRect() isn't apllied at all). It's because solid colors are applied to one source pattern. We can't save different colors in cairo. But perhaps we can use patterns for solid colors? A fill pattern and a stroke pattern to fill/stroke pathes/rects with this patterns combined with CAIRO_EXTEND_REPEAT.
Created attachment 21970 [details] Example short example
Created attachment 21987 [details] Example a better testcase. strokeRect() has a bug too :-)
Fixed with https://bugs.webkit.org/show_bug.cgi?id=20405