From b0afe8463add9430bceac0fcede81d06e74344a9 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 13 Jan 2024 12:33:06 +0100 Subject: [PATCH] LibWeb: Make Node::paintable_box() go directly to the paintable No need to go via the layout tree here, that's a vestige of an earlier architecture limitation. --- Userland/Libraries/LibWeb/DOM/Node.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp index 6db39ddb3e..8ed06a3450 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.cpp +++ b/Userland/Libraries/LibWeb/DOM/Node.cpp @@ -43,6 +43,7 @@ #include #include #include +#include namespace Web::DOM { @@ -1521,20 +1522,16 @@ Painting::Paintable* Node::paintable() Painting::PaintableBox const* Node::paintable_box() const { - if (!layout_node()) - return nullptr; - if (!layout_node()->is_box()) - return nullptr; - return static_cast(*layout_node()).paintable_box(); + if (paintable() && paintable()->is_paintable_box()) + return static_cast(paintable()); + return nullptr; } Painting::PaintableBox* Node::paintable_box() { - if (!layout_node()) - return nullptr; - if (!layout_node()->is_box()) - return nullptr; - return static_cast(*layout_node()).paintable_box(); + if (paintable() && paintable()->is_paintable_box()) + return static_cast(paintable()); + return nullptr; } // https://dom.spec.whatwg.org/#queue-a-mutation-record