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