diff --git a/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp index e71e69636f3..f7f87535265 100644 --- a/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp +++ b/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp @@ -2926,8 +2926,9 @@ NonnullRefPtr simplify_a_calculation_tree(CalculationNode // running root’s operation using its children, expressed in the result’s canonical unit. if (root->is_math_function_node()) { if (auto maybe_simplified = root->run_operation_if_possible(context, resolution_context); maybe_simplified.has_value()) { - // NOTE: If this returns nullptr, that's a logic error in the code, so it's fine to assert that it's nonnull. - return make_calculation_node(maybe_simplified.release_value(), context).release_nonnull(); + if (auto node = make_calculation_node(maybe_simplified.release_value(), context)) + return node.release_nonnull(); + return root; } } diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-values/minmax-length-invalid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-values/minmax-length-invalid.txt new file mode 100644 index 00000000000..5ecbf93ca27 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-values/minmax-length-invalid.txt @@ -0,0 +1,54 @@ +Harness status: OK + +Found 48 tests + +46 Pass +2 Fail +Pass e.style['border-left-width'] = "min()" should not set the property value +Pass e.style['border-left-width'] = "min( )" should not set the property value +Pass e.style['border-left-width'] = "min(,)" should not set the property value +Pass e.style['border-left-width'] = "min(1py)" should not set the property value +Pass e.style['border-left-width'] = "min(1px, )" should not set the property value +Pass e.style['border-left-width'] = "min(, 1px)" should not set the property value +Pass e.style['border-left-width'] = "min(1px + )" should not set the property value +Pass e.style['border-left-width'] = "min(1px - )" should not set the property value +Pass e.style['border-left-width'] = "min(1px * )" should not set the property value +Pass e.style['border-left-width'] = "min(1px / )" should not set the property value +Fail e.style['border-left-width'] = "min(1px 2px)" should not set the property value +Pass e.style['border-left-width'] = "min(1px, , 2px)" should not set the property value +Pass e.style['border-left-width'] = "max()" should not set the property value +Pass e.style['border-left-width'] = "max( )" should not set the property value +Pass e.style['border-left-width'] = "max(,)" should not set the property value +Pass e.style['border-left-width'] = "max(1py)" should not set the property value +Pass e.style['border-left-width'] = "max(1px, )" should not set the property value +Pass e.style['border-left-width'] = "max(, 1px)" should not set the property value +Pass e.style['border-left-width'] = "max(1px + )" should not set the property value +Pass e.style['border-left-width'] = "max(1px - )" should not set the property value +Pass e.style['border-left-width'] = "max(1px * )" should not set the property value +Pass e.style['border-left-width'] = "max(1px / )" should not set the property value +Fail e.style['border-left-width'] = "max(1px 2px)" should not set the property value +Pass e.style['border-left-width'] = "max(1px, , 2px)" should not set the property value +Pass e.style['border-left-width'] = "min(0)" should not set the property value +Pass e.style['border-left-width'] = "min(0%)" should not set the property value +Pass e.style['border-left-width'] = "min(0s)" should not set the property value +Pass e.style['border-left-width'] = "min(0Hz)" should not set the property value +Pass e.style['border-left-width'] = "min(0dpi)" should not set the property value +Pass e.style['border-left-width'] = "min(0fr)" should not set the property value +Pass e.style['border-left-width'] = "min(1px, 0)" should not set the property value +Pass e.style['border-left-width'] = "min(1px, 0%)" should not set the property value +Pass e.style['border-left-width'] = "min(1px, 0s)" should not set the property value +Pass e.style['border-left-width'] = "min(1px, 0Hz)" should not set the property value +Pass e.style['border-left-width'] = "min(1px, 0dpi)" should not set the property value +Pass e.style['border-left-width'] = "min(1px, 0fr)" should not set the property value +Pass e.style['border-left-width'] = "max(0)" should not set the property value +Pass e.style['border-left-width'] = "max(0%)" should not set the property value +Pass e.style['border-left-width'] = "max(0s)" should not set the property value +Pass e.style['border-left-width'] = "max(0Hz)" should not set the property value +Pass e.style['border-left-width'] = "max(0dpi)" should not set the property value +Pass e.style['border-left-width'] = "max(0fr)" should not set the property value +Pass e.style['border-left-width'] = "max(1px, 0)" should not set the property value +Pass e.style['border-left-width'] = "max(1px, 0%)" should not set the property value +Pass e.style['border-left-width'] = "max(1px, 0s)" should not set the property value +Pass e.style['border-left-width'] = "max(1px, 0Hz)" should not set the property value +Pass e.style['border-left-width'] = "max(1px, 0dpi)" should not set the property value +Pass e.style['border-left-width'] = "max(1px, 0fr)" should not set the property value \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-values/minmax-length-invalid.html b/Tests/LibWeb/Text/input/wpt-import/css/css-values/minmax-length-invalid.html new file mode 100644 index 00000000000..d71d43a2b39 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/css-values/minmax-length-invalid.html @@ -0,0 +1,66 @@ + + + + + + + + +