1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:07:44 +00:00

LibWeb: Resolve border radius during layout and save it in paintables

This change fixes a problem that we should not call `to_px()` to
resolve any length or percentage values during paintables traversal
because that is supposed to happen while performing layout.

Also it improves performance because before we were resolving border
radii during each painting phase but now it happens only once during
layout.
This commit is contained in:
Aliaksandr Kalenik 2023-12-07 06:16:17 +01:00 committed by Andreas Kling
parent da134f6867
commit d1d6da6ab6
8 changed files with 139 additions and 75 deletions

View file

@ -10,6 +10,7 @@
#include <LibGfx/TextLayout.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibWeb/Forward.h>
#include <LibWeb/Painting/BorderRadiiData.h>
#include <LibWeb/PixelUnits.h>
namespace Web::Layout {
@ -75,6 +76,9 @@ public:
Vector<Gfx::DrawGlyphOrEmoji> const& glyph_run() const { return m_glyph_run; }
Painting::BorderRadiiData const& border_radii_data() const { return m_border_radii_data; }
void set_border_radii_data(Painting::BorderRadiiData const& border_radii_data) { m_border_radii_data = border_radii_data; }
private:
JS::NonnullGCPtr<Node const> m_layout_node;
int m_start { 0 };
@ -85,6 +89,7 @@ private:
CSSPixels m_border_box_bottom { 0 };
CSSPixels m_baseline { 0 };
Vector<Gfx::DrawGlyphOrEmoji> m_glyph_run;
Painting::BorderRadiiData m_border_radii_data;
};
}