[Webkit-unassigned] [Bug 284441] WebKit ignores margin-top on 'legend' element (in fieldset)
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Dec 10 23:53:21 PST 2024
https://bugs.webkit.org/show_bug.cgi?id=284441
--- Comment #1 from Karl Dubost <karlcow at apple.com> ---
This is even more interesting, because the margin is not added visually, but it is here in the getComputedStyle.
```
window.getComputedStyle(document.querySelector('legend')).marginTop
# reports 100px
```
padding on the other end is taken into account on all sides.
In `RenderBox.cpp` there is a special case for Legend, inside
`bool RenderBox::sizesLogicalWidthToFitContent(SizeType widthType) const {… }`
https://searchfox.org/wubkat/rev/a6aecb7cb3614074b11d5db8390698e4ef53b110/Source/WebCore/rendering/RenderBox.cpp#2956-2961
```
// Button, input, select, textarea, and legend treat width value of 'auto' as 'intrinsic' unless it's in a
// stretching column flexbox.
// FIXME: Think about block-flow here.
// https://bugs.webkit.org/show_bug.cgi?id=46473
if (logicalWidth.isAuto() && !isStretchingColumnFlexItem() && element()
&& (is<HTMLInputElement>(*element())
|| is<HTMLSelectElement>(*element())
|| is<HTMLButtonElement>(*element())
|| is<HTMLTextAreaElement>(*element())
|| is<HTMLLegendElement>(*element()))
) {
return true;
}
```
and in html.css
```
legend {
padding-inline-start: 2px;
padding-inline-end: 2px;
border: none;
}
```
Ah probably more interesting `isLegend()`
https://searchfox.org/wubkat/search?q=symbol:_ZNK7WebCore12RenderObject8isLegendEv&redirect=false
which triggers specific rules for layout computations including.
https://searchfox.org/wubkat/search?q=isExcludedAndPlacedInBorder&redirect=false
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20241211/32b09419/attachment.htm>
More information about the webkit-unassigned
mailing list