mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Fix and unify 'span' attribute for table columns (#32467)
The attribute was only taken into account on columns that are immediate children of tables, and on column groups. It was ignored on columns within column groups. This patch moves the logic into a helper function that is then called from the three consumers.
This commit is contained in:
parent
712f751d48
commit
6f414df867
22 changed files with 41 additions and 78 deletions
|
@ -777,20 +777,12 @@ where
|
|||
::std::mem::forget(box_slot)
|
||||
},
|
||||
DisplayLayoutInternal::TableColumn => {
|
||||
let span = info
|
||||
.node
|
||||
.and_then(|node| node.to_threadsafe().get_span())
|
||||
.unwrap_or(1)
|
||||
.min(1000);
|
||||
|
||||
for _ in 0..span + 1 {
|
||||
self.builder.table.columns.push(TableTrack {
|
||||
base_fragment_info: info.into(),
|
||||
style: info.style.clone(),
|
||||
group_index: None,
|
||||
is_anonymous: false,
|
||||
})
|
||||
}
|
||||
add_column(
|
||||
&mut self.builder.table.columns,
|
||||
info,
|
||||
None, /* group_index */
|
||||
false, /* is_anonymous */
|
||||
);
|
||||
|
||||
// We are doing this until we have actually set a Box for this `BoxSlot`.
|
||||
::std::mem::forget(box_slot)
|
||||
|
@ -810,20 +802,11 @@ where
|
|||
|
||||
let first_column = self.builder.table.columns.len();
|
||||
if column_group_builder.columns.is_empty() {
|
||||
let span = info
|
||||
.node
|
||||
.and_then(|node| node.to_threadsafe().get_span())
|
||||
.unwrap_or(1)
|
||||
.min(1000) as usize;
|
||||
|
||||
self.builder.table.columns.extend(
|
||||
repeat(TableTrack {
|
||||
base_fragment_info: info.into(),
|
||||
style: info.style.clone(),
|
||||
group_index: Some(column_group_index),
|
||||
is_anonymous: true,
|
||||
})
|
||||
.take(span),
|
||||
add_column(
|
||||
&mut self.builder.table.columns,
|
||||
info,
|
||||
Some(column_group_index),
|
||||
true, /* is_anonymous */
|
||||
);
|
||||
} else {
|
||||
self.builder
|
||||
|
@ -1068,12 +1051,12 @@ where
|
|||
) {
|
||||
return;
|
||||
}
|
||||
self.columns.push(TableTrack {
|
||||
base_fragment_info: info.into(),
|
||||
style: info.style.clone(),
|
||||
group_index: Some(self.column_group_index),
|
||||
is_anonymous: false,
|
||||
});
|
||||
add_column(
|
||||
&mut self.columns,
|
||||
info,
|
||||
Some(self.column_group_index),
|
||||
false, /* is_anonymous */
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1088,3 +1071,27 @@ impl From<DisplayLayoutInternal> for TableTrackGroupType {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn add_column<'dom, Node>(
|
||||
collection: &mut Vec<TableTrack>,
|
||||
column_info: &NodeAndStyleInfo<Node>,
|
||||
group_index: Option<usize>,
|
||||
is_anonymous: bool,
|
||||
) where
|
||||
Node: NodeExt<'dom>,
|
||||
{
|
||||
let span = column_info
|
||||
.node
|
||||
.and_then(|node| node.to_threadsafe().get_span())
|
||||
.map_or(1, |span| span.min(1000) as usize);
|
||||
|
||||
collection.extend(
|
||||
repeat(TableTrack {
|
||||
base_fragment_info: column_info.into(),
|
||||
style: column_info.style.clone(),
|
||||
group_index,
|
||||
is_anonymous,
|
||||
})
|
||||
.take(span),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
[background-applies-to-006.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[background-color-applies-to-006.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[background-image-applies-to-006.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[background-position-applies-to-006.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[background-position-applies-to-006a.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[background-repeat-applies-to-006.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[containing-block-029.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[display-013.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[c414-flt-fit-000.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[vertical-align-baseline-003.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[width-applies-to-006.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[fixed-table-layout-017.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[fixed-table-layout-018.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[fixed-table-layout-019.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[fixed-table-layout-020.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[fixed-table-layout-021.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[fixed-table-layout-022.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[fixed-table-layout-023.xht]
|
||||
expected: FAIL
|
|
@ -1,2 +0,0 @@
|
|||
[col-change-span-bg-invalidation-001.html]
|
||||
expected: FAIL
|
|
@ -1,3 +0,0 @@
|
|||
[visibility-collapse-col-005.html]
|
||||
[col visibility:collapse changes table width]
|
||||
expected: FAIL
|
|
@ -1,3 +0,0 @@
|
|||
[visibility-collapse-rowcol-002.html]
|
||||
[spanning row visibility:collapse doesn't change table width]
|
||||
expected: FAIL
|
Loading…
Add table
Add a link
Reference in a new issue