| Summary: | Fix getBBox() returning (0,0) bug when width or height is zero | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ahmad Saleem <ahmad.saleem792> |
| Component: | SVG | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | karlcow, sabouhallawa, simon.fraser, webkit-bug-importer, zimmermann |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=93290 | ||
|
Description
Ahmad Saleem
2023-06-01 12:33:09 PDT
git log for tests added with that fix shows an explanation from Said, see https://commits.webkit.org/217223@main: These tests were added in r169522. They succeed in Safari and Chrome but they fail in FireFox. The issue of calculating getBBox was discussed in: https://lists.w3.org/Archives/Public/www-svg/2012Aug/0014.html. But no resolution was reached. So looks like we've intentionally undone this change. In addition to what Alex mentioned there are a number of issues around https://wpt.fyi/results/svg/types/scripted?label=master&label=experimental&aligned&q=getbbox Also https://bugs.webkit.org/buglist.cgi?quicksearch=getbbox Probably it would be worth to open an issue on https://github.com/w3c/svgwg/issues?q=is%3Aissue+is%3Aopen+getbbox with a pointer to the thread Alex found. https://lists.w3.org/Archives/Public/www-svg/2012Aug/thread.html#msg14 Gecko/WebKit at the time were aligned on ignoring the shape and consider it as a display: none. The state of implementations was described in https://lists.w3.org/Archives/Public/www-svg/2012Aug/0043.html On SVG 2 current Editor Draft https://svgwg.org/svg2-draft/types.html#__svg__SVGGraphicsElement__getBBox > The getBBox method is used to compute the bounding box of > the current element. When the getBBox(options) method is > called, the bounding box algorithm is invoked for the > current element, with fill, stroke, markers and clipped > members of the options dictionary argument used to control > which parts of the element are included in the bounding > box, using the element's user coordinate system as the > coordinate system to return the bounding box in. A newly > created DOMRect object that defines the computed bounding > box is returned. And the paragraph ends with: > If getBBox gets called on a non-rendered element, and > the UA is not able to compute the geometry of the element, > then throw an InvalidStateError. So at least it should throw an InvalidStateError. (If I understood correctly.) |