LibWeb/CSS: Give all style values a visit_edges() method

Having this hidden away in ImageStyleValue meant that
CSSStyleProperties (and anyone else who holds style values) had to know
exactly which types need visiting. This is a footgun waiting to happen,
so make this a virtual method on CSSStyleValue instead.
This commit is contained in:
Sam Atkins 2025-03-26 14:40:23 +00:00
parent c4bb74f40b
commit a2c89f585f
Notes: github-actions[bot] 2025-03-27 11:54:20 +00:00
4 changed files with 9 additions and 3 deletions

View file

@ -18,6 +18,7 @@
#include <AK/Vector.h>
#include <AK/WeakPtr.h>
#include <LibGfx/Color.h>
#include <LibJS/Heap/Cell.h>
#include <LibURL/URL.h>
#include <LibWeb/CSS/Keyword.h>
#include <LibWeb/CSS/Length.h>
@ -369,6 +370,8 @@ public:
[[nodiscard]] int to_font_slope() const;
[[nodiscard]] int to_font_width() const;
virtual void visit_edges(JS::Cell::Visitor&) const { }
virtual bool equals(CSSStyleValue const& other) const = 0;
bool operator==(CSSStyleValue const& other) const