mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 19:29:16 +00:00
LibWeb: Remove Realm parameter from property_initial_value()
We don't need the Realm to parse a style value. Fixes #2720
This commit is contained in:
committed by
Alexander Kalenik
parent
863ce746dc
commit
2c3c821305
@@ -219,7 +219,7 @@ Optional<PropertyID> property_id_from_string(StringView);
|
||||
[[nodiscard]] FlyString const& string_from_property_id(PropertyID);
|
||||
[[nodiscard]] FlyString const& camel_case_string_from_property_id(PropertyID);
|
||||
bool is_inherited_property(PropertyID);
|
||||
NonnullRefPtr<CSSStyleValue> property_initial_value(Optional<JS::Realm&>, PropertyID);
|
||||
NonnullRefPtr<CSSStyleValue> property_initial_value(PropertyID);
|
||||
|
||||
enum class ValueType {
|
||||
Angle,
|
||||
@@ -662,20 +662,17 @@ bool property_affects_stacking_context(PropertyID property_id)
|
||||
}
|
||||
}
|
||||
|
||||
NonnullRefPtr<CSSStyleValue> property_initial_value(Optional<JS::Realm&> context_realm, PropertyID property_id)
|
||||
NonnullRefPtr<CSSStyleValue> property_initial_value(PropertyID property_id)
|
||||
{
|
||||
static Array<RefPtr<CSSStyleValue>, to_underlying(last_property_id) + 1> initial_values;
|
||||
if (auto initial_value = initial_values[to_underlying(property_id)])
|
||||
return initial_value.release_nonnull();
|
||||
|
||||
// We need a Realm to parse any new values.
|
||||
VERIFY(context_realm.has_value());
|
||||
|
||||
// Lazily parse initial values as needed.
|
||||
// This ensures the shorthands will always be able to get the initial values of their longhands.
|
||||
// This also now allows a longhand have its own longhand (like background-position-x).
|
||||
|
||||
Parser::ParsingContext parsing_context(context_realm.value());
|
||||
Parser::ParsingContext parsing_context;
|
||||
switch (property_id) {
|
||||
)~~~");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user