Re: [csswg-drafts] [resize-observer] svg interaction (#4032)

For SVG elements that have associated CSS layout boxes, you should definitely be able to access the CSS content and border boxes, the same as on an `<img>` or container element. This applies to the root `<svg>` in an SVG document and any inline `<svg>` element that is a direct child of HTML elements (or other non-SVG elements) or a direct child of an SVG `<foreignObject>` element, which creates an internal CSS layout context.  Other specifications have special rules for SVG elements with or without CSS boxes, including [`transform-origin`(https://drafts.csswg.org/css-transforms/#transform-origin-property) and some [CSSOM View APIs](https://drafts.csswg.org/cssom-view/#svg-layout-box).

For SVG elements _without_ CSS layout boxes (i.e, shape or group elements, or `<svg>` nested inside other `<svg>`), then `content-box` and `border-box` aren't defined. So perhaps it makes sense to default to the SVG [object bounding box](https://svgwg.org/svg2-draft/coords.html#BoundingBoxes) size.  This will only be useful in limited cases — where the container `<svg>` does not have a `viewBox` attribute and this element or its children are defined using percentage dimensions, which will therefore change as the container is resized — but most other cases could be handled by listening for resize events on the SVG that _does_ have CSS layout boxes, _if_ those are handled as normal CSS boxes.


-- 
GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4032#issuecomment-502475833 using your GitHub account

Received on Sunday, 16 June 2019 18:41:37 UTC