1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:37: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/Viewport.h>
#include <LibWeb/Painting/Paintable.h>
#include <LibWeb/Painting/PaintableBox.h>
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::Box const&>(*layout_node()).paintable_box();
if (paintable() && paintable()->is_paintable_box())
return static_cast<Painting::PaintableBox const*>(paintable());
return nullptr;
}
Painting::PaintableBox* Node::paintable_box()
{
if (!layout_node())
return nullptr;
if (!layout_node()->is_box())
return nullptr;
return static_cast<Layout::Box&>(*layout_node()).paintable_box();
if (paintable() && paintable()->is_paintable_box())
return static_cast<Painting::PaintableBox*>(paintable());
return nullptr;
}
// https://dom.spec.whatwg.org/#queue-a-mutation-record