[filter-effects] allow "viewBox" as a value for primitiveUnits

In responsive design patterns, there are many cases in which content resizes to an SVG viewBox using preserveAspectRatio. But if I'm not mistaken, there is currently no easy way to scale the positioning of certain filters (for example a light source) relative to the viewBox. The only two options are the unscaled user space (userSpaceOnUse) and the filtered object's bounding box (objectBoundingBox).

If we imagine try to responsively code a spot-lit visual stage, with objects moving around on it, in and out of the spotlight, it's clear that scaling multiple light sources to the bounding boxes of the individual elements moving around on the stage doesn't work. Even if we were to create a redundant empty wrapper element, and call the filter once on that element, such a wrapper element still doesn't offer the power and flexibility of preserveAspectRatio. What I want as an author is to able to delegate the scaling of SVG filters to the viewBox, and use percentage lengths for filter positions, to preserve scalability.

To put this a bit more extremely, I doubt that there has *ever* been a case when an author truly needed to specify filter scaling and positioning in unscaled global units regardless of the viewBox, in a case in which a viewBox has been specified.  In retrospect, maybe a viewBox should have been checked for from the start? But since it's presumably baked hard into the spec now (???), I would like to suggest that the best way to address this use case is to add "viewBox" as another possible value for primitiveUnits.

Note that implementations are just now catching up with these uses :) 
https://bugs.webkit.org/show_bug.cgi?id=113059

Reference:
https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#FilterElementPrimitiveUnitsAttribute

Received on Wednesday, 3 April 2013 19:31:46 UTC