mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-16 21:20:18 +00:00
LibWeb/CSS: Store StyleValue pointer instead of string on CSSStyleValue
When setting style to a CSSStyleValue we need to convert it to a StyleValue. If we already have one, we might as well use it avoid the work of serialization and re-parsing. I realised I misunderstood what "constructed from a USVString" means, so I've adjusted based on that. It does raise a question on what the source USVString is if that string resulted in multiple CSSStyleValues being created - see the linked issue.
This commit is contained in:
parent
1e1752b33b
commit
2de4fe8104
Notes:
github-actions[bot]
2025-10-04 20:58:33 +00:00
Author: https://github.com/AtkinsSJ
Commit: 2de4fe8104
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6370
6 changed files with 40 additions and 24 deletions
|
@ -16,18 +16,16 @@ class CSSImageValue final : public CSSStyleValue {
|
|||
GC_DECLARE_ALLOCATOR(CSSImageValue);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static GC::Ref<CSSImageValue> create(JS::Realm&, String constructed_from_string);
|
||||
[[nodiscard]] static GC::Ref<CSSImageValue> create(JS::Realm&, NonnullRefPtr<StyleValue const> source_value);
|
||||
|
||||
virtual ~CSSImageValue() override = default;
|
||||
|
||||
virtual WebIDL::ExceptionOr<String> to_string() const override;
|
||||
|
||||
private:
|
||||
explicit CSSImageValue(JS::Realm&, String constructed_from_string);
|
||||
explicit CSSImageValue(JS::Realm&, NonnullRefPtr<StyleValue const> source_value);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
String m_constructed_from_string;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue