mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
some additional docs
This commit is contained in:
parent
9c49bd507a
commit
ab852a5151
@ -116,6 +116,9 @@ pub(super) struct Current {
|
|||||||
/// before all header rows are fully laid out. It is usually fine because
|
/// before all header rows are fully laid out. It is usually fine because
|
||||||
/// header rows themselves are unbreakable, and unbreakable rows do not
|
/// header rows themselves are unbreakable, and unbreakable rows do not
|
||||||
/// need to read this field at all.
|
/// need to read this field at all.
|
||||||
|
///
|
||||||
|
/// This height is not only computed at the beginning of the region. It is
|
||||||
|
/// updated whenever a new header is found.
|
||||||
pub(super) header_height: Abs,
|
pub(super) header_height: Abs,
|
||||||
/// The height of effectively repeating headers, that is, ignoring
|
/// The height of effectively repeating headers, that is, ignoring
|
||||||
/// non-repeating pending headers.
|
/// non-repeating pending headers.
|
||||||
@ -264,6 +267,14 @@ impl<'a> GridLayouter<'a> {
|
|||||||
// longer orphans and can repeat, so we move them to repeating
|
// longer orphans and can repeat, so we move them to repeating
|
||||||
// headers.
|
// headers.
|
||||||
self.flush_pending_headers();
|
self.flush_pending_headers();
|
||||||
|
//
|
||||||
|
// Note that this is usually done in `push_row`, since the call to
|
||||||
|
// `layout_row` above might trigger region breaks (for multi-page
|
||||||
|
// auto rows), whereas this needs to be called as soon as any part
|
||||||
|
// of a row is laid out. However, it's possible a row has no
|
||||||
|
// visible output and thus does not push any rows even though it
|
||||||
|
// was successfully laid out, in which case we additionally flush
|
||||||
|
// here just in case.
|
||||||
|
|
||||||
y += 1;
|
y += 1;
|
||||||
}
|
}
|
||||||
|
@ -139,6 +139,9 @@ impl<'a> GridLayouter<'a> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Indicates all currently pending headers have been successfully placed
|
||||||
|
/// once, since another row has been placed after them, so they are
|
||||||
|
/// certainly not orphans.
|
||||||
pub fn flush_pending_headers(&mut self) {
|
pub fn flush_pending_headers(&mut self) {
|
||||||
for header in self.pending_headers {
|
for header in self.pending_headers {
|
||||||
if let Repeatable::Repeated(header) = header {
|
if let Repeatable::Repeated(header) = header {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user