mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +00:00
Text selection currently works at the LayoutNode level. The root of the layout tree has a LayoutRange selection() which in turn has two LayoutPosition objects: start() and end(). A LayoutPosition is a LayoutNode + a text offset into that node. We handle the selection painting in LayoutText::paint_fragment(), after the normal painting is finished. The basic mechanism is that each LayoutFragment is queried for its selection_rect(), and if a non-empty rect is returned, we clip to it and paint the text once more.
11 KiB
11 KiB