mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibWeb: Add {before,after}_children_paint() methods
This allows layout nodes to do some setup before their children paint, and cleanup after their children paint. This will be used for SVG components, where their attributes (like stroke width, fill color, etc) need to be correctly propogated to layout nodes down the line.
This commit is contained in:
parent
236eeb6fb1
commit
0b3b6310ec
Notes:
sideshowbarker
2024-07-19 01:56:28 +09:00
Author: https://github.com/mattco98 Commit: https://github.com/SerenityOS/serenity/commit/0b3b6310ec6 Pull-request: https://github.com/SerenityOS/serenity/pull/3730 Reviewed-by: https://github.com/awesomekling
2 changed files with 7 additions and 0 deletions
|
@ -95,11 +95,15 @@ void LayoutNode::paint(PaintContext& context, PaintPhase phase)
|
|||
if (!is_visible())
|
||||
return;
|
||||
|
||||
before_children_paint(context, phase);
|
||||
|
||||
for_each_child([&](auto& child) {
|
||||
if (child.is_box() && downcast<LayoutBox>(child).stacking_context())
|
||||
return;
|
||||
child.paint(context, phase);
|
||||
});
|
||||
|
||||
after_children_paint(context, phase);
|
||||
}
|
||||
|
||||
HitTestResult LayoutNode::hit_test(const Gfx::IntPoint& position, HitTestType type) const
|
||||
|
|
|
@ -122,7 +122,10 @@ public:
|
|||
FocusOutline,
|
||||
Overlay,
|
||||
};
|
||||
|
||||
virtual void before_children_paint(PaintContext&, PaintPhase) {};
|
||||
virtual void paint(PaintContext&, PaintPhase);
|
||||
virtual void after_children_paint(PaintContext&, PaintPhase) {};
|
||||
|
||||
bool is_floating() const;
|
||||
bool is_absolutely_positioned() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue