mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 07:33:20 +00:00
LibWeb: Paint inspector overlays as a separate pass
The overlay shown for the node hovered in the inspector is painted as part of the normal tree traversal of all paintables. This works well in most cases, but falls short in specific scenarios: * If the hovered node or one of its ancestors establishes a stacking context and there is another element that establishes a stacking context close by or overlapping it, the overlay and especially the tooltip can become partially hidden behind the second element. Ditto for elements that act as if they established a stacking context. * If the hovered node or one of its ancestors involves clipping, the clip is applied to the overlay and espicially the tooltip. This can cause them to be partially invisible. * Similarly, if the hovered node or one of its ancestors has a defined mask, the mask is applied to the overlay, often making it mostly invisible. * No overlays are shown for SVG nodes because they are painted differently from HTML documents. Some of these problems may be fixable with the current system. But some seem like they fundamentally cannot work fully when the overlays are painted as part of the regular tree traversal. Instead we pull out painting the overlay as a separate pass executed after the tree traversal. This way we ensure that the overlays are always painted last and therefore on top of everything else. This also makes sure that the overlays are unaffected by clips and masks. And since overlay painting is independent from painting the actual elements, it just works as well. However we need to be careful, because we still need to apply some of the steps of the tree traversal to get the correct result. Namely we need to apply scroll offsets and transforms. To do so, we collect all ancestors of the hovered node and apply those as if we were in the normal tree traversal.
This commit is contained in:
parent
870b7c79c3
commit
fbf47e57d0
Notes:
github-actions[bot]
2025-09-19 08:18:59 +00:00
Author: https://github.com/InvalidUsernameException
Commit: fbf47e57d0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6056
Reviewed-by: https://github.com/gmta ✅
7 changed files with 104 additions and 41 deletions
|
@ -274,6 +274,8 @@ protected:
|
|||
virtual void paint_background(DisplayListRecordingContext&) const;
|
||||
virtual void paint_box_shadow(DisplayListRecordingContext&) const;
|
||||
|
||||
virtual void paint_inspector_overlay_internal(DisplayListRecordingContext&) const override;
|
||||
|
||||
virtual CSSPixelRect compute_absolute_rect() const;
|
||||
virtual CSSPixelRect compute_absolute_paint_rect() const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue