1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:17:34 +00:00

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.
This commit is contained in:
Andreas Kling 2024-01-13 12:33:06 +01:00
parent e6861cb5ef
commit b0afe8463a

View file

@ -43,6 +43,7 @@
#include <LibWeb/Layout/TextNode.h> #include <LibWeb/Layout/TextNode.h>
#include <LibWeb/Layout/Viewport.h> #include <LibWeb/Layout/Viewport.h>
#include <LibWeb/Painting/Paintable.h> #include <LibWeb/Painting/Paintable.h>
#include <LibWeb/Painting/PaintableBox.h>
namespace Web::DOM { namespace Web::DOM {
@ -1521,20 +1522,16 @@ Painting::Paintable* Node::paintable()
Painting::PaintableBox const* Node::paintable_box() const Painting::PaintableBox const* Node::paintable_box() const
{ {
if (!layout_node()) if (paintable() && paintable()->is_paintable_box())
return nullptr; return static_cast<Painting::PaintableBox const*>(paintable());
if (!layout_node()->is_box()) return nullptr;
return nullptr;
return static_cast<Layout::Box const&>(*layout_node()).paintable_box();
} }
Painting::PaintableBox* Node::paintable_box() Painting::PaintableBox* Node::paintable_box()
{ {
if (!layout_node()) if (paintable() && paintable()->is_paintable_box())
return nullptr; return static_cast<Painting::PaintableBox*>(paintable());
if (!layout_node()->is_box()) return nullptr;
return nullptr;
return static_cast<Layout::Box&>(*layout_node()).paintable_box();
} }
// https://dom.spec.whatwg.org/#queue-a-mutation-record // https://dom.spec.whatwg.org/#queue-a-mutation-record