mirror of
https://github.com/typst/typst
synced 2025-05-22 13:05:29 +08:00
simplify rowspan simulator construction
This commit is contained in:
parent
daa5f9e9f5
commit
3055697de2
@ -900,18 +900,8 @@ impl GridLayouter<'_> {
|
|||||||
// which, when used and combined with upcoming spanned rows, covers all
|
// which, when used and combined with upcoming spanned rows, covers all
|
||||||
// of the requested rowspan height, we give up.
|
// of the requested rowspan height, we give up.
|
||||||
for _attempt in 0..5 {
|
for _attempt in 0..5 {
|
||||||
let rowspan_simulator = RowspanSimulator::new(
|
let rowspan_simulator =
|
||||||
disambiguator,
|
RowspanSimulator::new(disambiguator, simulated_regions, &self.current);
|
||||||
simulated_regions,
|
|
||||||
// There can be no new headers or footers within a multi-page
|
|
||||||
// rowspan, since headers and footers are unbreakable, so
|
|
||||||
// assuming the repeating header height and footer height
|
|
||||||
// won't change is safe.
|
|
||||||
self.current.repeating_header_height,
|
|
||||||
self.current.footer_height,
|
|
||||||
self.current.could_progress_at_top,
|
|
||||||
self.current.initial_after_repeats,
|
|
||||||
);
|
|
||||||
|
|
||||||
let total_spanned_height = rowspan_simulator.simulate_rowspan_layout(
|
let total_spanned_height = rowspan_simulator.simulate_rowspan_layout(
|
||||||
y,
|
y,
|
||||||
@ -1035,18 +1025,19 @@ impl<'a> RowspanSimulator<'a> {
|
|||||||
fn new(
|
fn new(
|
||||||
finished: usize,
|
finished: usize,
|
||||||
regions: Regions<'a>,
|
regions: Regions<'a>,
|
||||||
header_height: Abs,
|
current: &super::layouter::Current,
|
||||||
footer_height: Abs,
|
|
||||||
could_progress_at_top: bool,
|
|
||||||
initial_after_repeats: Abs,
|
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
finished,
|
finished,
|
||||||
regions,
|
regions,
|
||||||
header_height,
|
// There can be no new headers or footers within a multi-page
|
||||||
footer_height,
|
// rowspan, since headers and footers are unbreakable, so
|
||||||
could_progress_at_top,
|
// assuming the repeating header height and footer height
|
||||||
initial_after_repeats,
|
// won't change is safe.
|
||||||
|
header_height: current.repeating_header_height,
|
||||||
|
footer_height: current.footer_height,
|
||||||
|
could_progress_at_top: current.could_progress_at_top,
|
||||||
|
initial_after_repeats: current.initial_after_repeats,
|
||||||
total_spanned_height: Abs::zero(),
|
total_spanned_height: Abs::zero(),
|
||||||
latest_spanned_gutter_height: Abs::zero(),
|
latest_spanned_gutter_height: Abs::zero(),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user