1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:37:46 +00:00

LibWeb: Port inline elements to the new Paintable system

This patch adds InlinePaintable which corresponds to Layout::InlineNode.
This commit is contained in:
Andreas Kling 2022-03-10 15:38:34 +01:00
parent 053766d79c
commit aae356baf1
7 changed files with 184 additions and 126 deletions

View file

@ -9,7 +9,6 @@
#include <LibGfx/Painter.h>
#include <LibWeb/Layout/Box.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Layout/InlineNode.h>
#include <LibWeb/Layout/ReplacedBox.h>
#include <LibWeb/Painting/Paintable.h>
#include <LibWeb/Painting/StackingContext.h>
@ -18,11 +17,8 @@ namespace Web::Painting {
static void paint_node(Layout::Node const& layout_node, PaintContext& context, PaintPhase phase)
{
// FIXME: This whole thing is hairy. Find a nicer solution for painting InlineNode.
if (layout_node.is_box())
static_cast<Layout::Box const&>(layout_node).paint_box()->paint(context, phase);
else if (is<Layout::InlineNode>(layout_node))
static_cast<Layout::InlineNode const&>(layout_node).paint_inline(context, phase);
if (auto const* paintable = layout_node.paintable())
paintable->paint(context, phase);
}
StackingContext::StackingContext(Layout::Box& box, StackingContext* parent)