From c51a4cc0075d0c25ee8c4ce1366a6fec532dd14d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 17 Mar 2024 19:11:50 +0100 Subject: [PATCH] LibWeb: Detach paintables from *all* DOM nodes before committing layout Before this change, we were not detaching paintables from DOM nodes within shadow subtrees. This appears to be the main reason that keyboard editing was doing immediate forced relayout: doing a full layout invalidation meant we'd build a new layout tree, which then hid the problem with with still-attached paintables. By detaching them before committing a new layout, we make it possible for keyboard editing to just use normal relayout, instead of full forced invalidation & relayout. --- Userland/Libraries/LibWeb/Layout/LayoutState.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp index 115b7b10ac6..775877c304a 100644 --- a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp +++ b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp @@ -1,11 +1,12 @@ /* - * Copyright (c) 2022-2023, Andreas Kling + * Copyright (c) 2022-2024, Andreas Kling * Copyright (c) 2024, Sam Atkins * * SPDX-License-Identifier: BSD-2-Clause */ #include +#include #include #include #include @@ -209,6 +210,10 @@ void LayoutState::commit(Box& root) node.set_paintable(nullptr); return IterationDecision::Continue; }); + root.document().for_each_shadow_including_inclusive_descendant([&](DOM::Node& node) { + node.set_paintable(nullptr); + return IterationDecision::Continue; + }); HashTable text_nodes;