1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:57:45 +00:00

LibWeb: Refactor text justification code + only justify below threshold

All the justification-related code is now in
InlineFormattingContext::apply_justification_to_fragments and is
performed after all the line boxes have been added.

Text justification now only happens on the last line if the excess space
including whitespace is below a certain threshold. 10% seemed reasonable
since it prevents the "over-justification" of text. Note that fragments
in line boxes before the last one are always justified.
This commit is contained in:
sin-ack 2022-03-12 17:01:06 +00:00 committed by Andreas Kling
parent f0a1ab6f84
commit 7fe3f2d970
3 changed files with 53 additions and 26 deletions

View file

@ -36,6 +36,7 @@ public:
private:
void generate_line_boxes(LayoutMode);
void apply_justification_to_fragments(FormattingState::NodeState const& containing_block_state, LineBox&, bool is_last_line);
};
}