mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 09:09:43 +00:00
LibWeb: Make storage of CSS::StyleValues const-correct
Now we consistently use `RefPtr<StyleValue const>` for all StyleValues.
This commit is contained in:
parent
3fdad8fe22
commit
6d11414957
Notes:
github-actions[bot]
2025-04-16 16:44:32 +00:00
Author: https://github.com/ADKaster
Commit: 6d11414957
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4362
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/Hendiadyoin1
113 changed files with 628 additions and 629 deletions
|
@ -17,28 +17,28 @@ namespace Web::CSS {
|
|||
// https://drafts.css-houdini.org/css-typed-om-1/#csskeywordvalue
|
||||
class CSSKeywordValue : public StyleValueWithDefaultOperators<CSSKeywordValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue> create(Keyword keyword)
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue const> create(Keyword keyword)
|
||||
{
|
||||
// NOTE: We'll have to be much more careful with caching once we expose CSSKeywordValue to JS, as it's mutable.
|
||||
switch (keyword) {
|
||||
case Keyword::Inherit: {
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue> const inherit_instance = adopt_ref(*new (nothrow) CSSKeywordValue(Keyword::Inherit));
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue const> const inherit_instance = adopt_ref(*new (nothrow) CSSKeywordValue(Keyword::Inherit));
|
||||
return inherit_instance;
|
||||
}
|
||||
case Keyword::Initial: {
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue> const initial_instance = adopt_ref(*new (nothrow) CSSKeywordValue(Keyword::Initial));
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue const> const initial_instance = adopt_ref(*new (nothrow) CSSKeywordValue(Keyword::Initial));
|
||||
return initial_instance;
|
||||
}
|
||||
case Keyword::Revert: {
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue> const revert_instance = adopt_ref(*new (nothrow) CSSKeywordValue(Keyword::Revert));
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue const> const revert_instance = adopt_ref(*new (nothrow) CSSKeywordValue(Keyword::Revert));
|
||||
return revert_instance;
|
||||
}
|
||||
case Keyword::RevertLayer: {
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue> const revert_layer_instance = adopt_ref(*new (nothrow) CSSKeywordValue(Keyword::RevertLayer));
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue const> const revert_layer_instance = adopt_ref(*new (nothrow) CSSKeywordValue(Keyword::RevertLayer));
|
||||
return revert_layer_instance;
|
||||
}
|
||||
case Keyword::Unset: {
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue> const unset_instance = adopt_ref(*new (nothrow) CSSKeywordValue(Keyword::Unset));
|
||||
static ValueComparingNonnullRefPtr<CSSKeywordValue const> const unset_instance = adopt_ref(*new (nothrow) CSSKeywordValue(Keyword::Unset));
|
||||
return unset_instance;
|
||||
}
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue