Ver Fonte

LibWeb: Remove unused Realm arg from StyleComputer::get_inherit_value()

We no longer need this now that property_initial_value() doesn't take a
Realm.
Sam Atkins há 8 meses atrás
pai
commit
ee9db99961

+ 1 - 1
Libraries/LibWeb/Animations/KeyframeEffect.cpp

@@ -945,7 +945,7 @@ void KeyframeEffect::update_style_properties()
 
         for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) {
             if (element_style->is_property_inherited(static_cast<CSS::PropertyID>(i))) {
-                auto new_value = CSS::StyleComputer::get_inherit_value(document.realm(), static_cast<CSS::PropertyID>(i), &element);
+                auto new_value = CSS::StyleComputer::get_inherit_value(static_cast<CSS::PropertyID>(i), &element);
                 element_style->set_property(static_cast<CSS::PropertyID>(i), *new_value, CSS::StyleProperties::Inherited::Yes);
             }
         }

+ 1 - 1
Libraries/LibWeb/CSS/Interpolation.cpp

@@ -48,7 +48,7 @@ static NonnullRefPtr<CSSStyleValue const> with_keyword_values_resolved(DOM::Elem
     case CSS::Keyword::Unset:
         return property_initial_value(property_id);
     case CSS::Keyword::Inherit:
-        return CSS::StyleComputer::get_inherit_value(element.realm(), property_id, &element);
+        return CSS::StyleComputer::get_inherit_value(property_id, &element);
     default:
         break;
     }

+ 6 - 6
Libraries/LibWeb/CSS/StyleComputer.cpp

@@ -928,7 +928,7 @@ void StyleComputer::set_all_properties(DOM::Element& element, Optional<CSS::Sele
             if (is_inherited_property(property_id)) {
                 style.set_property(
                     property_id,
-                    get_inherit_value(document.realm(), property_id, &element, pseudo_element),
+                    get_inherit_value(property_id, &element, pseudo_element),
                     StyleProperties::Inherited::Yes,
                     important);
             } else {
@@ -1670,7 +1670,7 @@ DOM::Element const* element_to_inherit_style_from(DOM::Element const* element, O
     return parent_element;
 }
 
-NonnullRefPtr<CSSStyleValue const> StyleComputer::get_inherit_value([[maybe_unused]] JS::Realm& initial_value_context_realm, CSS::PropertyID property_id, DOM::Element const* element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element)
+NonnullRefPtr<CSSStyleValue const> StyleComputer::get_inherit_value(CSS::PropertyID property_id, DOM::Element const* element, Optional<CSS::Selector::PseudoElement::Type> pseudo_element)
 {
     auto* parent_element = element_to_inherit_style_from(element, pseudo_element);
 
@@ -1688,7 +1688,7 @@ void StyleComputer::compute_defaulted_property_value(StyleProperties& style, DOM
         if (is_inherited_property(property_id)) {
             style.set_property(
                 property_id,
-                get_inherit_value(document().realm(), property_id, element, pseudo_element),
+                get_inherit_value(property_id, element, pseudo_element),
                 StyleProperties::Inherited::Yes,
                 Important::No);
         } else {
@@ -1703,7 +1703,7 @@ void StyleComputer::compute_defaulted_property_value(StyleProperties& style, DOM
     }
 
     if (value_slot->is_inherit()) {
-        value_slot = get_inherit_value(document().realm(), property_id, element, pseudo_element);
+        value_slot = get_inherit_value(property_id, element, pseudo_element);
         style.set_property_inherited(property_id, StyleProperties::Inherited::Yes);
         return;
     }
@@ -1713,7 +1713,7 @@ void StyleComputer::compute_defaulted_property_value(StyleProperties& style, DOM
     if (value_slot->is_unset()) {
         if (is_inherited_property(property_id)) {
             // then if it is an inherited property, this is treated as inherit,
-            value_slot = get_inherit_value(document().realm(), property_id, element, pseudo_element);
+            value_slot = get_inherit_value(property_id, element, pseudo_element);
             style.set_property_inherited(property_id, StyleProperties::Inherited::Yes);
         } else {
             // and if it is not, this is treated as initial.
@@ -1737,7 +1737,7 @@ void StyleComputer::compute_defaulted_values(StyleProperties& style, DOM::Elemen
     // In the color property, the used value of currentcolor is the inherited value.
     auto const& color = style.property(CSS::PropertyID::Color);
     if (color.to_keyword() == Keyword::Currentcolor) {
-        auto const& inherited_value = get_inherit_value(document().realm(), CSS::PropertyID::Color, element, pseudo_element);
+        auto const& inherited_value = get_inherit_value(CSS::PropertyID::Color, element, pseudo_element);
         style.set_property(CSS::PropertyID::Color, inherited_value);
     }
 }

+ 1 - 1
Libraries/LibWeb/CSS/StyleComputer.h

@@ -127,7 +127,7 @@ public:
     };
     static void for_each_property_expanding_shorthands(PropertyID, CSSStyleValue const&, AllowUnresolved, Function<void(PropertyID, CSSStyleValue const&)> const& set_longhand_property);
     static void set_property_expanding_shorthands(StyleProperties&, PropertyID, CSSStyleValue const&, CSS::CSSStyleDeclaration const*, StyleProperties const& style_for_revert, StyleProperties const& style_for_revert_layer, Important = Important::No);
-    static NonnullRefPtr<CSSStyleValue const> get_inherit_value(JS::Realm& initial_value_context_realm, CSS::PropertyID, DOM::Element const*, Optional<CSS::Selector::PseudoElement::Type> = {});
+    static NonnullRefPtr<CSSStyleValue const> get_inherit_value(CSS::PropertyID, DOM::Element const*, Optional<CSS::Selector::PseudoElement::Type> = {});
 
     static Optional<String> user_agent_style_sheet_source(StringView name);