script: Only enforce rowSpan >= 1 in actual quirks mode (#37820)

We were also enforcing that in limited-quirks mode, but no other browser
does that. In fact, Blink and WebKit don't have this quirk at all, so we
should consider removing it too, but for now restrict it to quirks mode
like Firefox.

Testing: adding new tests
Part of #37813

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-07-02 11:52:00 +02:00 committed by GitHub
parent 4cbadde144
commit 95d9d3a412
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 26 additions and 3 deletions

View file

@ -210,7 +210,7 @@ impl VirtualMethods for HTMLTableCellElement {
// > the range [0, 65534], and its default value is 1.
// Note that rowspan = 0 is not supported in quirks mode.
let document = self.upcast::<Node>().owner_doc();
if document.quirks_mode() != QuirksMode::NoQuirks {
if document.quirks_mode() == QuirksMode::Quirks {
*value = (*value).clamp(1, 65534);
} else {
*value = (*value).clamp(0, 65534);

View file

@ -611776,7 +611776,7 @@
]
],
"table-limited-quirks.html": [
"4deb7a93898aea084b0de1ffcee942ca889e8c9d",
"9f44d285510c22449263bc99a6afa1203cae6896",
[
null,
{}
@ -611790,7 +611790,7 @@
]
],
"table-quirks.html": [
"35c091095500e29112029d23a55a020a763631ef",
"dcf6c084eda46d58b065f54cc05dde59682abbee",
[
null,
{}

View file

@ -65,6 +65,14 @@
<td data-expected-width=184><img style="width:50px;height:20px"><img style="width:50px;height:20px"><img style="width:50px;height:20px"><img style="width:50px;height:20px"><img style="width:50px;height:20px"></td>
</table>
<p><a href="https://html.spec.whatwg.org/multipage/tables.html#algorithm-for-processing-rows">The "let <i>cell grows downward</i> be false" quirk</a> does NOT apply to limited-quirks mode</p>
<table>
<tr style="height: 100px">
<td id="rowspan" rowspan="0" data-expected-height=208>208 height</td>
</tr>
<tr style="height: 100px"></tr>
</table>
<script>
let pngSrc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACWAQMAAAChElVaAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAgAD///8UPy9PAAAAAWJLR0QB/wIt3gAAAAd0SU1FB+MBDwkdA1Cz/EMAAAAbSURBVEjH7cGBAAAAAMOg+VPf4ARVAQAAAM8ADzwAAeM8wQsAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTktMDEtMTVUMTc6Mjk6MDMtMDg6MDCYDy9IAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE5LTAxLTE1VDE3OjI5OjAzLTA4OjAw6VKX9AAAAABJRU5ErkJggg=="
;
@ -74,5 +82,8 @@
test(_ => {
assert_equals(window.getComputedStyle(document.querySelector("#italic")).fontStyle, "italic");
}, "decoration propagates into table");
test(_ => {
assert_equals(document.querySelector("#rowspan").rowSpan, 0);
}, "rowspan can be zero");
document.fonts.ready.then(() => checkLayout("table"));
</script>

View file

@ -63,6 +63,15 @@
<td data-expected-width=290><img style="width:50px;height:20px"><img style="width:50px;height:20px"><img style="width:50px;height:20px"><img style="width:50px;height:20px"><img style="width:50px;height:20px"></td>
</table>
<p><a href="https://html.spec.whatwg.org/multipage/tables.html#algorithm-for-processing-rows">The "let <i>cell grows downward</i> be false" quirk</a></p>
<p class="error">Chrome LayoutNG and Safari ignore the quirk, FF does not.</p>
<table>
<tr style="height: 100px">
<td id="rowspan" rowspan="0" data-expected-height=100>100 height</td>
</tr>
<tr style="height: 100px"></tr>
</table>
<script>
let pngSrc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACWAQMAAAChElVaAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABlBMVEUAgAD///8UPy9PAAAAAWJLR0QB/wIt3gAAAAd0SU1FB+MBDwkdA1Cz/EMAAAAbSURBVEjH7cGBAAAAAMOg+VPf4ARVAQAAAM8ADzwAAeM8wQsAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTktMDEtMTVUMTc6Mjk6MDMtMDg6MDCYDy9IAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE5LTAxLTE1VDE3OjI5OjAzLTA4OjAw6VKX9AAAAABJRU5ErkJggg=="
;
@ -72,5 +81,8 @@
test(_ => {
assert_equals(window.getComputedStyle(document.querySelector("#notitalic")).fontStyle, "normal");
}, "decoration does not propagate into table");
test(_ => {
assert_equals(document.querySelector("#rowspan").rowSpan, 1);
}, "rowspan can't be zero");
document.fonts.ready.then(() => checkLayout("table"));
</script>