Open AmeliaBR opened 5 years ago
What about this? https://bug1064151.bmoattachments.org/attachment.cgi?id=8487528 Firefox and Chrome disagree. Firefox treats <svg>
and <rect>
elements the same, Chrome does not.
Is that the test you intended to link? It's about getTransformToElement and getScreenCTM, rather than getBBox.
Either way it's an inconsistency that needs to be sorted out. And there are probably similar issues when finding the BBox of an <svg>
: do you use the coordinate system it creates, or the parent coordinates?
getBBox, getTransformToElement and getScreenCTM all kind of link in that they all need to answer the question, what's the co-ordinate system of the element? We use the co-ordinate system it creates, though we say that viewBox is a transform that applies to your children and not to you.
The SVG Working Group just discussed getBBox algorithm doesn't factor in child transforms
, and agreed to the following:
RESOLUTION: Transforms on the children will be transformed into the parents coordinate system and affect the parents bounding box.
spec
See discussion in https://github.com/w3c/csswg-drafts/issues/907
There's still some confusion about how to handle 3D transforms on the child elements. But everyone is consistent (and SVG 1 prose seems to require) that transforms on the child element are converted to the parent coordinate system when calculating the parent's bounding box.