[svgwg] Bounding box algorithm is not precise

dirkschulze has just created a new issue for https://github.com/w3c/svgwg:

== Bounding box algorithm is not precise ==
The algorithm in [Bounding Boxes](https://svgwg.org/svg2-draft/coords.html#BoundingBoxes) describes how to compute the different boxes sizes depending on the booleans fill, stroke, markers, clipped.

However, with the exception of fill, all algorithms have the description:
> set _box_ to be the union of _box_ and [...]

However, _box_ is specified to get initialized as (0,0,0,0) and therefore has an actual value. If _box_ wasn't set to fill already, then all boxes will include the point (0,0) which is not what we want to have.

Maybe we should let each boolean initialize _box_ to the value returned by each operation if it isn't initialized already, otherwise create the union of _box_ and the specific rects.

If either none of the flags was set or no operation initialized/contributed to _box_, initialize it to (0,0,0,0) and return _box_.

Personal note: The dictionary might not be easy to feature detect. It might be quite some work to figure out which flag is supported by an implementation or not.

Please view or discuss this issue at https://github.com/w3c/svgwg/issues/422 using your GitHub account

Received on Sunday, 22 April 2018 10:41:50 UTC