1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:47:34 +00:00

LibWeb: Make CSS math function parsing infallible

This commit is contained in:
Sam Atkins 2023-08-19 15:20:23 +01:00 committed by Andreas Kling
parent 28c2836c24
commit 2038cb3c81
5 changed files with 238 additions and 273 deletions

View file

@ -144,7 +144,7 @@ static Optional<RoundingStrategy> parse_rounding_strategy(Vector<ComponentValue>
return value_id_to_rounding_strategy(maybe_identifier.value());
}
ErrorOr<OwnPtr<CalculationNode>> Parser::parse_math_function(PropertyID property_id, Function const& function)
OwnPtr<CalculationNode> Parser::parse_math_function(PropertyID property_id, Function const& function)
{
TokenStream stream { function.values() };
auto arguments = parse_a_comma_separated_list_of_component_values(stream);
@ -163,10 +163,10 @@ ErrorOr<OwnPtr<CalculationNode>> Parser::parse_math_function(PropertyID property
TRY(function_generator.try_append(R"~~~(
CSSNumericType determined_argument_type;
Vector<NonnullOwnPtr<CalculationNode>> parsed_arguments;
TRY(parsed_arguments.try_ensure_capacity(arguments.size()));
parsed_arguments.ensure_capacity(arguments.size());
for (auto& argument : arguments) {
auto calculation_node = TRY(parse_a_calculation(argument));
auto calculation_node = parse_a_calculation(argument);
if (!calculation_node) {
dbgln_if(CSS_PARSER_DEBUG, "@name:lowercase@() argument #{} is not a valid calculation", parsed_arguments.size());
return nullptr;
@ -200,7 +200,7 @@ ErrorOr<OwnPtr<CalculationNode>> Parser::parse_math_function(PropertyID property
}
}
TRY(parsed_arguments.try_append(calculation_node.release_nonnull()));
parsed_arguments.append(calculation_node.release_nonnull());
}
return @name:titlecase@CalculationNode::create(move(parsed_arguments));
@ -255,14 +255,14 @@ ErrorOr<OwnPtr<CalculationNode>> Parser::parse_math_function(PropertyID property
// NOTE: This assumes everything not handled above is a calculation node of some kind.
parameter_is_calculation = true;
TRY(parameter_generator.set("parameter_type", "OwnPtr<CalculationNode>"_string));
TRY(parameter_generator.set("parse_function", "TRY(parse_a_calculation(arguments[argument_index]))"_string));
TRY(parameter_generator.set("parse_function", "parse_a_calculation(arguments[argument_index])"_string));
TRY(parameter_generator.set("check_function", " != nullptr"_string));
TRY(parameter_generator.set("release_function", ".release_nonnull()"_string));
// NOTE: We have exactly one default value in the data right now, and it's a `<calc-constant>`,
// so that's all we handle.
if (auto default_value = parameter.get_deprecated_string("default"sv); default_value.has_value()) {
TRY(parameter_generator.set("parameter_default", TRY(String::formatted(" = TRY(ConstantCalculationNode::create(CalculationNode::constant_type_from_string(\"{}\"sv).value()))", TRY(String::from_deprecated_string(default_value.value()))))));
TRY(parameter_generator.set("parameter_default", TRY(String::formatted(" = ConstantCalculationNode::create(CalculationNode::constant_type_from_string(\"{}\"sv).value())", TRY(String::from_deprecated_string(default_value.value()))))));
} else {
TRY(parameter_generator.set("parameter_default", ""_string));
}

View file

@ -1744,9 +1744,9 @@ RefPtr<CalculatedStyleValue> Parser::parse_calculated_value(ComponentValue const
OwnPtr<CalculationNode> Parser::parse_a_calc_function_node(Function const& function)
{
if (function.name().equals_ignoring_ascii_case("calc"sv))
return MUST(parse_a_calculation(function.values()));
return parse_a_calculation(function.values());
if (auto maybe_function = MUST(parse_math_function(m_context.current_property_id(), function)); maybe_function)
if (auto maybe_function = parse_math_function(m_context.current_property_id(), function))
return maybe_function;
return nullptr;
@ -6172,9 +6172,9 @@ Parser::PropertyAndValue Parser::parse_css_value_for_properties(ReadonlySpan<Pro
class UnparsedCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<UnparsedCalculationNode>> create(ComponentValue component_value)
static NonnullOwnPtr<UnparsedCalculationNode> create(ComponentValue component_value)
{
return adopt_nonnull_own_or_enomem(new (nothrow) UnparsedCalculationNode(move(component_value)));
return adopt_own(*new (nothrow) UnparsedCalculationNode(move(component_value)));
}
virtual ~UnparsedCalculationNode() = default;
@ -6185,6 +6185,7 @@ public:
virtual Optional<CSSNumericType> determine_type(Web::CSS::PropertyID) const override { VERIFY_NOT_REACHED(); }
virtual bool contains_percentage() const override { VERIFY_NOT_REACHED(); }
virtual CalculatedStyleValue::CalculationResult resolve(Optional<Length::ResolutionContext const&>, CalculatedStyleValue::PercentageBasis const&) const override { VERIFY_NOT_REACHED(); }
virtual void for_each_child_node(AK::Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override { }
virtual ErrorOr<void> dump(StringBuilder& builder, int indent) const override
{
@ -6263,7 +6264,7 @@ LengthOrCalculated Parser::Parser::parse_as_sizes_attribute()
}
// https://www.w3.org/TR/css-values-4/#parse-a-calculation
ErrorOr<OwnPtr<CalculationNode>> Parser::parse_a_calculation(Vector<ComponentValue> const& original_values)
OwnPtr<CalculationNode> Parser::parse_a_calculation(Vector<ComponentValue> const& original_values)
{
// 1. Discard any <whitespace-token>s from values.
// 2. An item in values is an “operator” if its a <delim-token> with the value "+", "-", "*", or "/". Otherwise, its a “value”.
@ -6281,7 +6282,7 @@ ErrorOr<OwnPtr<CalculationNode>> Parser::parse_a_calculation(Vector<ComponentVal
if (!values.is_empty() && values.last().has<Operator>())
return nullptr;
TRY(values.try_append(Operator { static_cast<char>(value.token().delim()) }));
values.append(Operator { static_cast<char>(value.token().delim()) });
continue;
}
}
@ -6289,34 +6290,34 @@ ErrorOr<OwnPtr<CalculationNode>> Parser::parse_a_calculation(Vector<ComponentVal
if (value.is(Token::Type::Ident)) {
auto maybe_constant = CalculationNode::constant_type_from_string(value.token().ident());
if (maybe_constant.has_value()) {
TRY(values.try_append({ TRY(ConstantCalculationNode::create(maybe_constant.value())) }));
values.append({ ConstantCalculationNode::create(maybe_constant.value()) });
continue;
}
}
if (value.is(Token::Type::Number)) {
TRY(values.try_append({ TRY(NumericCalculationNode::create(value.token().number())) }));
values.append({ NumericCalculationNode::create(value.token().number()) });
continue;
}
if (auto dimension = parse_dimension(value); dimension.has_value()) {
if (dimension->is_angle())
TRY(values.try_append({ TRY(NumericCalculationNode::create(dimension->angle())) }));
values.append({ NumericCalculationNode::create(dimension->angle()) });
else if (dimension->is_frequency())
TRY(values.try_append({ TRY(NumericCalculationNode::create(dimension->frequency())) }));
values.append({ NumericCalculationNode::create(dimension->frequency()) });
else if (dimension->is_length())
TRY(values.try_append({ TRY(NumericCalculationNode::create(dimension->length())) }));
values.append({ NumericCalculationNode::create(dimension->length()) });
else if (dimension->is_percentage())
TRY(values.try_append({ TRY(NumericCalculationNode::create(dimension->percentage())) }));
values.append({ NumericCalculationNode::create(dimension->percentage()) });
// FIXME: Resolutions, once calc() supports them.
else if (dimension->is_time())
TRY(values.try_append({ TRY(NumericCalculationNode::create(dimension->time())) }));
values.append({ NumericCalculationNode::create(dimension->time()) });
else
VERIFY_NOT_REACHED();
continue;
}
TRY(values.try_append({ TRY(UnparsedCalculationNode::create(value)) }));
values.append({ UnparsedCalculationNode::create(value) });
}
// If we have no values, the syntax is invalid.
@ -6356,21 +6357,21 @@ ErrorOr<OwnPtr<CalculationNode>> Parser::parse_a_calculation(Vector<ComponentVal
// 1. For each "/" operator in the run, replace its right-hand value item rhs with an Invert node containing rhs as its child.
Vector<NonnullOwnPtr<CalculationNode>> run_values;
TRY(run_values.try_append(move(values[start_of_run].get<NonnullOwnPtr<CalculationNode>>())));
run_values.append(move(values[start_of_run].get<NonnullOwnPtr<CalculationNode>>()));
for (auto i = start_of_run + 1; i <= end_of_run; i += 2) {
auto& operator_ = values[i].get<Operator>().delim;
auto& rhs = values[i + 1];
if (operator_ == '/') {
TRY(run_values.try_append(TRY(InvertCalculationNode::create(move(rhs.get<NonnullOwnPtr<CalculationNode>>())))));
run_values.append(InvertCalculationNode::create(move(rhs.get<NonnullOwnPtr<CalculationNode>>())));
continue;
}
VERIFY(operator_ == '*');
TRY(run_values.try_append(move(rhs.get<NonnullOwnPtr<CalculationNode>>())));
run_values.append(move(rhs.get<NonnullOwnPtr<CalculationNode>>()));
}
// 2. Replace the entire run with a Product node containing the value items of the run as its children.
auto product_node = TRY(ProductCalculationNode::create(move(run_values)));
auto product_node = ProductCalculationNode::create(move(run_values));
values.remove(start_of_run, end_of_run - start_of_run + 1);
TRY(values.try_insert(start_of_run, { move(product_node) }));
values.insert(start_of_run, { move(product_node) });
}
// 4. Collect children into Sum and Negate nodes.
@ -6385,59 +6386,57 @@ ErrorOr<OwnPtr<CalculationNode>> Parser::parse_a_calculation(Vector<ComponentVal
auto rhs_index = ++i;
auto& rhs = values[rhs_index];
NonnullOwnPtr<CalculationNode> negate_node = TRY(NegateCalculationNode::create(move(rhs.get<NonnullOwnPtr<CalculationNode>>())));
NonnullOwnPtr<CalculationNode> negate_node = NegateCalculationNode::create(move(rhs.get<NonnullOwnPtr<CalculationNode>>()));
values.remove(rhs_index);
values.insert(rhs_index, move(negate_node));
}
// 2. If values has only one item, and it is a Product node or a parenthesized simple block, replace values with that item.
if (values.size() == 1) {
TRY(values.first().visit(
[&](ComponentValue& component_value) -> ErrorOr<void> {
values.first().visit(
[&](ComponentValue& component_value) {
if (component_value.is_block() && component_value.block().is_paren())
single_value = TRY(UnparsedCalculationNode::create(component_value));
return {};
single_value = UnparsedCalculationNode::create(component_value);
},
[&](NonnullOwnPtr<CalculationNode>& node) -> ErrorOr<void> {
[&](NonnullOwnPtr<CalculationNode>& node) {
if (node->type() == CalculationNode::Type::Product)
single_value = move(node);
return {};
},
[](auto&) -> ErrorOr<void> { return {}; }));
[](auto&) {});
}
// Otherwise, replace values with a Sum node containing the value items of values as its children.
if (!single_value.has_value()) {
values.remove_all_matching([](Value& value) { return value.has<Operator>(); });
Vector<NonnullOwnPtr<CalculationNode>> value_items;
TRY(value_items.try_ensure_capacity(values.size()));
value_items.ensure_capacity(values.size());
for (auto& value : values) {
if (value.has<Operator>())
continue;
value_items.unchecked_append(move(value.get<NonnullOwnPtr<CalculationNode>>()));
}
single_value = TRY(SumCalculationNode::create(move(value_items)));
single_value = SumCalculationNode::create(move(value_items));
}
}
// 5. At this point values is a tree of Sum, Product, Negate, and Invert nodes, with other types of values at the leaf nodes. Process the leaf nodes.
// For every leaf node leaf in values:
bool parsing_failed_for_child_node = false;
TRY(single_value.value()->for_each_child_node([&](NonnullOwnPtr<CalculationNode>& node) -> ErrorOr<void> {
single_value.value()->for_each_child_node([&](NonnullOwnPtr<CalculationNode>& node) {
if (node->type() != CalculationNode::Type::Unparsed)
return {};
return;
auto& unparsed_node = static_cast<UnparsedCalculationNode&>(*node);
auto& component_value = unparsed_node.component_value();
// 1. If leaf is a parenthesized simple block, replace leaf with the result of parsing a calculation from leafs contents.
if (component_value.is_block() && component_value.block().is_paren()) {
auto leaf_calculation = TRY(parse_a_calculation(component_value.block().values()));
auto leaf_calculation = parse_a_calculation(component_value.block().values());
if (!leaf_calculation) {
parsing_failed_for_child_node = true;
return {};
return;
}
node = leaf_calculation.release_nonnull();
return {};
return;
}
// 2. If leaf is a math function, replace leaf with the internal representation of that math function.
@ -6447,19 +6446,19 @@ ErrorOr<OwnPtr<CalculationNode>> Parser::parse_a_calculation(Vector<ComponentVal
auto leaf_calculation = parse_a_calc_function_node(function);
if (!leaf_calculation) {
parsing_failed_for_child_node = true;
return {};
return;
}
node = leaf_calculation.release_nonnull();
return {};
return;
}
// NOTE: If we get here, then we have an UnparsedCalculationNode that didn't get replaced with something else.
// So, the calc() is invalid.
dbgln_if(CSS_PARSER_DEBUG, "Leftover UnparsedCalculationNode in calc tree! That probably means the syntax is invalid, but maybe we just didn't implement `{}` yet.", component_value.to_debug_string());
parsing_failed_for_child_node = true;
return {};
}));
return;
});
if (parsing_failed_for_child_node)
return nullptr;

View file

@ -202,7 +202,7 @@ private:
RefPtr<StyleValue> parse_builtin_value(ComponentValue const&);
RefPtr<CalculatedStyleValue> parse_calculated_value(ComponentValue const&);
// NOTE: Implemented in generated code. (GenerateCSSMathFunctions.cpp)
ErrorOr<OwnPtr<CalculationNode>> parse_math_function(PropertyID, Function const&);
OwnPtr<CalculationNode> parse_math_function(PropertyID, Function const&);
OwnPtr<CalculationNode> parse_a_calc_function_node(Function const&);
RefPtr<StyleValue> parse_dimension_value(ComponentValue const&);
RefPtr<StyleValue> parse_integer_value(TokenStream<ComponentValue>&);
@ -259,7 +259,7 @@ private:
RefPtr<StyleValue> parse_grid_area_shorthand_value(Vector<ComponentValue> const&);
RefPtr<StyleValue> parse_grid_shorthand_value(Vector<ComponentValue> const&);
ErrorOr<OwnPtr<CalculationNode>> parse_a_calculation(Vector<ComponentValue> const&);
OwnPtr<CalculationNode> parse_a_calculation(Vector<ComponentValue> const&);
ParseErrorOr<NonnullRefPtr<Selector>> parse_complex_selector(TokenStream<ComponentValue>&, SelectorType);
ParseErrorOr<Optional<Selector::CompoundSelector>> parse_compound_selector(TokenStream<ComponentValue>&);

View file

@ -114,9 +114,9 @@ CalculationNode::CalculationNode(Type type)
CalculationNode::~CalculationNode() = default;
ErrorOr<NonnullOwnPtr<NumericCalculationNode>> NumericCalculationNode::create(NumericValue value)
NonnullOwnPtr<NumericCalculationNode> NumericCalculationNode::create(NumericValue value)
{
return adopt_nonnull_own_or_enomem(new (nothrow) NumericCalculationNode(move(value)));
return adopt_own(*new (nothrow) NumericCalculationNode(move(value)));
}
NumericCalculationNode::NumericCalculationNode(NumericValue value)
@ -211,9 +211,9 @@ ErrorOr<void> NumericCalculationNode::dump(StringBuilder& builder, int indent) c
return builder.try_appendff("{: >{}}NUMERIC({})\n", "", indent, TRY(m_value.visit([](auto& it) { return it.to_string(); })));
}
ErrorOr<NonnullOwnPtr<SumCalculationNode>> SumCalculationNode::create(Vector<NonnullOwnPtr<CalculationNode>> values)
NonnullOwnPtr<SumCalculationNode> SumCalculationNode::create(Vector<NonnullOwnPtr<CalculationNode>> values)
{
return adopt_nonnull_own_or_enomem(new (nothrow) SumCalculationNode(move(values)));
return adopt_own(*new (nothrow) SumCalculationNode(move(values)));
}
SumCalculationNode::SumCalculationNode(Vector<NonnullOwnPtr<CalculationNode>> values)
@ -314,14 +314,12 @@ CalculatedStyleValue::CalculationResult SumCalculationNode::resolve(Optional<Len
return total.value();
}
ErrorOr<void> SumCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void SumCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
for (auto& item : m_values) {
TRY(item->for_each_child_node(callback));
TRY(callback(item));
item->for_each_child_node(callback);
callback(item);
}
return {};
}
ErrorOr<void> SumCalculationNode::dump(StringBuilder& builder, int indent) const
@ -332,9 +330,9 @@ ErrorOr<void> SumCalculationNode::dump(StringBuilder& builder, int indent) const
return {};
}
ErrorOr<NonnullOwnPtr<ProductCalculationNode>> ProductCalculationNode::create(Vector<NonnullOwnPtr<CalculationNode>> values)
NonnullOwnPtr<ProductCalculationNode> ProductCalculationNode::create(Vector<NonnullOwnPtr<CalculationNode>> values)
{
return adopt_nonnull_own_or_enomem(new (nothrow) ProductCalculationNode(move(values)));
return adopt_own(*new (nothrow) ProductCalculationNode(move(values)));
}
ProductCalculationNode::ProductCalculationNode(Vector<NonnullOwnPtr<CalculationNode>> values)
@ -440,14 +438,12 @@ CalculatedStyleValue::CalculationResult ProductCalculationNode::resolve(Optional
return total.value();
}
ErrorOr<void> ProductCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void ProductCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
for (auto& item : m_values) {
TRY(item->for_each_child_node(callback));
TRY(callback(item));
item->for_each_child_node(callback);
callback(item);
}
return {};
}
ErrorOr<void> ProductCalculationNode::dump(StringBuilder& builder, int indent) const
@ -458,9 +454,9 @@ ErrorOr<void> ProductCalculationNode::dump(StringBuilder& builder, int indent) c
return {};
}
ErrorOr<NonnullOwnPtr<NegateCalculationNode>> NegateCalculationNode::create(NonnullOwnPtr<Web::CSS::CalculationNode> value)
NonnullOwnPtr<NegateCalculationNode> NegateCalculationNode::create(NonnullOwnPtr<Web::CSS::CalculationNode> value)
{
return adopt_nonnull_own_or_enomem(new (nothrow) NegateCalculationNode(move(value)));
return adopt_own(*new (nothrow) NegateCalculationNode(move(value)));
}
NegateCalculationNode::NegateCalculationNode(NonnullOwnPtr<CalculationNode> value)
@ -500,11 +496,10 @@ CalculatedStyleValue::CalculationResult NegateCalculationNode::resolve(Optional<
return child_value;
}
ErrorOr<void> NegateCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void NegateCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_value->for_each_child_node(callback));
TRY(callback(m_value));
return {};
m_value->for_each_child_node(callback);
callback(m_value);
}
ErrorOr<void> NegateCalculationNode::dump(StringBuilder& builder, int indent) const
@ -514,9 +509,9 @@ ErrorOr<void> NegateCalculationNode::dump(StringBuilder& builder, int indent) co
return {};
}
ErrorOr<NonnullOwnPtr<InvertCalculationNode>> InvertCalculationNode::create(NonnullOwnPtr<Web::CSS::CalculationNode> value)
NonnullOwnPtr<InvertCalculationNode> InvertCalculationNode::create(NonnullOwnPtr<Web::CSS::CalculationNode> value)
{
return adopt_nonnull_own_or_enomem(new (nothrow) InvertCalculationNode(move(value)));
return adopt_own(*new (nothrow) InvertCalculationNode(move(value)));
}
InvertCalculationNode::InvertCalculationNode(NonnullOwnPtr<CalculationNode> value)
@ -563,11 +558,10 @@ CalculatedStyleValue::CalculationResult InvertCalculationNode::resolve(Optional<
return child_value;
}
ErrorOr<void> InvertCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void InvertCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_value->for_each_child_node(callback));
TRY(callback(m_value));
return {};
m_value->for_each_child_node(callback);
callback(m_value);
}
ErrorOr<void> InvertCalculationNode::dump(StringBuilder& builder, int indent) const
@ -577,9 +571,9 @@ ErrorOr<void> InvertCalculationNode::dump(StringBuilder& builder, int indent) co
return {};
}
ErrorOr<NonnullOwnPtr<MinCalculationNode>> MinCalculationNode::create(Vector<NonnullOwnPtr<Web::CSS::CalculationNode>> values)
NonnullOwnPtr<MinCalculationNode> MinCalculationNode::create(Vector<NonnullOwnPtr<Web::CSS::CalculationNode>> values)
{
return adopt_nonnull_own_or_enomem(new (nothrow) MinCalculationNode(move(values)));
return adopt_own(*new (nothrow) MinCalculationNode(move(values)));
}
MinCalculationNode::MinCalculationNode(Vector<NonnullOwnPtr<CalculationNode>> values)
@ -644,14 +638,12 @@ CalculatedStyleValue::CalculationResult MinCalculationNode::resolve(Optional<Len
return smallest_node;
}
ErrorOr<void> MinCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void MinCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
for (auto& value : m_values) {
TRY(value->for_each_child_node(callback));
TRY(callback(value));
value->for_each_child_node(callback);
callback(value);
}
return {};
}
ErrorOr<void> MinCalculationNode::dump(StringBuilder& builder, int indent) const
@ -662,9 +654,9 @@ ErrorOr<void> MinCalculationNode::dump(StringBuilder& builder, int indent) const
return {};
}
ErrorOr<NonnullOwnPtr<MaxCalculationNode>> MaxCalculationNode::create(Vector<NonnullOwnPtr<Web::CSS::CalculationNode>> values)
NonnullOwnPtr<MaxCalculationNode> MaxCalculationNode::create(Vector<NonnullOwnPtr<Web::CSS::CalculationNode>> values)
{
return adopt_nonnull_own_or_enomem(new (nothrow) MaxCalculationNode(move(values)));
return adopt_own(*new (nothrow) MaxCalculationNode(move(values)));
}
MaxCalculationNode::MaxCalculationNode(Vector<NonnullOwnPtr<CalculationNode>> values)
@ -729,14 +721,12 @@ CalculatedStyleValue::CalculationResult MaxCalculationNode::resolve(Optional<Len
return largest_node;
}
ErrorOr<void> MaxCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void MaxCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
for (auto& value : m_values) {
TRY(value->for_each_child_node(callback));
TRY(callback(value));
value->for_each_child_node(callback);
callback(value);
}
return {};
}
ErrorOr<void> MaxCalculationNode::dump(StringBuilder& builder, int indent) const
@ -747,9 +737,9 @@ ErrorOr<void> MaxCalculationNode::dump(StringBuilder& builder, int indent) const
return {};
}
ErrorOr<NonnullOwnPtr<ClampCalculationNode>> ClampCalculationNode::create(NonnullOwnPtr<CalculationNode> min, NonnullOwnPtr<CalculationNode> center, NonnullOwnPtr<CalculationNode> max)
NonnullOwnPtr<ClampCalculationNode> ClampCalculationNode::create(NonnullOwnPtr<CalculationNode> min, NonnullOwnPtr<CalculationNode> center, NonnullOwnPtr<CalculationNode> max)
{
return adopt_nonnull_own_or_enomem(new (nothrow) ClampCalculationNode(move(min), move(center), move(max)));
return adopt_own(*new (nothrow) ClampCalculationNode(move(min), move(center), move(max)));
}
ClampCalculationNode::ClampCalculationNode(NonnullOwnPtr<CalculationNode> min, NonnullOwnPtr<CalculationNode> center, NonnullOwnPtr<CalculationNode> max)
@ -825,16 +815,14 @@ CalculatedStyleValue::CalculationResult ClampCalculationNode::resolve(Optional<L
VERIFY_NOT_REACHED();
}
ErrorOr<void> ClampCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void ClampCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_min_value->for_each_child_node(callback));
TRY(m_center_value->for_each_child_node(callback));
TRY(m_max_value->for_each_child_node(callback));
TRY(callback(m_min_value));
TRY(callback(m_center_value));
TRY(callback(m_max_value));
return {};
m_min_value->for_each_child_node(callback);
m_center_value->for_each_child_node(callback);
m_max_value->for_each_child_node(callback);
callback(m_min_value);
callback(m_center_value);
callback(m_max_value);
}
ErrorOr<void> ClampCalculationNode::dump(StringBuilder& builder, int indent) const
@ -846,9 +834,9 @@ ErrorOr<void> ClampCalculationNode::dump(StringBuilder& builder, int indent) con
return {};
}
ErrorOr<NonnullOwnPtr<AbsCalculationNode>> AbsCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
NonnullOwnPtr<AbsCalculationNode> AbsCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
{
return adopt_nonnull_own_or_enomem(new (nothrow) AbsCalculationNode(move(value)));
return adopt_own(*new (nothrow) AbsCalculationNode(move(value)));
}
AbsCalculationNode::AbsCalculationNode(NonnullOwnPtr<CalculationNode> value)
@ -897,11 +885,10 @@ CalculatedStyleValue::CalculationResult AbsCalculationNode::resolve(Optional<Len
return node_a;
}
ErrorOr<void> AbsCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void AbsCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_value->for_each_child_node(callback));
TRY(callback(m_value));
return {};
m_value->for_each_child_node(callback);
callback(m_value);
}
ErrorOr<void> AbsCalculationNode::dump(StringBuilder& builder, int indent) const
@ -910,9 +897,9 @@ ErrorOr<void> AbsCalculationNode::dump(StringBuilder& builder, int indent) const
return {};
}
ErrorOr<NonnullOwnPtr<SignCalculationNode>> SignCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
NonnullOwnPtr<SignCalculationNode> SignCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
{
return adopt_nonnull_own_or_enomem(new (nothrow) SignCalculationNode(move(value)));
return adopt_own(*new (nothrow) SignCalculationNode(move(value)));
}
SignCalculationNode::SignCalculationNode(NonnullOwnPtr<CalculationNode> value)
@ -963,11 +950,10 @@ CalculatedStyleValue::CalculationResult SignCalculationNode::resolve(Optional<Le
return { Number(Number::Type::Integer, 0) };
}
ErrorOr<void> SignCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void SignCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_value->for_each_child_node(callback));
TRY(callback(m_value));
return {};
m_value->for_each_child_node(callback);
callback(m_value);
}
ErrorOr<void> SignCalculationNode::dump(StringBuilder& builder, int indent) const
@ -976,9 +962,9 @@ ErrorOr<void> SignCalculationNode::dump(StringBuilder& builder, int indent) cons
return {};
}
ErrorOr<NonnullOwnPtr<ConstantCalculationNode>> ConstantCalculationNode::create(ConstantType constant)
NonnullOwnPtr<ConstantCalculationNode> ConstantCalculationNode::create(ConstantType constant)
{
return adopt_nonnull_own_or_enomem(new (nothrow) ConstantCalculationNode(constant));
return adopt_own(*new (nothrow) ConstantCalculationNode(constant));
}
ConstantCalculationNode::ConstantCalculationNode(ConstantType constant)
@ -1039,20 +1025,15 @@ CalculatedStyleValue::CalculationResult ConstantCalculationNode::resolve([[maybe
VERIFY_NOT_REACHED();
}
ErrorOr<void> ConstantCalculationNode::for_each_child_node([[maybe_unused]] Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
return {};
}
ErrorOr<void> ConstantCalculationNode::dump(StringBuilder& builder, int indent) const
{
TRY(builder.try_appendff("{: >{}}CONSTANT: {}\n", "", indent, TRY(to_string())));
return {};
}
ErrorOr<NonnullOwnPtr<SinCalculationNode>> SinCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
NonnullOwnPtr<SinCalculationNode> SinCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
{
return adopt_nonnull_own_or_enomem(new (nothrow) SinCalculationNode(move(value)));
return adopt_own(*new (nothrow) SinCalculationNode(move(value)));
}
SinCalculationNode::SinCalculationNode(NonnullOwnPtr<CalculationNode> value)
@ -1098,11 +1079,10 @@ CalculatedStyleValue::CalculationResult SinCalculationNode::resolve(Optional<Len
return { Number(Number::Type::Number, result) };
}
ErrorOr<void> SinCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void SinCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_value->for_each_child_node(callback));
TRY(callback(m_value));
return {};
m_value->for_each_child_node(callback);
callback(m_value);
}
ErrorOr<void> SinCalculationNode::dump(StringBuilder& builder, int indent) const
@ -1111,9 +1091,9 @@ ErrorOr<void> SinCalculationNode::dump(StringBuilder& builder, int indent) const
return {};
}
ErrorOr<NonnullOwnPtr<CosCalculationNode>> CosCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
NonnullOwnPtr<CosCalculationNode> CosCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
{
return adopt_nonnull_own_or_enomem(new (nothrow) CosCalculationNode(move(value)));
return adopt_own(*new (nothrow) CosCalculationNode(move(value)));
}
CosCalculationNode::CosCalculationNode(NonnullOwnPtr<CalculationNode> value)
@ -1159,11 +1139,10 @@ CalculatedStyleValue::CalculationResult CosCalculationNode::resolve(Optional<Len
return { Number(Number::Type::Number, result) };
}
ErrorOr<void> CosCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void CosCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_value->for_each_child_node(callback));
TRY(callback(m_value));
return {};
m_value->for_each_child_node(callback);
callback(m_value);
}
ErrorOr<void> CosCalculationNode::dump(StringBuilder& builder, int indent) const
@ -1172,9 +1151,9 @@ ErrorOr<void> CosCalculationNode::dump(StringBuilder& builder, int indent) const
return {};
}
ErrorOr<NonnullOwnPtr<TanCalculationNode>> TanCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
NonnullOwnPtr<TanCalculationNode> TanCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
{
return adopt_nonnull_own_or_enomem(new (nothrow) TanCalculationNode(move(value)));
return adopt_own(*new (nothrow) TanCalculationNode(move(value)));
}
TanCalculationNode::TanCalculationNode(NonnullOwnPtr<CalculationNode> value)
@ -1220,11 +1199,10 @@ CalculatedStyleValue::CalculationResult TanCalculationNode::resolve(Optional<Len
return { Number(Number::Type::Number, result) };
}
ErrorOr<void> TanCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void TanCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_value->for_each_child_node(callback));
TRY(callback(m_value));
return {};
m_value->for_each_child_node(callback);
callback(m_value);
}
ErrorOr<void> TanCalculationNode::dump(StringBuilder& builder, int indent) const
@ -1233,9 +1211,9 @@ ErrorOr<void> TanCalculationNode::dump(StringBuilder& builder, int indent) const
return {};
}
ErrorOr<NonnullOwnPtr<AsinCalculationNode>> AsinCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
NonnullOwnPtr<AsinCalculationNode> AsinCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
{
return adopt_nonnull_own_or_enomem(new (nothrow) AsinCalculationNode(move(value)));
return adopt_own(*new (nothrow) AsinCalculationNode(move(value)));
}
AsinCalculationNode::AsinCalculationNode(NonnullOwnPtr<CalculationNode> value)
@ -1281,11 +1259,10 @@ CalculatedStyleValue::CalculationResult AsinCalculationNode::resolve(Optional<Le
return { Angle(result, Angle::Type::Rad) };
}
ErrorOr<void> AsinCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void AsinCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_value->for_each_child_node(callback));
TRY(callback(m_value));
return {};
m_value->for_each_child_node(callback);
callback(m_value);
}
ErrorOr<void> AsinCalculationNode::dump(StringBuilder& builder, int indent) const
@ -1294,9 +1271,9 @@ ErrorOr<void> AsinCalculationNode::dump(StringBuilder& builder, int indent) cons
return {};
}
ErrorOr<NonnullOwnPtr<AcosCalculationNode>> AcosCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
NonnullOwnPtr<AcosCalculationNode> AcosCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
{
return adopt_nonnull_own_or_enomem(new (nothrow) AcosCalculationNode(move(value)));
return adopt_own(*new (nothrow) AcosCalculationNode(move(value)));
}
AcosCalculationNode::AcosCalculationNode(NonnullOwnPtr<CalculationNode> value)
@ -1342,11 +1319,10 @@ CalculatedStyleValue::CalculationResult AcosCalculationNode::resolve(Optional<Le
return { Angle(result, Angle::Type::Rad) };
}
ErrorOr<void> AcosCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void AcosCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_value->for_each_child_node(callback));
TRY(callback(m_value));
return {};
m_value->for_each_child_node(callback);
callback(m_value);
}
ErrorOr<void> AcosCalculationNode::dump(StringBuilder& builder, int indent) const
@ -1355,9 +1331,9 @@ ErrorOr<void> AcosCalculationNode::dump(StringBuilder& builder, int indent) cons
return {};
}
ErrorOr<NonnullOwnPtr<AtanCalculationNode>> AtanCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
NonnullOwnPtr<AtanCalculationNode> AtanCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
{
return adopt_nonnull_own_or_enomem(new (nothrow) AtanCalculationNode(move(value)));
return adopt_own(*new (nothrow) AtanCalculationNode(move(value)));
}
AtanCalculationNode::AtanCalculationNode(NonnullOwnPtr<CalculationNode> value)
@ -1403,11 +1379,10 @@ CalculatedStyleValue::CalculationResult AtanCalculationNode::resolve(Optional<Le
return { Angle(result, Angle::Type::Rad) };
}
ErrorOr<void> AtanCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void AtanCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_value->for_each_child_node(callback));
TRY(callback(m_value));
return {};
m_value->for_each_child_node(callback);
callback(m_value);
}
ErrorOr<void> AtanCalculationNode::dump(StringBuilder& builder, int indent) const
@ -1416,9 +1391,9 @@ ErrorOr<void> AtanCalculationNode::dump(StringBuilder& builder, int indent) cons
return {};
}
ErrorOr<NonnullOwnPtr<Atan2CalculationNode>> Atan2CalculationNode::create(NonnullOwnPtr<CalculationNode> y, NonnullOwnPtr<CalculationNode> x)
NonnullOwnPtr<Atan2CalculationNode> Atan2CalculationNode::create(NonnullOwnPtr<CalculationNode> y, NonnullOwnPtr<CalculationNode> x)
{
return adopt_nonnull_own_or_enomem(new (nothrow) Atan2CalculationNode(move(y), move(x)));
return adopt_own(*new (nothrow) Atan2CalculationNode(move(y), move(x)));
}
Atan2CalculationNode::Atan2CalculationNode(NonnullOwnPtr<CalculationNode> y, NonnullOwnPtr<CalculationNode> x)
@ -1471,13 +1446,12 @@ CalculatedStyleValue::CalculationResult Atan2CalculationNode::resolve(Optional<L
return { Angle(result, Angle::Type::Rad) };
}
ErrorOr<void> Atan2CalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void Atan2CalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_y->for_each_child_node(callback));
TRY(m_x->for_each_child_node(callback));
TRY(callback(m_y));
TRY(callback(m_x));
return {};
m_y->for_each_child_node(callback);
m_x->for_each_child_node(callback);
callback(m_y);
callback(m_x);
}
ErrorOr<void> Atan2CalculationNode::dump(StringBuilder& builder, int indent) const
@ -1486,9 +1460,9 @@ ErrorOr<void> Atan2CalculationNode::dump(StringBuilder& builder, int indent) con
return {};
}
ErrorOr<NonnullOwnPtr<PowCalculationNode>> PowCalculationNode::create(NonnullOwnPtr<CalculationNode> x, NonnullOwnPtr<CalculationNode> y)
NonnullOwnPtr<PowCalculationNode> PowCalculationNode::create(NonnullOwnPtr<CalculationNode> x, NonnullOwnPtr<CalculationNode> y)
{
return adopt_nonnull_own_or_enomem(new (nothrow) PowCalculationNode(move(x), move(y)));
return adopt_own(*new (nothrow) PowCalculationNode(move(x), move(y)));
}
PowCalculationNode::PowCalculationNode(NonnullOwnPtr<CalculationNode> x, NonnullOwnPtr<CalculationNode> y)
@ -1536,13 +1510,12 @@ CalculatedStyleValue::CalculationResult PowCalculationNode::resolve(Optional<Len
return { Number(Number::Type::Number, result) };
}
ErrorOr<void> PowCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void PowCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_x->for_each_child_node(callback));
TRY(m_y->for_each_child_node(callback));
TRY(callback(m_x));
TRY(callback(m_y));
return {};
m_x->for_each_child_node(callback);
m_y->for_each_child_node(callback);
callback(m_x);
callback(m_y);
}
ErrorOr<void> PowCalculationNode::dump(StringBuilder& builder, int indent) const
@ -1551,9 +1524,9 @@ ErrorOr<void> PowCalculationNode::dump(StringBuilder& builder, int indent) const
return {};
}
ErrorOr<NonnullOwnPtr<SqrtCalculationNode>> SqrtCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
NonnullOwnPtr<SqrtCalculationNode> SqrtCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
{
return adopt_nonnull_own_or_enomem(new (nothrow) SqrtCalculationNode(move(value)));
return adopt_own(*new (nothrow) SqrtCalculationNode(move(value)));
}
SqrtCalculationNode::SqrtCalculationNode(NonnullOwnPtr<CalculationNode> value)
@ -1594,11 +1567,10 @@ CalculatedStyleValue::CalculationResult SqrtCalculationNode::resolve(Optional<Le
return { Number(Number::Type::Number, result) };
}
ErrorOr<void> SqrtCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void SqrtCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_value->for_each_child_node(callback));
TRY(callback(m_value));
return {};
m_value->for_each_child_node(callback);
callback(m_value);
}
ErrorOr<void> SqrtCalculationNode::dump(StringBuilder& builder, int indent) const
@ -1607,9 +1579,9 @@ ErrorOr<void> SqrtCalculationNode::dump(StringBuilder& builder, int indent) cons
return {};
}
ErrorOr<NonnullOwnPtr<HypotCalculationNode>> HypotCalculationNode::create(Vector<NonnullOwnPtr<Web::CSS::CalculationNode>> values)
NonnullOwnPtr<HypotCalculationNode> HypotCalculationNode::create(Vector<NonnullOwnPtr<Web::CSS::CalculationNode>> values)
{
return adopt_nonnull_own_or_enomem(new (nothrow) HypotCalculationNode(move(values)));
return adopt_own(*new (nothrow) HypotCalculationNode(move(values)));
}
HypotCalculationNode::HypotCalculationNode(Vector<NonnullOwnPtr<CalculationNode>> values)
@ -1672,14 +1644,12 @@ CalculatedStyleValue::CalculationResult HypotCalculationNode::resolve(Optional<L
return to_resolved_type(resolved_type().value(), result);
}
ErrorOr<void> HypotCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void HypotCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
for (auto& value : m_values) {
TRY(value->for_each_child_node(callback));
TRY(callback(value));
value->for_each_child_node(callback);
callback(value);
}
return {};
}
ErrorOr<void> HypotCalculationNode::dump(StringBuilder& builder, int indent) const
@ -1690,9 +1660,9 @@ ErrorOr<void> HypotCalculationNode::dump(StringBuilder& builder, int indent) con
return {};
}
ErrorOr<NonnullOwnPtr<LogCalculationNode>> LogCalculationNode::create(NonnullOwnPtr<CalculationNode> x, NonnullOwnPtr<CalculationNode> y)
NonnullOwnPtr<LogCalculationNode> LogCalculationNode::create(NonnullOwnPtr<CalculationNode> x, NonnullOwnPtr<CalculationNode> y)
{
return adopt_nonnull_own_or_enomem(new (nothrow) LogCalculationNode(move(x), move(y)));
return adopt_own(*new (nothrow) LogCalculationNode(move(x), move(y)));
}
LogCalculationNode::LogCalculationNode(NonnullOwnPtr<CalculationNode> x, NonnullOwnPtr<CalculationNode> y)
@ -1740,13 +1710,12 @@ CalculatedStyleValue::CalculationResult LogCalculationNode::resolve(Optional<Len
return { Number(Number::Type::Number, result) };
}
ErrorOr<void> LogCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void LogCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_x->for_each_child_node(callback));
TRY(m_y->for_each_child_node(callback));
TRY(callback(m_x));
TRY(callback(m_y));
return {};
m_x->for_each_child_node(callback);
m_y->for_each_child_node(callback);
callback(m_x);
callback(m_y);
}
ErrorOr<void> LogCalculationNode::dump(StringBuilder& builder, int indent) const
@ -1755,9 +1724,9 @@ ErrorOr<void> LogCalculationNode::dump(StringBuilder& builder, int indent) const
return {};
}
ErrorOr<NonnullOwnPtr<ExpCalculationNode>> ExpCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
NonnullOwnPtr<ExpCalculationNode> ExpCalculationNode::create(NonnullOwnPtr<CalculationNode> value)
{
return adopt_nonnull_own_or_enomem(new (nothrow) ExpCalculationNode(move(value)));
return adopt_own(*new (nothrow) ExpCalculationNode(move(value)));
}
ExpCalculationNode::ExpCalculationNode(NonnullOwnPtr<CalculationNode> value)
@ -1798,11 +1767,10 @@ CalculatedStyleValue::CalculationResult ExpCalculationNode::resolve(Optional<Len
return { Number(Number::Type::Number, result) };
}
ErrorOr<void> ExpCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void ExpCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_value->for_each_child_node(callback));
TRY(callback(m_value));
return {};
m_value->for_each_child_node(callback);
callback(m_value);
}
ErrorOr<void> ExpCalculationNode::dump(StringBuilder& builder, int indent) const
@ -1811,9 +1779,9 @@ ErrorOr<void> ExpCalculationNode::dump(StringBuilder& builder, int indent) const
return {};
}
ErrorOr<NonnullOwnPtr<RoundCalculationNode>> RoundCalculationNode::create(RoundingStrategy strategy, NonnullOwnPtr<CalculationNode> x, NonnullOwnPtr<CalculationNode> y)
NonnullOwnPtr<RoundCalculationNode> RoundCalculationNode::create(RoundingStrategy strategy, NonnullOwnPtr<CalculationNode> x, NonnullOwnPtr<CalculationNode> y)
{
return adopt_nonnull_own_or_enomem(new (nothrow) RoundCalculationNode(strategy, move(x), move(y)));
return adopt_own(*new (nothrow) RoundCalculationNode(strategy, move(x), move(y)));
}
RoundCalculationNode::RoundCalculationNode(RoundingStrategy mode, NonnullOwnPtr<CalculationNode> x, NonnullOwnPtr<CalculationNode> y)
@ -1900,13 +1868,12 @@ CalculatedStyleValue::CalculationResult RoundCalculationNode::resolve(Optional<L
VERIFY_NOT_REACHED();
}
ErrorOr<void> RoundCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void RoundCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_x->for_each_child_node(callback));
TRY(m_y->for_each_child_node(callback));
TRY(callback(m_x));
TRY(callback(m_y));
return {};
m_x->for_each_child_node(callback);
m_y->for_each_child_node(callback);
callback(m_x);
callback(m_y);
}
ErrorOr<void> RoundCalculationNode::dump(StringBuilder& builder, int indent) const
@ -1915,9 +1882,9 @@ ErrorOr<void> RoundCalculationNode::dump(StringBuilder& builder, int indent) con
return {};
}
ErrorOr<NonnullOwnPtr<ModCalculationNode>> ModCalculationNode::create(NonnullOwnPtr<CalculationNode> x, NonnullOwnPtr<CalculationNode> y)
NonnullOwnPtr<ModCalculationNode> ModCalculationNode::create(NonnullOwnPtr<CalculationNode> x, NonnullOwnPtr<CalculationNode> y)
{
return adopt_nonnull_own_or_enomem(new (nothrow) ModCalculationNode(move(x), move(y)));
return adopt_own(*new (nothrow) ModCalculationNode(move(x), move(y)));
}
ModCalculationNode::ModCalculationNode(NonnullOwnPtr<CalculationNode> x, NonnullOwnPtr<CalculationNode> y)
@ -1978,13 +1945,12 @@ CalculatedStyleValue::CalculationResult ModCalculationNode::resolve(Optional<Len
return to_resolved_type(resolved_type, value);
}
ErrorOr<void> ModCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void ModCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_x->for_each_child_node(callback));
TRY(m_y->for_each_child_node(callback));
TRY(callback(m_x));
TRY(callback(m_y));
return {};
m_x->for_each_child_node(callback);
m_y->for_each_child_node(callback);
callback(m_x);
callback(m_y);
}
ErrorOr<void> ModCalculationNode::dump(StringBuilder& builder, int indent) const
@ -1993,9 +1959,9 @@ ErrorOr<void> ModCalculationNode::dump(StringBuilder& builder, int indent) const
return {};
}
ErrorOr<NonnullOwnPtr<RemCalculationNode>> RemCalculationNode::create(NonnullOwnPtr<CalculationNode> x, NonnullOwnPtr<CalculationNode> y)
NonnullOwnPtr<RemCalculationNode> RemCalculationNode::create(NonnullOwnPtr<CalculationNode> x, NonnullOwnPtr<CalculationNode> y)
{
return adopt_nonnull_own_or_enomem(new (nothrow) RemCalculationNode(move(x), move(y)));
return adopt_own(*new (nothrow) RemCalculationNode(move(x), move(y)));
}
RemCalculationNode::RemCalculationNode(NonnullOwnPtr<CalculationNode> x, NonnullOwnPtr<CalculationNode> y)
@ -2055,13 +2021,12 @@ CalculatedStyleValue::CalculationResult RemCalculationNode::resolve(Optional<Len
return to_resolved_type(resolved_type, value);
}
ErrorOr<void> RemCalculationNode::for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const& callback)
void RemCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const& callback)
{
TRY(m_x->for_each_child_node(callback));
TRY(m_y->for_each_child_node(callback));
TRY(callback(m_x));
TRY(callback(m_y));
return {};
m_x->for_each_child_node(callback);
m_y->for_each_child_node(callback);
callback(m_x);
callback(m_y);
}
ErrorOr<void> RemCalculationNode::dump(StringBuilder& builder, int indent) const

View file

@ -238,7 +238,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const = 0;
virtual bool contains_percentage() const = 0;
virtual CalculatedStyleValue::CalculationResult resolve(Optional<Length::ResolutionContext const&>, CalculatedStyleValue::PercentageBasis const&) const = 0;
virtual ErrorOr<void> for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const&) { return {}; }
virtual void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) = 0;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const = 0;
@ -251,7 +251,7 @@ private:
class NumericCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<NumericCalculationNode>> create(NumericValue);
static NonnullOwnPtr<NumericCalculationNode> create(NumericValue);
~NumericCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -259,6 +259,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
virtual CalculatedStyleValue::CalculationResult resolve(Optional<Length::ResolutionContext const&>, CalculatedStyleValue::PercentageBasis const&) const override;
virtual void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override { }
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -269,7 +270,7 @@ private:
class SumCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<SumCalculationNode>> create(Vector<NonnullOwnPtr<CalculationNode>>);
static NonnullOwnPtr<SumCalculationNode> create(Vector<NonnullOwnPtr<CalculationNode>>);
~SumCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -277,7 +278,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -288,7 +289,7 @@ private:
class ProductCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<ProductCalculationNode>> create(Vector<NonnullOwnPtr<CalculationNode>>);
static NonnullOwnPtr<ProductCalculationNode> create(Vector<NonnullOwnPtr<CalculationNode>>);
~ProductCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -296,7 +297,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -307,7 +308,7 @@ private:
class NegateCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<NegateCalculationNode>> create(NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<NegateCalculationNode> create(NonnullOwnPtr<CalculationNode>);
~NegateCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -315,7 +316,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -326,7 +327,7 @@ private:
class InvertCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<InvertCalculationNode>> create(NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<InvertCalculationNode> create(NonnullOwnPtr<CalculationNode>);
~InvertCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -334,7 +335,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -345,7 +346,7 @@ private:
class MinCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<MinCalculationNode>> create(Vector<NonnullOwnPtr<CalculationNode>>);
static NonnullOwnPtr<MinCalculationNode> create(Vector<NonnullOwnPtr<CalculationNode>>);
~MinCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -353,7 +354,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -364,7 +365,7 @@ private:
class MaxCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<MaxCalculationNode>> create(Vector<NonnullOwnPtr<CalculationNode>>);
static NonnullOwnPtr<MaxCalculationNode> create(Vector<NonnullOwnPtr<CalculationNode>>);
~MaxCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -372,7 +373,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -383,7 +384,7 @@ private:
class ClampCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<ClampCalculationNode>> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<ClampCalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
~ClampCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -391,7 +392,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -404,7 +405,7 @@ private:
class AbsCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<AbsCalculationNode>> create(NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<AbsCalculationNode> create(NonnullOwnPtr<CalculationNode>);
~AbsCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -412,7 +413,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -423,7 +424,7 @@ private:
class SignCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<SignCalculationNode>> create(NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<SignCalculationNode> create(NonnullOwnPtr<CalculationNode>);
~SignCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -431,7 +432,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -442,7 +443,7 @@ private:
class ConstantCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<ConstantCalculationNode>> create(CalculationNode::ConstantType);
static NonnullOwnPtr<ConstantCalculationNode> create(CalculationNode::ConstantType);
~ConstantCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -450,7 +451,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override { return false; }
virtual CalculatedStyleValue::CalculationResult resolve(Optional<Length::ResolutionContext const&> context, CalculatedStyleValue::PercentageBasis const&) const override;
virtual ErrorOr<void> for_each_child_node(Function<ErrorOr<void>(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override { }
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -461,7 +462,7 @@ private:
class SinCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<SinCalculationNode>> create(NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<SinCalculationNode> create(NonnullOwnPtr<CalculationNode>);
~SinCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -469,7 +470,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -480,7 +481,7 @@ private:
class CosCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<CosCalculationNode>> create(NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<CosCalculationNode> create(NonnullOwnPtr<CalculationNode>);
~CosCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -488,7 +489,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -499,7 +500,7 @@ private:
class TanCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<TanCalculationNode>> create(NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<TanCalculationNode> create(NonnullOwnPtr<CalculationNode>);
~TanCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -507,7 +508,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -518,7 +519,7 @@ private:
class AsinCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<AsinCalculationNode>> create(NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<AsinCalculationNode> create(NonnullOwnPtr<CalculationNode>);
~AsinCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -526,7 +527,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -537,7 +538,7 @@ private:
class AcosCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<AcosCalculationNode>> create(NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<AcosCalculationNode> create(NonnullOwnPtr<CalculationNode>);
~AcosCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -545,7 +546,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -556,7 +557,7 @@ private:
class AtanCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<AtanCalculationNode>> create(NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<AtanCalculationNode> create(NonnullOwnPtr<CalculationNode>);
~AtanCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -564,7 +565,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -575,7 +576,7 @@ private:
class Atan2CalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<Atan2CalculationNode>> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<Atan2CalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
~Atan2CalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -583,7 +584,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -595,7 +596,7 @@ private:
class PowCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<PowCalculationNode>> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<PowCalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
~PowCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -603,7 +604,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) 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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -615,7 +616,7 @@ private:
class SqrtCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<SqrtCalculationNode>> create(NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<SqrtCalculationNode> create(NonnullOwnPtr<CalculationNode>);
~SqrtCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -623,7 +624,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) 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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -634,7 +635,7 @@ private:
class HypotCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<HypotCalculationNode>> create(Vector<NonnullOwnPtr<CalculationNode>>);
static NonnullOwnPtr<HypotCalculationNode> create(Vector<NonnullOwnPtr<CalculationNode>>);
~HypotCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -642,7 +643,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -653,7 +654,7 @@ private:
class LogCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<LogCalculationNode>> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<LogCalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
~LogCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -661,7 +662,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) 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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -673,7 +674,7 @@ private:
class ExpCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<ExpCalculationNode>> create(NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<ExpCalculationNode> create(NonnullOwnPtr<CalculationNode>);
~ExpCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -681,7 +682,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) 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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -692,7 +693,7 @@ private:
class RoundCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<RoundCalculationNode>> create(RoundingStrategy, NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<RoundCalculationNode> create(RoundingStrategy, NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
~RoundCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -700,7 +701,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -713,7 +714,7 @@ private:
class ModCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<ModCalculationNode>> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<ModCalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
~ModCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -721,7 +722,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;
@ -733,7 +734,7 @@ private:
class RemCalculationNode final : public CalculationNode {
public:
static ErrorOr<NonnullOwnPtr<RemCalculationNode>> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
static NonnullOwnPtr<RemCalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
~RemCalculationNode();
virtual ErrorOr<String> to_string() const override;
@ -741,7 +742,7 @@ public:
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
virtual bool contains_percentage() const override;
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 void for_each_child_node(Function<void(NonnullOwnPtr<CalculationNode>&)> const&) override;
virtual ErrorOr<void> dump(StringBuilder&, int indent) const override;