| Summary: | [Resize-observer] The `getBoundingBox` of a non-empty SVG element is 0x0 | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | cathiechen <cathiechen> | ||||
| Component: | CSS | Assignee: | cathiechen <cathiechen> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | cathiechen, rbuis, sabouhallawa, simon.fraser, webkit-bug-importer, zalan | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Nightly Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
According to [1], > Web content can also contain SVG elements. SVG elements that do not have associated CSS layout boxes define bounding box instead of a content box. Content rect for the SVGGraphicsElements without CSS layout boxes is a rect whose: > width is bounding box width > height is bounding box height So from ResizeObserver size, it is correct to call `downcast<SVGElement>(*m_target).getBoundingBox()` in `ResizeObservation::computeObservedSizes()`. I'll leave this bug to an SVG Expert. [1] https://drafts.csswg.org/resize-observer/ Pull request: https://github.com/WebKit/WebKit/pull/10955 Committed 262145@main (afa718b1cfd9): <https://commits.webkit.org/262145@main> Reviewed commits have been landed. Closing PR #10955 and removing active labels. |
Created attachment 465152 [details] test-case In ResizeObservation::computeObservedSizes(), it calls `downcast<SVGElement>(*m_target).getBoundingBox()` which returns 0x0 when the layout size of SVG is not empty. See the attached test.