use super::*;
pub(in crate::layout) fn text_align_for_inline_line(
style: &ComputedStyle,
is_last_line: bool,
) -> TextAlign {
if is_last_line {
logical_text_align_last(style)
} else {
style.text_align
}
}
pub(in crate::layout) fn logical_text_align_last(style: &ComputedStyle) -> TextAlign {
match style.text_align_last {
TextAlignLast::Align(align) => align,
TextAlignLast::Auto => match style.text_align {
TextAlign::Justify => TextAlign::Start,
TextAlign::JustifyAll => TextAlign::Justify,
align => align,
},
}
}
pub(in crate::layout) fn text_align_for_inline_line_with_base_direction(
style: &ComputedStyle,
is_last_line: bool,
base_direction: Direction,
) -> TextAlign {
if style.used_direction() == base_direction {
return text_align_for_inline_line(style, is_last_line);
}
let mut effective_style = style.clone();
effective_style.direction = base_direction;
text_align_for_inline_line(&effective_style, is_last_line)
}