mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 22:30:31 +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:
parent
863ce746dc
commit
2c3c821305
Notes:
github-actions[bot]
2024-12-05 19:00:55 +00:00
Author: https://github.com/AtkinsSJ
Commit: 2c3c821305
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2783
7 changed files with 58 additions and 61 deletions
|
@ -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) {
|
||||
)~~~");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue