From 7a34f1a4e295844ce9d757161721b06281870d11 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 17 Jan 2024 12:19:52 +0100 Subject: [PATCH] LibWeb: Add pointer from BFC::FloatingBox to its UsedValues This will allow us to skip a lot more hash lookups. --- Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp | 1 + Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index 701ce3fe82..8a490447aa 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -1058,6 +1058,7 @@ void BlockFormattingContext::layout_floating_box(Box const& box, BlockContainer auto top_margin_edge = y - box_state.margin_box_top(); side_data.all_boxes.append(adopt_own(*new FloatingBox { .box = box, + .used_values = box_state, .offset_from_edge = offset_from_edge, .top_margin_edge = top_margin_edge, .bottom_margin_edge = y + box_state.content_height() + box_state.margin_box_bottom(), diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h index 089d915789..3eb3789657 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h @@ -89,6 +89,9 @@ private: struct FloatingBox { JS::NonnullGCPtr box; + + LayoutState::UsedValues& used_values; + // Offset from left/right edge to the left content edge of `box`. CSSPixels offset_from_edge { 0 };