diff --git a/Libraries/LibWeb/Layout/LayoutState.cpp b/Libraries/LibWeb/Layout/LayoutState.cpp index 8c3e3e18475..44b11a941d4 100644 --- a/Libraries/LibWeb/Layout/LayoutState.cpp +++ b/Libraries/LibWeb/Layout/LayoutState.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -21,7 +20,6 @@ namespace Web::Layout { LayoutState::LayoutState(LayoutState const* parent) : m_parent(parent) - , m_root(find_root()) { } diff --git a/Libraries/LibWeb/Layout/LayoutState.h b/Libraries/LibWeb/Layout/LayoutState.h index 3b72d989f1d..dd913fbd3bf 100644 --- a/Libraries/LibWeb/Layout/LayoutState.h +++ b/Libraries/LibWeb/Layout/LayoutState.h @@ -55,22 +55,11 @@ struct StaticPositionRect { }; struct LayoutState { - LayoutState() - : m_root(*this) - { - } + LayoutState() = default; explicit LayoutState(LayoutState const* parent); ~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 { NodeWithStyle const& node() const { return *m_node; } NodeWithStyle& node() { return const_cast(*m_node); } @@ -222,7 +211,6 @@ struct LayoutState { HashMap, NonnullOwnPtr> used_values_per_layout_node; LayoutState const* m_parent { nullptr }; - LayoutState const& m_root; private: void resolve_relative_positions();