Bug 252903 - [Resize-observer] The `getBoundingBox` of a non-empty SVG element is 0x0
Summary: [Resize-observer] The `getBoundingBox` of a non-empty SVG element is 0x0
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: cathiechen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-02-24 07:30 PST by cathiechen
Modified: 2023-03-27 06:24 PDT (History)
6 users (show)

See Also:


Attachments
test-case (785 bytes, text/html)
2023-02-24 07:30 PST, cathiechen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description cathiechen 2023-02-24 07:30:40 PST
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.
Comment 1 cathiechen 2023-02-24 08:50:12 PST
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/
Comment 2 cathiechen 2023-03-02 13:28:54 PST
Pull request: https://github.com/WebKit/WebKit/pull/10955
Comment 3 Radar WebKit Bug Importer 2023-03-03 07:31:14 PST
<rdar://problem/106194536>
Comment 4 EWS 2023-03-27 06:24:00 PDT
Committed 262145@main (afa718b1cfd9): <https://commits.webkit.org/262145@main>

Reviewed commits have been landed. Closing PR #10955 and removing active labels.