TableFormattingContext.h 818 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Forward.h>
  8. #include <LibWeb/Layout/BlockFormattingContext.h>
  9. namespace Web::Layout {
  10. struct ColumnWidth {
  11. float min { 0 };
  12. float max { 0 };
  13. float used { 0 };
  14. bool is_auto { true };
  15. };
  16. class TableFormattingContext final : public BlockFormattingContext {
  17. public:
  18. explicit TableFormattingContext(FormattingState&, BlockContainer const&, FormattingContext* parent);
  19. ~TableFormattingContext();
  20. virtual void run(Box const&, LayoutMode) override;
  21. private:
  22. void calculate_column_widths(Box const& row, CSS::Length const& table_width, Vector<ColumnWidth>& column_widths);
  23. void layout_row(Box const& row, Vector<ColumnWidth>& column_widths);
  24. };
  25. }