Bug 192665

Summary: Resolved value for the 'width' and 'height' properties on SVG <rect>, <image>, <svg> and <foreignObject> should be the "used value"
Product: WebKit Reporter: Fredrik Söderquist <fs>
Component: SVGAssignee: Ahmad Saleem <ahmad.saleem792>
Status: RESOLVED FIXED    
Severity: Normal CC: ahmad.saleem792, bfulgham, krit, sabouhallawa, sam, simon.fraser, webkit-bug-importer, zalan, zimmermann
Priority: P2 Keywords: FromImplementor, InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Fredrik Söderquist
Reported 2018-12-13 07:58:27 PST
As defined by CSSOM: https://drafts.csswg.org/cssom/#resolved-values Simple testcase can be found in bugs.chromium.org/p/chromium/issues/detail?id=772707 (and hopefully soonish in WPT).
Attachments
Radar WebKit Bug Importer
Comment 1 2022-07-01 16:15:15 PDT
Ahmad Saleem
Comment 2 2026-01-24 23:01:29 PST
template<CSSPropertyID propertyID> struct PreferredSizeSharedAdaptor { template<typename F> decltype(auto) computedValue(ExtractorState& state, const PreferredSize& value, F&& functor) const { auto sizingBox = [](auto& renderer) -> LayoutRect { auto* box = dynamicDowncast<RenderBox>(renderer); if (!box) return LayoutRect(); return box->style().boxSizing() == BoxSizing::BorderBox ? box->borderBoxRect() : box->computedCSSContentBoxRect(); }; auto isNonReplacedInline = [](auto& renderer) { return renderer.isInline() && !renderer.isBlockLevelReplacedOrAtomicInline(); }; if (state.renderer && !state.renderer->isRenderOrLegacyRenderSVGModelObject()) { // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-property, // the "height" property does not apply for non-replaced inline elements. if (!isNonReplacedInline(*state.renderer)) { if constexpr (propertyID == CSSPropertyHeight) return functor(Length<> { sizingBox(*state.renderer).height() }); else if constexpr (propertyID == CSSPropertyWidth) return functor(Length<> { sizingBox(*state.renderer).width() }); } } return functor(value); } }; Might be need to add something specific for SVG here.
Ahmad Saleem
Comment 3 2026-03-16 09:16:00 PDT
EWS
Comment 4 2026-05-25 17:32:03 PDT
Committed 313859@main (58f3b64ab992): <https://commits.webkit.org/313859@main> Reviewed commits have been landed. Closing PR #60701 and removing active labels.
Ahmad Saleem
Comment 5 2026-05-26 00:27:04 PDT
*** Bug 296024 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.