mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:27:43 +00:00
LibWeb: Implement CSS pow()
This commit is contained in:
parent
8ef25989b6
commit
9aed8ec7f0
4 changed files with 136 additions and 2 deletions
|
@ -162,6 +162,14 @@ public:
|
|||
Atan,
|
||||
Atan2,
|
||||
|
||||
// Exponential functions, a sub-type of operator node
|
||||
// https://drafts.csswg.org/css-values-4/#exponent-funcs
|
||||
Pow,
|
||||
Sqrt,
|
||||
Hypot,
|
||||
Log,
|
||||
Exp,
|
||||
|
||||
// This only exists during parsing.
|
||||
Unparsed,
|
||||
};
|
||||
|
@ -523,4 +531,23 @@ private:
|
|||
NonnullOwnPtr<CalculationNode> m_x;
|
||||
};
|
||||
|
||||
class PowCalculationNode final : public CalculationNode {
|
||||
public:
|
||||
static ErrorOr<NonnullOwnPtr<PowCalculationNode>> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
||||
~PowCalculationNode();
|
||||
|
||||
virtual ErrorOr<String> to_string() const override;
|
||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||
virtual bool contains_percentage() const override { return false; };
|
||||
virtual CalculatedStyleValue::CalculationResult resolve(Optional<Length::ResolutionContext const&>, CalculatedStyleValue::PercentageBasis const&) const override;
|
||||
virtual ErrorOr<void> for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const&) override;
|
||||
|
||||
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
|
||||
|
||||
private:
|
||||
explicit PowCalculationNode(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
||||
NonnullOwnPtr<CalculationNode> m_x;
|
||||
NonnullOwnPtr<CalculationNode> m_y;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue