use crate::model::{paragraph::LineSeg, table::Table};
use super::LayoutEngine;
impl LayoutEngine {
pub(crate) fn unresolved_row_default_hu(table: &Table, row: usize, stored: bool) -> i32 {
if !stored || table.col_count == 0 || row >= usize::from(table.row_count) {
return 400;
}
let mut columns = vec![false; usize::from(table.col_count)];
for cell in &table.cells {
let start = usize::from(cell.row);
let end = start + usize::from(cell.row_span);
if !(start <= row && row < end) {
continue;
}
let col = usize::from(cell.col);
let col_end = col + usize::from(cell.col_span);
if cell.row_span <= 1
|| cell.dirty_flag
|| cell.text_direction != 0
|| cell.col_span == 0
|| end > usize::from(table.row_count)
|| col_end > columns.len()
|| cell.paragraphs.is_empty()
|| cell.paragraphs.iter().any(|para| {
para.stored_text_partition_is_dirty()
|| para.cell_format_vpos_dirty
|| !para.controls.is_empty()
|| para.line_segs.is_empty()
|| para.line_segs.iter().any(|line| {
line.line_height <= 0
|| line.tag & LineSeg::TAG_IMPLEMENTATION_PROPERTY != 0
})
})
|| columns[col..col_end].iter().any(|owned| *owned)
{
return 400;
}
columns[col..col_end].fill(true);
}
if columns.into_iter().all(|owned| owned) {
100
} else {
400
}
}
}