mirror of
https://github.com/typst/typst
synced 2025-07-27 14:27:56 +08:00
refactor: make TableCell::kind #[parse] instead of #[synthesized]
This commit is contained in:
parent
e8af101a79
commit
e0074d6e39
@ -226,7 +226,7 @@ impl ResolvableCell for Packed<TableCell> {
|
||||
let breakable = cell.breakable.get(styles).unwrap_or(breakable);
|
||||
let fill = cell.fill.get_cloned(styles).unwrap_or_else(|| fill.clone());
|
||||
|
||||
let kind = cell.kind.unwrap_or_default().or(kind);
|
||||
let kind = cell.kind.get(styles).or(kind);
|
||||
|
||||
let cell_stroke = cell.stroke.resolve(styles);
|
||||
let stroke_overridden =
|
||||
@ -271,7 +271,7 @@ impl ResolvableCell for Packed<TableCell> {
|
||||
}),
|
||||
);
|
||||
cell.breakable.set(Smart::Custom(breakable));
|
||||
cell.kind = Some(kind);
|
||||
cell.kind.set(kind);
|
||||
Cell {
|
||||
body: self.pack(),
|
||||
locator,
|
||||
|
@ -688,7 +688,7 @@ pub struct TableCell {
|
||||
pub stroke: Sides<Option<Option<Arc<Stroke>>>>,
|
||||
|
||||
#[internal]
|
||||
#[synthesized]
|
||||
#[parse(Some(Smart::Auto))]
|
||||
pub kind: Smart<TableCellKind>,
|
||||
|
||||
/// Whether rows spanned by this cell can be placed in different pages.
|
||||
|
@ -60,7 +60,7 @@ impl TableCtx {
|
||||
let y = cell.y.get(StyleChain::default()).unwrap_or_else(|| unreachable!());
|
||||
let rowspan = cell.rowspan.get(StyleChain::default());
|
||||
let colspan = cell.colspan.get(StyleChain::default());
|
||||
let kind = cell.kind.expect("kind to be set after layouting");
|
||||
let kind = cell.kind.get(StyleChain::default());
|
||||
|
||||
// Extend the table grid to fit this cell.
|
||||
let required_height = y + rowspan.get();
|
||||
|
Loading…
x
Reference in New Issue
Block a user