mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibWeb: Size table cells using a combination of min- and max-widths
This gets us a bit closer to the recommended algorithms in CSS 2.2 and CSS Table Module 3. A couple of table heavy websites (e.g. news.ycombinator.com, html5test.com, etc.) now look quite okay. :^)
This commit is contained in:
parent
bc4974648c
commit
7e4793df63
Notes:
sideshowbarker
2024-07-17 16:35:53 +09:00
Author: https://github.com/skyrising
Commit: 7e4793df63
Pull-request: https://github.com/SerenityOS/serenity/pull/13323
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/awesomekling
2 changed files with 78 additions and 32 deletions
|
@ -11,6 +11,13 @@
|
|||
|
||||
namespace Web::Layout {
|
||||
|
||||
struct ColumnWidth {
|
||||
float min { 0 };
|
||||
float max { 0 };
|
||||
float used { 0 };
|
||||
bool is_auto { true };
|
||||
};
|
||||
|
||||
class TableFormattingContext final : public BlockFormattingContext {
|
||||
public:
|
||||
explicit TableFormattingContext(FormattingState&, BlockContainer const&, FormattingContext* parent);
|
||||
|
@ -19,8 +26,8 @@ public:
|
|||
virtual void run(Box const&, LayoutMode) override;
|
||||
|
||||
private:
|
||||
void calculate_column_widths(Box const& row, CSS::Length const& table_width, Vector<float>& column_widths);
|
||||
void layout_row(Box const& row, Vector<float>& column_widths);
|
||||
void calculate_column_widths(Box const& row, CSS::Length const& table_width, Vector<ColumnWidth>& column_widths);
|
||||
void layout_row(Box const& row, Vector<ColumnWidth>& column_widths);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue