mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibWeb: Delete root pointer in LayoutState
It's no longer needed after we moved intrinsic sizes cache into layout nodes.
This commit is contained in:
parent
63249ba96a
commit
733d124380
Notes:
github-actions[bot]
2025-03-14 00:28:41 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 733d124380
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3928
Reviewed-by: https://github.com/gmta ✅
2 changed files with 1 additions and 15 deletions
|
@ -9,7 +9,6 @@
|
||||||
#include <AK/Debug.h>
|
#include <AK/Debug.h>
|
||||||
#include <LibWeb/DOM/ShadowRoot.h>
|
#include <LibWeb/DOM/ShadowRoot.h>
|
||||||
#include <LibWeb/Layout/AvailableSpace.h>
|
#include <LibWeb/Layout/AvailableSpace.h>
|
||||||
#include <LibWeb/Layout/BlockContainer.h>
|
|
||||||
#include <LibWeb/Layout/InlineNode.h>
|
#include <LibWeb/Layout/InlineNode.h>
|
||||||
#include <LibWeb/Layout/LayoutState.h>
|
#include <LibWeb/Layout/LayoutState.h>
|
||||||
#include <LibWeb/Layout/Viewport.h>
|
#include <LibWeb/Layout/Viewport.h>
|
||||||
|
@ -21,7 +20,6 @@ namespace Web::Layout {
|
||||||
|
|
||||||
LayoutState::LayoutState(LayoutState const* parent)
|
LayoutState::LayoutState(LayoutState const* parent)
|
||||||
: m_parent(parent)
|
: m_parent(parent)
|
||||||
, m_root(find_root())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,22 +55,11 @@ struct StaticPositionRect {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LayoutState {
|
struct LayoutState {
|
||||||
LayoutState()
|
LayoutState() = default;
|
||||||
: m_root(*this)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit LayoutState(LayoutState const* parent);
|
explicit LayoutState(LayoutState const* parent);
|
||||||
~LayoutState();
|
~LayoutState();
|
||||||
|
|
||||||
LayoutState const& find_root() const
|
|
||||||
{
|
|
||||||
LayoutState const* root = this;
|
|
||||||
for (auto* state = m_parent; state; state = state->m_parent)
|
|
||||||
root = state;
|
|
||||||
return *root;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct UsedValues {
|
struct UsedValues {
|
||||||
NodeWithStyle const& node() const { return *m_node; }
|
NodeWithStyle const& node() const { return *m_node; }
|
||||||
NodeWithStyle& node() { return const_cast<NodeWithStyle&>(*m_node); }
|
NodeWithStyle& node() { return const_cast<NodeWithStyle&>(*m_node); }
|
||||||
|
@ -222,7 +211,6 @@ struct LayoutState {
|
||||||
HashMap<GC::Ref<Layout::Node const>, NonnullOwnPtr<UsedValues>> used_values_per_layout_node;
|
HashMap<GC::Ref<Layout::Node const>, NonnullOwnPtr<UsedValues>> used_values_per_layout_node;
|
||||||
|
|
||||||
LayoutState const* m_parent { nullptr };
|
LayoutState const* m_parent { nullptr };
|
||||||
LayoutState const& m_root;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void resolve_relative_positions();
|
void resolve_relative_positions();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue