mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-24 17:09:43 +00:00
LibWeb: Don't pass unnecessary PropertyComputationDependencies struct
Since we now have access to the `AbstractElement` through the `ComputationContext` we can just set the flag that this element relies on tree counting functions directly, no need to pass this struct around.
This commit is contained in:
parent
5b9a36b172
commit
f49cf75d44
Notes:
github-actions[bot]
2025-10-21 23:01:59 +00:00
Author: https://github.com/Calme1709
Commit: f49cf75d44
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6526
Reviewed-by: https://github.com/gmta ✅
40 changed files with 200 additions and 249 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/CalculatedStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/IntegerStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>
|
||||
#include <LibWeb/DOM/Element.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
|
@ -23,9 +24,9 @@ String TreeCountingFunctionStyleValue::to_string(SerializationMode) const
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
size_t TreeCountingFunctionStyleValue::resolve(DOM::AbstractElement const& abstract_element, PropertyComputationDependencies& property_computation_dependencies) const
|
||||
size_t TreeCountingFunctionStyleValue::resolve(DOM::AbstractElement const& abstract_element) const
|
||||
{
|
||||
property_computation_dependencies.tree_counting_function = true;
|
||||
const_cast<DOM::Element&>(abstract_element.element()).set_style_uses_tree_counting_function();
|
||||
|
||||
auto tree_counting_function_resolution_context = abstract_element.tree_counting_function_resolution_context();
|
||||
|
||||
|
|
@ -39,22 +40,20 @@ size_t TreeCountingFunctionStyleValue::resolve(DOM::AbstractElement const& abstr
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
RefPtr<CalculationNode const> TreeCountingFunctionStyleValue::resolve_to_calculation_node(CalculationContext const& calculation_context, CalculationResolutionContext const& calculation_resolution_context, PropertyComputationDependencies* property_computation_dependencies) const
|
||||
RefPtr<CalculationNode const> TreeCountingFunctionStyleValue::resolve_to_calculation_node(CalculationContext const& calculation_context, CalculationResolutionContext const& calculation_resolution_context) const
|
||||
{
|
||||
if (!calculation_resolution_context.abstract_element.has_value())
|
||||
return nullptr;
|
||||
|
||||
VERIFY(property_computation_dependencies);
|
||||
|
||||
return NumericCalculationNode::create(Number { Number::Type::Number, static_cast<double>(resolve(calculation_resolution_context.abstract_element.value(), *property_computation_dependencies)) }, calculation_context);
|
||||
return NumericCalculationNode::create(Number { Number::Type::Number, static_cast<double>(resolve(calculation_resolution_context.abstract_element.value())) }, calculation_context);
|
||||
}
|
||||
|
||||
ValueComparingNonnullRefPtr<StyleValue const> TreeCountingFunctionStyleValue::absolutized(ComputationContext const& computation_context, PropertyComputationDependencies& property_computation_dependencies) const
|
||||
ValueComparingNonnullRefPtr<StyleValue const> TreeCountingFunctionStyleValue::absolutized(ComputationContext const& computation_context) const
|
||||
{
|
||||
// FIXME: We should clamp this value in case it falls outside the valid range for the context it is in
|
||||
VERIFY(computation_context.abstract_element.has_value());
|
||||
|
||||
size_t value = resolve(computation_context.abstract_element.value(), property_computation_dependencies);
|
||||
size_t value = resolve(computation_context.abstract_element.value());
|
||||
|
||||
switch (m_computed_type) {
|
||||
case ComputedType::Integer:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue