mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:37:35 +00:00
LibWeb: Virtualize Layout::Node::paint_fragment()
LineBoxFragment no longer needs to care what type of layout node a fragment refers to during paint, it can just call paint_fragment(). :^)
This commit is contained in:
parent
c189897e29
commit
f35b406dfb
4 changed files with 4 additions and 8 deletions
|
@ -36,7 +36,7 @@ public:
|
||||||
virtual ~InlineNode() override;
|
virtual ~InlineNode() override;
|
||||||
virtual const char* class_name() const override { return "InlineNode"; }
|
virtual const char* class_name() const override { return "InlineNode"; }
|
||||||
|
|
||||||
void paint_fragment(PaintContext&, const LineBoxFragment&, PaintPhase) const;
|
virtual void paint_fragment(PaintContext&, const LineBoxFragment&, PaintPhase) const override;
|
||||||
|
|
||||||
virtual void split_into_lines(BlockBox& containing_block, LayoutMode) override;
|
virtual void split_into_lines(BlockBox& containing_block, LayoutMode) override;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include <LibWeb/Layout/InitialContainingBlockBox.h>
|
#include <LibWeb/Layout/InitialContainingBlockBox.h>
|
||||||
#include <LibWeb/Layout/LineBoxFragment.h>
|
#include <LibWeb/Layout/LineBoxFragment.h>
|
||||||
#include <LibWeb/Layout/TextNode.h>
|
#include <LibWeb/Layout/TextNode.h>
|
||||||
#include <LibWeb/Layout/InlineNode.h>
|
|
||||||
#include <LibWeb/Painting/PaintContext.h>
|
#include <LibWeb/Painting/PaintContext.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
@ -42,11 +41,7 @@ void LineBoxFragment::paint(PaintContext& context, PaintPhase phase)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is<InlineNode>(layout_node()))
|
layout_node().paint_fragment(context, *this, phase);
|
||||||
downcast<InlineNode>(layout_node()).paint_fragment(context, *this, phase);
|
|
||||||
|
|
||||||
if (is<TextNode>(layout_node()))
|
|
||||||
downcast<TextNode>(layout_node()).paint_fragment(context, *this, phase);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LineBoxFragment::ends_in_whitespace() const
|
bool LineBoxFragment::ends_in_whitespace() const
|
||||||
|
|
|
@ -127,6 +127,7 @@ public:
|
||||||
|
|
||||||
virtual void before_children_paint(PaintContext&, PaintPhase) {};
|
virtual void before_children_paint(PaintContext&, PaintPhase) {};
|
||||||
virtual void paint(PaintContext&, PaintPhase);
|
virtual void paint(PaintContext&, PaintPhase);
|
||||||
|
virtual void paint_fragment(PaintContext&, const LineBoxFragment&, PaintPhase) const { }
|
||||||
virtual void after_children_paint(PaintContext&, PaintPhase) {};
|
virtual void after_children_paint(PaintContext&, PaintPhase) {};
|
||||||
|
|
||||||
bool is_floating() const;
|
bool is_floating() const;
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
virtual const char* class_name() const override { return "TextNode"; }
|
virtual const char* class_name() const override { return "TextNode"; }
|
||||||
virtual bool is_text() const final { return true; }
|
virtual bool is_text() const final { return true; }
|
||||||
|
|
||||||
void paint_fragment(PaintContext&, const LineBoxFragment&, PaintPhase) const;
|
virtual void paint_fragment(PaintContext&, const LineBoxFragment&, PaintPhase) const override;
|
||||||
|
|
||||||
virtual void split_into_lines(BlockBox& container, LayoutMode) override;
|
virtual void split_into_lines(BlockBox& container, LayoutMode) override;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue