mirror of
https://github.com/servo/servo.git
synced 2025-06-11 10:00:18 +00:00
layout: Only prevent fixed table layout when inline-size
is auto
(#35882)
We were ignoring `table-layout: fixed` both for `inline-size: auto` and `inline-size: max-content`. However, the CSSWG resolved that fixed table layout should be triggered except when `inline-size` is `auto`. https://github.com/w3c/csswg-drafts/issues/10937#issuecomment-2669150397 Blink has already adopted this change, and they modified the WPT `/css/css-tables/fixed-layout-2.html` accordingly. Here I'm doing some further cosmetic cleanups to the test. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
79e25a3e77
commit
56da4ad959
4 changed files with 27 additions and 33 deletions
|
@ -240,15 +240,11 @@ impl Zero for CellOrTrackMeasure {
|
||||||
|
|
||||||
impl<'a> TableLayout<'a> {
|
impl<'a> TableLayout<'a> {
|
||||||
fn new(table: &'a Table) -> TableLayout<'a> {
|
fn new(table: &'a Table) -> TableLayout<'a> {
|
||||||
// It's not clear whether `inline-size: stretch` allows fixed table mode or not,
|
// The CSSWG resolved that only `inline-size: auto` can prevent fixed table mode.
|
||||||
// we align with Gecko and Blink.
|
// <https://github.com/w3c/csswg-drafts/issues/10937#issuecomment-2669150397>
|
||||||
// <https://github.com/w3c/csswg-drafts/issues/10937>.
|
let style = &table.style;
|
||||||
let is_in_fixed_mode = table.style.get_table().clone_table_layout() ==
|
let is_in_fixed_mode = style.get_table().table_layout == TableLayoutMode::Fixed &&
|
||||||
TableLayoutMode::Fixed &&
|
!style.box_size(style.writing_mode).inline.is_initial();
|
||||||
!matches!(
|
|
||||||
table.style.box_size(table.style.writing_mode).inline,
|
|
||||||
Size::Initial | Size::MaxContent
|
|
||||||
);
|
|
||||||
Self {
|
Self {
|
||||||
table,
|
table,
|
||||||
pbm: PaddingBorderMargin::zero(),
|
pbm: PaddingBorderMargin::zero(),
|
||||||
|
|
2
tests/wpt/meta/MANIFEST.json
vendored
2
tests/wpt/meta/MANIFEST.json
vendored
|
@ -596238,7 +596238,7 @@
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"fixed-layout-2.html": [
|
"fixed-layout-2.html": [
|
||||||
"8b805af7669ed914dc5f0d007a2ff8171f45d60a",
|
"d751954714cd7b8c1f5b87182d1025474c5c4939",
|
||||||
[
|
[
|
||||||
null,
|
null,
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[fixed-layout-2.html]
|
|
||||||
[max-content]
|
|
||||||
expected: FAIL
|
|
|
@ -3,6 +3,7 @@
|
||||||
<link rel="author" title="Oriol Brufau" href="obrufau@igalia.com">
|
<link rel="author" title="Oriol Brufau" href="obrufau@igalia.com">
|
||||||
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#in-fixed-mode">
|
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#in-fixed-mode">
|
||||||
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/10937">
|
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/10937">
|
||||||
|
<meta name="assert" content="Fixed table layout is triggered except when inline-size is auto.">
|
||||||
<link rel="stylesheet" href="./support/base.css">
|
<link rel="stylesheet" href="./support/base.css">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -52,26 +53,25 @@ x-td > div {
|
||||||
<script src="/resources/testharness.js"></script>
|
<script src="/resources/testharness.js"></script>
|
||||||
<script src="/resources/testharnessreport.js"></script>
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
<script>
|
<script>
|
||||||
let sizeData = {
|
let sizes = [
|
||||||
"10px": true,
|
"10px",
|
||||||
"100%": true,
|
"100%",
|
||||||
"calc(10px + 100%)": true,
|
"calc(10px + 100%)",
|
||||||
"auto": false,
|
"auto",
|
||||||
"min-content": true,
|
"min-content",
|
||||||
"max-content": true,
|
"max-content",
|
||||||
"fit-content": true,
|
"fit-content",
|
||||||
"calc-size(any, 10px + 100%)": true,
|
"calc-size(any, 10px + 100%)",
|
||||||
|
"fit-content(0)",
|
||||||
|
"stretch",
|
||||||
|
"contain",
|
||||||
|
|
||||||
// These expectations are tentative, see https://github.com/w3c/csswg-drafts/issues/10937
|
// These are non-standard sizes.
|
||||||
"fit-content(0)": true,
|
"-moz-available",
|
||||||
"stretch": true,
|
"-webkit-fill-available",
|
||||||
|
"intrinsic",
|
||||||
// These are non-standard, expect the most popular behavior among the supporting implementations.
|
"min-intrinsic",
|
||||||
"-moz-available": true,
|
];
|
||||||
"-webkit-fill-available": true,
|
|
||||||
"intrinsic": true,
|
|
||||||
"min-intrinsic": true,
|
|
||||||
};
|
|
||||||
|
|
||||||
function checkSize(size, allowsFixed) {
|
function checkSize(size, allowsFixed) {
|
||||||
let fragment = template.content.cloneNode(true);
|
let fragment = template.content.cloneNode(true);
|
||||||
|
@ -101,8 +101,9 @@ function checkSize(size, allowsFixed) {
|
||||||
}, size);
|
}, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let [size, allowsFixed] of Object.entries(sizeData)) {
|
for (let size of sizes) {
|
||||||
if (CSS.supports("width", size)) {
|
if (CSS.supports("width", size)) {
|
||||||
|
let allowsFixed = size !== "auto";
|
||||||
checkSize(size, allowsFixed);
|
checkSize(size, allowsFixed);
|
||||||
|
|
||||||
// calc-size() should trigger fixed table layout.
|
// calc-size() should trigger fixed table layout.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue