PaintServer::resolve() needs to be able to pick between context-fill and context-stroke
In writing a test file for !556 (merged) I ran into the following bug. This document:
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400">
<style>
.path1 {
fill: none;
stroke-width: 4px;
marker: url(#marker1);
}
.path2 {
fill: darkblue;
stroke: mediumseagreen;
stroke-width: 4px;
marker: url(#marker2);
}
</style>
<path class="path1" d="M20,20 L200,20 L380,20" stroke="lime"/>
<path class="path2" d="M20,40 h360 v320 h-360 v-320 Z"/>
<marker id="marker1" markerWidth="12" markerHeight="12" refX="6" refY="6"
markerUnits="userSpaceOnUse">
<circle cx="6" cy="6" r="3"
fill="white" stroke="context-stroke" stroke-width="2"/>
</marker>
<marker id="marker2" markerWidth="12" markerHeight="12" refX="6" refY="6"
markerUnits="userSpaceOnUse">
<!-- Note that here the paint is reversed:
fill=context-stroke,
stroke=context-fill
-->
<circle cx="6" cy="6" r="3"
fill="context-stroke" stroke="context-fill" stroke-width="2"/>
</marker>
</svg>
Should render like this:
But in the output, the stroke/fill of the markers matches the stroke/fill of the path, but they should be reversed as the test file deliberately has fill="context-stroke" stroke="context-fill"
.
I think PaintSource::resolve()
needs to be passed both the context fill and the context stroke paint, and it should choose between them. Right now it is just being passed one of them, so it doesn't have a chance to pick the other if needed.
@madds-h when you fix this, could you please just replace the existing test in tests/src/reference.rs
?