RESOLVED FIXED264010
Include additional translation in getBBox for SVGUseElement
https://bugs.webkit.org/show_bug.cgi?id=264010
Summary Include additional translation in getBBox for SVGUseElement
Ahmad Saleem
Reported 2023-10-31 16:06:45 PDT
Hi Team, While going through Blink's commit, I came across another failing test case: Test Case: https://jsfiddle.net/onav6d90/show ^ Fails in Safari Technology Preview 181 and WebKit ToT. Passes in Chrome Canary 120 and Firefox Nightly 121. Blink Commit: https://chromium.googlesource.com/chromium/blink/+/99b52757a16d0a300b77c83c27c443d70ba78f9c Just wanted to raise, so we can fix it. Thanks!
Attachments
Radar WebKit Bug Importer
Comment 1 2023-11-07 15:07:14 PST
Ahmad Saleem
Comment 2 2025-08-26 05:03:57 PDT
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGContainer.h: > Make it public: FloatRect objectBoundingBox() const final { return m_objectBoundingBox.value_or(FloatRect()); } * Source/WebCore/rendering/svg/legacy/LegacyRenderSVGTransformableContainer.h: > Add as public: const FloatSize& additionalTranslation() const { return m_additionalTranslation; } * Source/WebCore/svg/SVGUseElement.cpp: FloatRect SVGUseElement::getBBox(StyleUpdateStrategy styleUpdateStrategy) { if (styleUpdateStrategy == AllowStyleUpdate) protectedDocument()->updateLayoutIgnorePendingStylesheets({ LayoutOptions::TreatContentVisibilityHiddenAsVisible, LayoutOptions::TreatContentVisibilityAutoAsVisible }, this); if (!renderer()) return { }; auto* transformableContainer = dynamicDowncast<LegacyRenderSVGTransformableContainer>(renderer()); // Don't apply the additional translation if the oBB is invalid. if (!transformableContainer->isObjectBoundingBoxValid()) return { }; // FIXME: Preferably this would just use objectBoundingBox() (and hence // don't need to override SVGGraphicsElement::getBBox at all) and be // correct without additional work. Although it does not work due to // problem stemming from including the additional translation directly // on the renderer corresponding to the SVGUseElement. FloatRect bbox = transformableContainer->objectBoundingBox(); bbox.move(transformableContainer->additionalTranslation()); return bbox; } * Source/WebCore/svg/SVGUseElement.h: FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate) override; _____________________ It compiles and progresses.
Ahmad Saleem
Comment 3 2025-08-26 05:06:47 PDT
It progresses 'SVGGraphicsElement.getBBox-05.html' -> FAIL use with fill assert_approx_equals: use1.getBBox().x {"fill":true,"stroke":false,"markers":false,"clipped":false} expected 70 +/- 0.1 but got 20 to PASS use with fill
Ahmad Saleem
Comment 4 2025-09-24 01:04:31 PDT
EWS
Comment 5 2025-10-31 12:47:41 PDT
Committed 302400@main (e53a0bba5e47): <https://commits.webkit.org/302400@main> Reviewed commits have been landed. Closing PR #51242 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.