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: | SVG | Assignee: | 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
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/96320059>
Ahmad Saleem
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
Pull request: https://github.com/WebKit/WebKit/pull/60701
EWS
Committed 313859@main (58f3b64ab992): <https://commits.webkit.org/313859@main>
Reviewed commits have been landed. Closing PR #60701 and removing active labels.
Ahmad Saleem
*** Bug 296024 has been marked as a duplicate of this bug. ***