mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb/CSS: Simplify calculations after parsing them
If a calculation was simplified down to a single numeric node, then most of the time we can instead return a regular StyleValue, for example `calc(2px + 3px)` would be simplified down to a `5px` LengthStyleValue. This means that parse_calculated_value() can't return a CalculatedStyleValue directly, and its callers all have to handle non-calculated values as well as calculated ones. This simplification is reflected in the new test results. Serialization is not yet correct in all cases but we're closer than we were. :^)
This commit is contained in:
committed by
Andreas Kling
parent
39cefd7abf
commit
ee712bd98f
@@ -268,6 +268,8 @@ public:
|
||||
virtual CalculatedStyleValue::CalculationResult resolve(CalculationResolutionContext const&) const override;
|
||||
virtual NonnullRefPtr<CalculationNode> with_simplified_children(CalculationContext const&, CalculationResolutionContext const&) const override { return *this; }
|
||||
|
||||
RefPtr<CSSStyleValue> to_style_value(CalculationContext const&) const;
|
||||
|
||||
NumericValue const& value() const { return m_value; }
|
||||
|
||||
virtual void dump(StringBuilder&, int indent) const override;
|
||||
|
||||
Reference in New Issue
Block a user