1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:37:34 +00:00

LibWeb: Don't draw text fragments that would be clipped by the painter

This avoids a ton of work when painting large documents. Even though it
would eventually get clipped by the painter anyway, by bailing out
earlier, we avoid a lot more work (UTF-8 iteration, OpenType lookups,
etc).

It would be even nicer if we could skip entire line boxes, but we don't
have a fast way to get the bounding rect of a line box at the moment.
This commit is contained in:
Andreas Kling 2023-05-23 11:27:16 +02:00
parent df1bb0ff49
commit fe92b54137
3 changed files with 13 additions and 2 deletions

View file

@ -35,6 +35,8 @@ public:
void set_device_viewport_rect(DevicePixelRect const& rect) { m_device_viewport_rect = rect; }
CSSPixelRect css_viewport_rect() const;
[[nodiscard]] bool would_be_fully_clipped_by_painter(DevicePixelRect) const;
bool has_focus() const { return m_focus; }
void set_has_focus(bool focus) { m_focus = focus; }