2020-11-22 09:38:18 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-11-22 09:38:18 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/Forward.h>
|
|
|
|
|
#include <LibWeb/Layout/BlockFormattingContext.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::Layout {
|
|
|
|
|
|
2022-03-28 19:10:59 -03:00
|
|
|
struct ColumnWidth {
|
|
|
|
|
float min { 0 };
|
|
|
|
|
float max { 0 };
|
|
|
|
|
float used { 0 };
|
|
|
|
|
bool is_auto { true };
|
|
|
|
|
};
|
|
|
|
|
|
2020-11-22 09:38:18 -03:00
|
|
|
class TableFormattingContext final : public BlockFormattingContext {
|
|
|
|
|
public:
|
2022-07-16 18:30:32 -03:00
|
|
|
explicit TableFormattingContext(LayoutState&, BlockContainer const&, FormattingContext* parent);
|
2020-11-22 09:38:18 -03:00
|
|
|
~TableFormattingContext();
|
|
|
|
|
|
2022-02-20 11:51:24 -03:00
|
|
|
virtual void run(Box const&, LayoutMode) override;
|
2022-09-24 08:39:43 -03:00
|
|
|
virtual float automatic_content_height() const override;
|
2020-11-22 09:38:18 -03:00
|
|
|
|
|
|
|
|
private:
|
2022-03-28 19:10:59 -03:00
|
|
|
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);
|
2022-09-24 08:39:43 -03:00
|
|
|
|
|
|
|
|
float m_automatic_content_height { 0 };
|
2020-11-22 09:38:18 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|