[webkit-dev] Non-Scaling Stroke feature (SVGT 1.2)

Jeff Schiller codedread at gmail.com
Thu Nov 19 12:29:31 PST 2009


Does anyone else have any comments on this?  I was told to bring it up
here for discussion.

Based on no one screaming bloody murder, I intend to continue working
on the patch.  Currently non-scaling-stroke seems to work fine for
colored strokes. There is a bug with gradient strokes that I will work
out.

I also need to implement some tests for this - I'm not very happy with
how pixel tests work in WebKit-land (per platform comparing to
rasters).

Is there anything like Mozilla's reftests in WebKit?
https://developer.mozilla.org/en/Creating_reftest-based_unit_tests

In this case, I'd generate reference SVG that has the constant stroke
in green and then test the non-scaling-stroke against this reference
rendering.  Then I wouldn't have to worry about platform-specific
renderings as the two renderings of SVGs should match.

Regards,
Jeff

On Tue, Nov 17, 2009 at 12:37 AM, Jeff Schiller <codedread at gmail.com> wrote:
> Hi Dirk,
>
> I wasn't aware of another bug, sorry.
>
> Actually on the patch that I have already attached to that bug, it
> seems to work in the few test cases I've been able to find (my own and
> a couple from the SVGT 1.2 test suite).  While stroking, I transform
> the path with the CTM of the context and un-transform the context
> (with its inverse matrix).  Then I undo that after stroking.
>
> The only thing that may be a problem is the dirty rectangle that is
> created by paths with non-scaled-strokes.  I need to look at that
> after generating some tests.
>
> Regards,
> Jeff
>
> On Tue, Nov 17, 2009 at 12:33 AM, Dirk Schulze <krit at webkit.org> wrote:
>> Hi,
>>
>> I thougt that we already had a bug about this. It is a good idea to
>> support this feature in general. Even if our support for SVG 1.1 is not
>> perfect, we should think about some features of SVG 1.2 like media
>> support and also non scaling strokes. But implementing non scaling
>> strokes is not that easy. On SVG we transform the context multiple times
>> (translate, scale, skew) and stroke the path at the end. We may think
>> about transforming the path instead of the context but there might be
>> more problems on doing that.
>>
>> -Dirk
>>
>> Am Montag, den 16.11.2009, 16:23 -0600 schrieb Jeff Schiller:
>>> Hello,
>>>
>>> I am interested in having broader support for non-scaling stroke on
>>> SVG shapes.  This is a SVGT 1.2 feature:
>>> http://www.w3.org/TR/SVGTiny12/painting.html#NonScalingStroke
>>>
>>> This adds a CSS property and attribute: vector-effect.  This property
>>> can have three values:  none (default), inherit, or
>>> non-scaling-stroke.
>>>
>>> When non-scaling-stroke, the stroke (outline) of a shape would
>>> maintain its specified width regardless of the transforms applied to
>>> the shape.  This is very useful when importing foreign SVG into new
>>> documents and in GIS/mapping scenarios (for instance, zooming in on a
>>> map would not "fatten" the driving directions path).
>>>
>>> I realize that WebKit has been generally not interested in SVGT 1.2,
>>> but I feel it makes sense to cherry-pick certain features that really
>>> do improve SVG on the web.  Non-scaling stroke is one of these
>>> features.  FWIW, Opera has implemented this feature since version 9.5.
>>>
>>> I have opened a bug and supplied a patch that gets this off the ground
>>> in WebKit:  https://bugs.webkit.org/show_bug.cgi?id=31438  I only need
>>> to figure out how to add some tests (need to understand how pixel
>>> tests work in WebKit).
>>>
>>> Darin Adler requested that I bring this up on this list for discussion.
>>>
>>> Thanks,
>>> Jeff Schiller
>>> _______________________________________________
>>> webkit-dev mailing list
>>> webkit-dev at lists.webkit.org
>>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>
>>
>>
>


More information about the webkit-dev mailing list