TableFormattingContext.h 989 B

123456789101112131415161718192021222324252627282930313233343536
  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(LayoutState&, BlockContainer const&, FormattingContext* parent);
  19. ~TableFormattingContext();
  20. virtual void run(Box const&, LayoutMode, AvailableSpace const&) override;
  21. virtual float automatic_content_height() const override;
  22. private:
  23. void calculate_column_widths(Box const& row, CSS::Length const& table_width, Vector<ColumnWidth>& column_widths, AvailableSpace const&);
  24. void layout_row(Box const& row, Vector<ColumnWidth>& column_widths, AvailableSpace const&);
  25. float m_automatic_content_height { 0 };
  26. };
  27. }