diff options
-rw-r--r-- | Libraries/LibWeb/Layout/InlineNode.h | 2 | ||||
-rw-r--r-- | Libraries/LibWeb/Layout/LineBoxFragment.cpp | 7 | ||||
-rw-r--r-- | Libraries/LibWeb/Layout/Node.h | 1 | ||||
-rw-r--r-- | Libraries/LibWeb/Layout/TextNode.h | 2 |
4 files changed, 4 insertions, 8 deletions
diff --git a/Libraries/LibWeb/Layout/InlineNode.h b/Libraries/LibWeb/Layout/InlineNode.h index 91a74a9caa..a140339599 100644 --- a/Libraries/LibWeb/Layout/InlineNode.h +++ b/Libraries/LibWeb/Layout/InlineNode.h @@ -36,7 +36,7 @@ public: virtual ~InlineNode() override; 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; diff --git a/Libraries/LibWeb/Layout/LineBoxFragment.cpp b/Libraries/LibWeb/Layout/LineBoxFragment.cpp index 8e589469ff..af24ce2c38 100644 --- a/Libraries/LibWeb/Layout/LineBoxFragment.cpp +++ b/Libraries/LibWeb/Layout/LineBoxFragment.cpp @@ -29,7 +29,6 @@ #include <LibWeb/Layout/InitialContainingBlockBox.h> #include <LibWeb/Layout/LineBoxFragment.h> #include <LibWeb/Layout/TextNode.h> -#include <LibWeb/Layout/InlineNode.h> #include <LibWeb/Painting/PaintContext.h> #include <ctype.h> @@ -42,11 +41,7 @@ void LineBoxFragment::paint(PaintContext& context, PaintPhase phase) return; } - if (is<InlineNode>(layout_node())) - downcast<InlineNode>(layout_node()).paint_fragment(context, *this, phase); - - if (is<TextNode>(layout_node())) - downcast<TextNode>(layout_node()).paint_fragment(context, *this, phase); + layout_node().paint_fragment(context, *this, phase); } bool LineBoxFragment::ends_in_whitespace() const diff --git a/Libraries/LibWeb/Layout/Node.h b/Libraries/LibWeb/Layout/Node.h index 27809be760..07968f1e34 100644 --- a/Libraries/LibWeb/Layout/Node.h +++ b/Libraries/LibWeb/Layout/Node.h @@ -127,6 +127,7 @@ public: virtual void before_children_paint(PaintContext&, PaintPhase) {}; virtual void paint(PaintContext&, PaintPhase); + virtual void paint_fragment(PaintContext&, const LineBoxFragment&, PaintPhase) const { } virtual void after_children_paint(PaintContext&, PaintPhase) {}; bool is_floating() const; diff --git a/Libraries/LibWeb/Layout/TextNode.h b/Libraries/LibWeb/Layout/TextNode.h index 298acfd58a..389cf0f3e8 100644 --- a/Libraries/LibWeb/Layout/TextNode.h +++ b/Libraries/LibWeb/Layout/TextNode.h @@ -46,7 +46,7 @@ public: virtual const char* class_name() const override { return "TextNode"; } 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; |