1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:47:44 +00:00

LibWeb: Some improvements for painting of collapsed table borders

Follow the specification in making the borders centered on the grid
lines. This avoids visual bugs due to double-rendering of borders on
either side of an edge and paves the way for a full implementation of
the harmonization algorithm for collapsed borders.

Currently, this still lacks complete handling of row and column spans.
Also, the box model for cells still considers the full width of the
internal borders instead of just half, as the specification requires.
Some additional handling of rounding issues will be needed to avoid very
subtle visual bugs.

Despite these limitations, this improves the appearance of all the
tables with collapsed borders I've tried while limiting the amount of
change to something reasonable.
This commit is contained in:
Andi Gallo 2023-07-01 03:06:21 +00:00 committed by Andreas Kling
parent f6d2a21d27
commit f544132fe8
6 changed files with 269 additions and 29 deletions

View file

@ -857,7 +857,7 @@ void TableFormattingContext::position_cell_boxes()
}
}
static bool border_is_less_specific(const CSS::BorderData& a, const CSS::BorderData& b)
bool TableFormattingContext::border_is_less_specific(const CSS::BorderData& a, const CSS::BorderData& b)
{
// Implements criteria for steps 1, 2 and 3 of border conflict resolution algorithm.
static HashMap<CSS::LineStyle, unsigned> const line_style_score = {
@ -900,7 +900,7 @@ static bool border_is_less_specific(const CSS::BorderData& a, const CSS::BorderD
static const CSS::BorderData& winning_border_style(const CSS::BorderData& a, const CSS::BorderData& b)
{
return border_is_less_specific(a, b) ? b : a;
return TableFormattingContext::border_is_less_specific(a, b) ? b : a;
}
const CSS::BorderData& TableFormattingContext::border_data_conflicting_edge(TableFormattingContext::ConflictingEdge const& conflicting_edge)