ladybird/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
Andreas Kling c9700e100e LibWeb: Start making our layout system "transactional"
This patch adds a map of Layout::Node to FormattingState::NodeState.
Instead of updating layout nodes incrementally as layout progresses
through the formatting contexts, all updates are now written to the
corresponding NodeState instead.

At the end of layout, FormattingState::commit() is called, which
transfers all the values from the NodeState objects to the Node.

This will soon allow us to perform completely non-destructive layouts
which don't affect the tree.

Note that there are many imperfections here, and still many places
where we assign to the NodeState, but later read directly from the Node
instead. I'm just committing at this stage to make subsequent diffs
easier to understand.
2022-02-21 18:35:12 +01:00

27 lines
658 B
C++

/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Forward.h>
#include <LibWeb/Layout/BlockFormattingContext.h>
namespace Web::Layout {
class TableFormattingContext final : public BlockFormattingContext {
public:
explicit TableFormattingContext(FormattingState&, BlockContainer const&, FormattingContext* parent);
~TableFormattingContext();
virtual void run(Box const&, LayoutMode) override;
private:
void calculate_column_widths(Box const& row, Vector<float>& column_widths);
void layout_row(Box const& row, Vector<float>& column_widths);
};
}