script: Remove the quirk of flooring rowSpan by 1 (#37831)

Only Firefox has this quirk, Chrome and Safari don't. So it's simpler to
just remove it.

Testing: tested by WPT

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-07-02 14:16:28 +02:00 committed by GitHub
parent 94f35ba998
commit da364f7a61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 14 deletions

View file

@ -7,7 +7,6 @@ use html5ever::{LocalName, Prefix, local_name, ns};
use js::rust::HandleObject; use js::rust::HandleObject;
use style::attr::{AttrValue, LengthOrPercentageOrAuto}; use style::attr::{AttrValue, LengthOrPercentageOrAuto};
use style::color::AbsoluteColor; use style::color::AbsoluteColor;
use style::context::QuirksMode;
use super::attr::Attr; use super::attr::Attr;
use super::element::AttributeMutation; use super::element::AttributeMutation;
@ -208,13 +207,8 @@ impl VirtualMethods for HTMLTableCellElement {
// From <https://html.spec.whatwg.org/multipage/#dom-tdth-rowspan>: // From <https://html.spec.whatwg.org/multipage/#dom-tdth-rowspan>:
// > The rowSpan IDL attribute must reflect the rowspan content attribute. It is clamped to // > The rowSpan IDL attribute must reflect the rowspan content attribute. It is clamped to
// > the range [0, 65534], and its default value is 1. // > the range [0, 65534], and its default value is 1.
// Note that rowspan = 0 is not supported in quirks mode. // Note Firefox floors by 1 in quirks mode, but like Chrome and Safari we don't do that.
let document = self.upcast::<Node>().owner_doc(); *value = (*value).clamp(0, 65534);
if document.quirks_mode() == QuirksMode::Quirks {
*value = (*value).clamp(1, 65534);
} else {
*value = (*value).clamp(0, 65534);
}
} }
attr attr
}, },

View file

@ -611790,7 +611790,7 @@
] ]
], ],
"table-quirks.html": [ "table-quirks.html": [
"dcf6c084eda46d58b065f54cc05dde59682abbee", "cdebe8768dda04efc62636cf8a18c5bf89f5a086",
[ [
null, null,
{} {}

View file

@ -55,7 +55,7 @@
</div> </div>
<p><a href="https://quirks.spec.whatwg.org/#the-collapsing-table-quirk">The collapsing table quirk</a></p> <p><a href="https://quirks.spec.whatwg.org/#the-collapsing-table-quirk">The collapsing table quirk</a></p>
<p class="error">Chrome Legacy/Edge/Safari ignore the quirk, FF does not. <b>Proposal: depreciate the quirk</b></p> <p class="error">Chrome Legacy/Edge/Safari ignore the quirk, FF does not. <b>Proposal: deprecate the quirk</b></p>
<table style="border: 20px solid green" data-expected-height=40 data-expected-width=40></table> <table style="border: 20px solid green" data-expected-height=40 data-expected-width=40></table>
<p><a href="https://quirks.spec.whatwg.org/#the-table-cell-width-calculation-quirk">The table cell width calculation quirk</a></p> <p><a href="https://quirks.spec.whatwg.org/#the-table-cell-width-calculation-quirk">The table cell width calculation quirk</a></p>
@ -64,10 +64,10 @@
</table> </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><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> <p class="error">Chrome LayoutNG and Safari ignore the quirk, FF does not. <b>Proposal: deprecate the quirk</b></p>
<table> <table>
<tr style="height: 100px"> <tr style="height: 100px">
<td id="rowspan" rowspan="0" data-expected-height=100>100 height</td> <td id="rowspan" rowspan="0" data-expected-height=208>208 height</td>
</tr> </tr>
<tr style="height: 100px"></tr> <tr style="height: 100px"></tr>
</table> </table>
@ -82,7 +82,7 @@
assert_equals(window.getComputedStyle(document.querySelector("#notitalic")).fontStyle, "normal"); assert_equals(window.getComputedStyle(document.querySelector("#notitalic")).fontStyle, "normal");
}, "decoration does not propagate into table"); }, "decoration does not propagate into table");
test(_ => { test(_ => {
assert_equals(document.querySelector("#rowspan").rowSpan, 1); assert_equals(document.querySelector("#rowspan").rowSpan, 0);
}, "rowspan can't be zero"); }, "rowspan can be zero");
document.fonts.ready.then(() => checkLayout("table")); document.fonts.ready.then(() => checkLayout("table"));
</script> </script>