mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
LibWeb: Make Layout::Node::paint() pure virtual
In the past, the base class implementation of this was used to descend into subtrees and paint children. That is now taken care of by StackingContext::paint_descendants() instead, and nothing used this.
This commit is contained in:
parent
eac31e21f2
commit
28fabd4728
6 changed files with 12 additions and 15 deletions
|
@ -26,4 +26,8 @@ void BreakNode::split_into_lines(InlineFormattingContext& context, LayoutMode)
|
||||||
line_box.add_fragment(*this, 0, 0, 0, context.containing_block().line_height());
|
line_box.add_fragment(*this, 0, 0, 0, context.containing_block().line_height());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BreakNode::paint(PaintContext&, PaintPhase)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@ public:
|
||||||
const HTML::HTMLBRElement& dom_node() const { return verify_cast<HTML::HTMLBRElement>(*Node::dom_node()); }
|
const HTML::HTMLBRElement& dom_node() const { return verify_cast<HTML::HTMLBRElement>(*Node::dom_node()); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
virtual void paint(PaintContext&, PaintPhase) override;
|
||||||
|
|
||||||
virtual void split_into_lines(InlineFormattingContext&, LayoutMode) override;
|
virtual void split_into_lines(InlineFormattingContext&, LayoutMode) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -83,20 +83,6 @@ bool Node::establishes_stacking_context() const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::paint(PaintContext& context, PaintPhase phase)
|
|
||||||
{
|
|
||||||
if (!is_visible())
|
|
||||||
return;
|
|
||||||
|
|
||||||
before_children_paint(context, phase);
|
|
||||||
|
|
||||||
for_each_child_in_paint_order([&](auto& child) {
|
|
||||||
child.paint(context, phase);
|
|
||||||
});
|
|
||||||
|
|
||||||
after_children_paint(context, phase);
|
|
||||||
}
|
|
||||||
|
|
||||||
HitTestResult Node::hit_test(const Gfx::IntPoint& position, HitTestType type) const
|
HitTestResult Node::hit_test(const Gfx::IntPoint& position, HitTestType type) const
|
||||||
{
|
{
|
||||||
HitTestResult result;
|
HitTestResult result;
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
virtual bool handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned buttons, unsigned modifiers, int wheel_delta);
|
virtual bool handle_mousewheel(Badge<EventHandler>, const Gfx::IntPoint&, unsigned buttons, unsigned modifiers, int wheel_delta);
|
||||||
|
|
||||||
virtual void before_children_paint(PaintContext&, PaintPhase) {};
|
virtual void before_children_paint(PaintContext&, PaintPhase) {};
|
||||||
virtual void paint(PaintContext&, PaintPhase);
|
virtual void paint(PaintContext&, PaintPhase) = 0;
|
||||||
virtual void paint_fragment(PaintContext&, const LineBoxFragment&, PaintPhase) const { }
|
virtual void paint_fragment(PaintContext&, const LineBoxFragment&, PaintPhase) const { }
|
||||||
virtual void after_children_paint(PaintContext&, PaintPhase) {};
|
virtual void after_children_paint(PaintContext&, PaintPhase) {};
|
||||||
|
|
||||||
|
|
|
@ -414,4 +414,8 @@ Optional<TextNode::Chunk> TextNode::ChunkIterator::try_commit_chunk(Utf8View::It
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextNode::paint(PaintContext&, PaintPhase)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ private:
|
||||||
void split_into_lines_by_rules(InlineFormattingContext&, LayoutMode, bool do_collapse, bool do_wrap_lines, bool do_respect_linebreaks);
|
void split_into_lines_by_rules(InlineFormattingContext&, LayoutMode, bool do_collapse, bool do_wrap_lines, bool do_respect_linebreaks);
|
||||||
void paint_cursor_if_needed(PaintContext&, const LineBoxFragment&) const;
|
void paint_cursor_if_needed(PaintContext&, const LineBoxFragment&) const;
|
||||||
void paint_text_decoration(Gfx::Painter&, LineBoxFragment const&) const;
|
void paint_text_decoration(Gfx::Painter&, LineBoxFragment const&) const;
|
||||||
|
virtual void paint(PaintContext&, PaintPhase) override;
|
||||||
|
|
||||||
String m_text_for_rendering;
|
String m_text_for_rendering;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue