blob: 2d4d25f34fa7212bcb61447bb4271f569d798fee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Forward.h>
#include <LibWeb/Layout/FormattingContext.h>
namespace Web::Layout {
class TableFormattingContext final : public FormattingContext {
public:
explicit TableFormattingContext(LayoutState&, BlockContainer const&, FormattingContext* parent);
~TableFormattingContext();
virtual void run(Box const&, LayoutMode, AvailableSpace const&) override;
virtual CSSPixels automatic_content_height() const override;
private:
void calculate_row_column_grid(Box const&);
void compute_table_measures();
void compute_table_width(CSSPixels&);
void distribute_width_to_columns(CSSPixels extra_width);
void determine_intrisic_size_of_table_container(AvailableSpace const& available_space);
CSSPixels m_automatic_content_height { 0 };
Optional<AvailableSpace> m_available_space;
struct Column {
CSSPixels left_offset { 0 };
CSSPixels min_width { 0 };
CSSPixels max_width { 0 };
CSSPixels used_width { 0 };
};
struct Row {
Box& box;
CSSPixels used_width { 0 };
CSSPixels baseline { 0 };
};
struct Cell {
Box& box;
size_t column_index;
size_t row_index;
size_t column_span;
size_t row_span;
CSSPixels baseline { 0 };
};
Vector<Cell> m_cells;
Vector<Column> m_columns;
Vector<Row> m_rows;
};
}
|