LibWeb: Layout inline elements respective of writing-mode

Use the `writing-mode` property to determine what values should be used
for computing each element's rect on the screen. If it is a vertical
mode, swap the inline and block, lengths and offsets.

This only lays out whole inline formatting contexts vertically, and does
not currently support mixing the two orientations in a single context.
This commit is contained in:
BenJilks 2024-10-29 11:32:59 +00:00 committed by Alexander Kalenik
commit 80e7e6dd7d
Notes: github-actions[bot] 2024-11-03 16:03:04 +00:00
9 changed files with 65 additions and 12 deletions

View file

@ -250,9 +250,10 @@ void InlineFormattingContext::generate_line_boxes()
line_boxes.clear_with_capacity();
auto direction = m_context_box->computed_values().direction();
auto writing_mode = m_context_box->computed_values().writing_mode();
InlineLevelIterator iterator(*this, m_state, containing_block(), m_containing_block_used_values, m_layout_mode);
LineBuilder line_builder(*this, m_state, m_containing_block_used_values, direction);
LineBuilder line_builder(*this, m_state, m_containing_block_used_values, direction, writing_mode);
// NOTE: When we ignore collapsible whitespace chunks at the start of a line,
// we have to remember how much start margin that chunk had in the inline