diff --git a/Libraries/LibWeb/CSS/CSSNumericType.cpp b/Libraries/LibWeb/CSS/CSSNumericType.cpp index 7064acb0324..2e1b11630d3 100644 --- a/Libraries/LibWeb/CSS/CSSNumericType.cpp +++ b/Libraries/LibWeb/CSS/CSSNumericType.cpp @@ -38,6 +38,7 @@ Optional CSSNumericType::base_type_from_value_type(Val case ValueType::CustomIdent: case ValueType::EasingFunction: case ValueType::FilterValueList: + case ValueType::FitContent: case ValueType::Image: case ValueType::Integer: case ValueType::Number: diff --git a/Libraries/LibWeb/CSS/CSSStyleValue.cpp b/Libraries/LibWeb/CSS/CSSStyleValue.cpp index 3af2e2b850d..bcb7f70cbaa 100644 --- a/Libraries/LibWeb/CSS/CSSStyleValue.cpp +++ b/Libraries/LibWeb/CSS/CSSStyleValue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2024, Andreas Kling + * Copyright (c) 2018-2025, Andreas Kling * Copyright (c) 2021-2024, Sam Atkins * Copyright (c) 2021, Tobias Christiansen * Copyright (c) 2022-2023, MacDue @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -175,6 +176,12 @@ FilterValueListStyleValue const& CSSStyleValue::as_filter_value_list() const return static_cast(*this); } +FitContentStyleValue const& CSSStyleValue::as_fit_content() const +{ + VERIFY(is_fit_content()); + return static_cast(*this); +} + FlexStyleValue const& CSSStyleValue::as_flex() const { VERIFY(is_flex()); diff --git a/Libraries/LibWeb/CSS/CSSStyleValue.h b/Libraries/LibWeb/CSS/CSSStyleValue.h index 380f124921d..9e74a7271df 100644 --- a/Libraries/LibWeb/CSS/CSSStyleValue.h +++ b/Libraries/LibWeb/CSS/CSSStyleValue.h @@ -106,6 +106,7 @@ public: Easing, Edge, FilterValueList, + FitContent, Flex, FontVariant, Frequency, @@ -216,6 +217,10 @@ public: FilterValueListStyleValue const& as_filter_value_list() const; FilterValueListStyleValue& as_filter_value_list() { return const_cast(const_cast(*this).as_filter_value_list()); } + [[nodiscard]] bool is_fit_content() const { return type() == Type::FitContent; } + [[nodiscard]] FitContentStyleValue const& as_fit_content() const; + [[nodiscard]] FitContentStyleValue& as_fit_content() { return const_cast(const_cast(*this).as_fit_content()); } + bool is_flex() const { return type() == Type::Flex; } FlexStyleValue const& as_flex() const; FlexStyleValue& as_flex() { return const_cast(const_cast(*this).as_flex()); } diff --git a/Libraries/LibWeb/CSS/ComputedProperties.cpp b/Libraries/LibWeb/CSS/ComputedProperties.cpp index ee30d080b80..548178ffd0e 100644 --- a/Libraries/LibWeb/CSS/ComputedProperties.cpp +++ b/Libraries/LibWeb/CSS/ComputedProperties.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2024, Andreas Kling + * Copyright (c) 2018-2025, Andreas Kling * Copyright (c) 2021-2025, Sam Atkins * * SPDX-License-Identifier: BSD-2-Clause @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -158,14 +159,16 @@ Size ComputedProperties::size_value(PropertyID id) const return Size::make_min_content(); case Keyword::MaxContent: return Size::make_max_content(); - case Keyword::FitContent: - return Size::make_fit_content(); case Keyword::None: return Size::make_none(); default: VERIFY_NOT_REACHED(); } } + if (value.is_fit_content()) { + auto& fit_content = value.as_fit_content(); + return Size::make_fit_content(fit_content.length_percentage()); + } if (value.is_calculated()) return Size::make_calculated(value.as_calculated()); diff --git a/Libraries/LibWeb/CSS/Keywords.json b/Libraries/LibWeb/CSS/Keywords.json index f724dc4c220..eff596994d6 100644 --- a/Libraries/LibWeb/CSS/Keywords.json +++ b/Libraries/LibWeb/CSS/Keywords.json @@ -175,7 +175,6 @@ "fill", "fill-box", "fine", - "fit-content", "fixed", "flex", "flex-end", diff --git a/Libraries/LibWeb/CSS/Parser/Parser.h b/Libraries/LibWeb/CSS/Parser/Parser.h index ea7bb17aad6..c473a2a946c 100644 --- a/Libraries/LibWeb/CSS/Parser/Parser.h +++ b/Libraries/LibWeb/CSS/Parser/Parser.h @@ -264,7 +264,7 @@ private: Optional parse_unicode_range(StringView); Vector parse_unicode_ranges(TokenStream&); Optional parse_grid_size(ComponentValue const&); - Optional parse_fit_content(Vector const&); + Optional parse_grid_fit_content(Vector const&); Optional parse_min_max(Vector const&); Optional parse_repeat(Vector const&); Optional parse_track_sizing_function(ComponentValue const&); @@ -275,6 +275,8 @@ private: Optional parse_shape_radius(TokenStream&); RefPtr parse_basic_shape_value(TokenStream&); + RefPtr parse_fit_content_value(TokenStream&); + template Optional> parse_color_stop_list(TokenStream& tokens, auto parse_position); Optional> parse_linear_color_stop_list(TokenStream&); diff --git a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp index 4967c54bdf4..0ecc1684299 100644 --- a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2024, Andreas Kling + * Copyright (c) 2018-2025, Andreas Kling * Copyright (c) 2020-2021, the SerenityOS developers. * Copyright (c) 2021-2025, Sam Atkins * Copyright (c) 2021, Tobias Christiansen @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -301,6 +302,12 @@ Optional Parser::parse_css_value_for_properties(Readon } } + if (auto property = any_property_accepts_type(property_ids, ValueType::FitContent); property.has_value()) { + auto context_guard = push_temporary_value_parsing_context(*property); + if (auto value = parse_fit_content_value(tokens)) + return PropertyAndValue { *property, value }; + } + if (auto property = any_property_accepts_type(property_ids, ValueType::Length); property.has_value()) { auto context_guard = push_temporary_value_parsing_context(*property); if (property_accepts_type(*property, ValueType::Percentage)) { diff --git a/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp b/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp index faedd4a824b..eaf2808e54b 100644 --- a/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -2538,6 +2539,38 @@ Optional Parser::parse_shape_radius(TokenStream& to return {}; } +RefPtr Parser::parse_fit_content_value(TokenStream& tokens) +{ + auto transaction = tokens.begin_transaction(); + auto& component_value = tokens.consume_a_token(); + + if (component_value.is_ident("fit-content"sv)) { + transaction.commit(); + return FitContentStyleValue::create(); + return nullptr; + } + + if (!component_value.is_function()) + return nullptr; + + auto const& function = component_value.function(); + if (function.name != "fit-content"sv) + return nullptr; + if (function.value.size() != 1) + return nullptr; + TokenStream argument_tokens { function.value }; + argument_tokens.discard_whitespace(); + auto maybe_length = parse_length_percentage(argument_tokens); + if (!maybe_length.has_value()) + return nullptr; + argument_tokens.discard_whitespace(); + if (argument_tokens.has_next_token()) + return nullptr; + + transaction.commit(); + return FitContentStyleValue::create(maybe_length.release_value()); +} + RefPtr Parser::parse_basic_shape_value(TokenStream& tokens) { auto transaction = tokens.begin_transaction(); @@ -2875,7 +2908,7 @@ Optional Parser::parse_grid_size(ComponentValue const& component_ return {}; } -Optional Parser::parse_fit_content(Vector const& component_values) +Optional Parser::parse_grid_fit_content(Vector const& component_values) { // https://www.w3.org/TR/css-grid-2/#valdef-grid-template-columns-fit-content // 'fit-content( )' @@ -3050,7 +3083,7 @@ Optional Parser::parse_track_sizing_function(ComponentVa else return {}; } else if (function_token.name.equals_ignoring_ascii_case("fit-content"sv)) { - auto maybe_fit_content_value = parse_fit_content(function_token.value); + auto maybe_fit_content_value = parse_grid_fit_content(function_token.value); if (maybe_fit_content_value.has_value()) return CSS::ExplicitGridTrack(maybe_fit_content_value.value()); return {}; diff --git a/Libraries/LibWeb/CSS/Properties.json b/Libraries/LibWeb/CSS/Properties.json index d5f79efe717..7c1a8a8b3cf 100644 --- a/Libraries/LibWeb/CSS/Properties.json +++ b/Libraries/LibWeb/CSS/Properties.json @@ -1131,13 +1131,13 @@ "inherited": false, "initial": "auto", "valid-types": [ + "fit-content", "length [0,∞]", "percentage [0,∞]" ], "valid-identifiers": [ "auto", "content", - "fit-content", "max-content", "min-content" ], @@ -1614,12 +1614,12 @@ "inherited": false, "initial": "auto", "valid-types": [ + "fit-content", "length [0,∞]", "percentage [0,∞]" ], "valid-identifiers": [ "auto", - "fit-content", "max-content", "min-content" ], @@ -2032,11 +2032,11 @@ "inherited": false, "initial": "none", "valid-types": [ + "fit-content", "length [0,∞]", "percentage [0,∞]" ], "valid-identifiers": [ - "fit-content", "max-content", "min-content", "none" @@ -2058,11 +2058,11 @@ "inherited": false, "initial": "none", "valid-types": [ + "fit-content", "length [0,∞]", "percentage [0,∞]" ], "valid-identifiers": [ - "fit-content", "max-content", "min-content", "none" @@ -2084,12 +2084,12 @@ "inherited": false, "initial": "auto", "valid-types": [ + "fit-content", "length [0,∞]", "percentage [0,∞]" ], "valid-identifiers": [ "auto", - "fit-content", "max-content", "min-content" ], @@ -2110,12 +2110,12 @@ "inherited": false, "initial": "auto", "valid-types": [ + "fit-content", "length [0,∞]", "percentage [0,∞]" ], "valid-identifiers": [ "auto", - "fit-content", "max-content", "min-content" ], @@ -2936,12 +2936,12 @@ "inherited": false, "initial": "auto", "valid-types": [ + "fit-content", "length [0,∞]", "percentage [0,∞]" ], "valid-identifiers": [ "auto", - "fit-content", "max-content", "min-content" ], diff --git a/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index 07cec6d626c..9e9fb51bea5 100644 --- a/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023, Andreas Kling + * Copyright (c) 2021-2025, Andreas Kling * Copyright (c) 2021, Tobias Christiansen * Copyright (c) 2022-2025, Sam Atkins * @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -96,9 +97,8 @@ static NonnullRefPtr style_value_for_size(Size const& size) return CSSKeywordValue::create(Keyword::MinContent); if (size.is_max_content()) return CSSKeywordValue::create(Keyword::MaxContent); - // FIXME: Support fit-content() if (size.is_fit_content()) - return CSSKeywordValue::create(Keyword::FitContent); + return FitContentStyleValue::create(size.fit_content_available_space()); TODO(); } diff --git a/Libraries/LibWeb/CSS/Size.cpp b/Libraries/LibWeb/CSS/Size.cpp index 1a1e285d1b5..0abb75befbe 100644 --- a/Libraries/LibWeb/CSS/Size.cpp +++ b/Libraries/LibWeb/CSS/Size.cpp @@ -54,7 +54,7 @@ Size Size::make_max_content() return Size { Type::MaxContent, Length::make_auto() }; } -Size Size::make_fit_content(Length available_space) +Size Size::make_fit_content(LengthPercentage available_space) { return Size { Type::FitContent, move(available_space) }; } @@ -78,6 +78,10 @@ bool Size::contains_percentage() const case Type::MaxContent: case Type::None: return false; + case Type::FitContent: + // FIXME: This should return m_length_percentage.contains_percentage() + // but we have to update a lot of code to handle this. + return false; default: return m_length_percentage.contains_percentage(); } diff --git a/Libraries/LibWeb/CSS/Size.h b/Libraries/LibWeb/CSS/Size.h index 8bb2342e80d..cd9514f88c3 100644 --- a/Libraries/LibWeb/CSS/Size.h +++ b/Libraries/LibWeb/CSS/Size.h @@ -32,7 +32,7 @@ public: static Size make_calculated(NonnullRefPtr); static Size make_min_content(); static Size make_max_content(); - static Size make_fit_content(Length available_space); + static Size make_fit_content(LengthPercentage available_space); static Size make_fit_content(); static Size make_none(); @@ -67,10 +67,10 @@ public: return m_length_percentage.percentage(); } - CSS::Length const& fit_content_available_space() const + CSS::LengthPercentage const& fit_content_available_space() const { VERIFY(is_fit_content()); - return m_length_percentage.length(); + return m_length_percentage; } String to_string() const; diff --git a/Libraries/LibWeb/CSS/StyleValues/FitContentStyleValue.h b/Libraries/LibWeb/CSS/StyleValues/FitContentStyleValue.h new file mode 100644 index 00000000000..ce399084fd7 --- /dev/null +++ b/Libraries/LibWeb/CSS/StyleValues/FitContentStyleValue.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2025, Andreas Kling + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include + +namespace Web::CSS { + +class FitContentStyleValue final : public CSSStyleValue { +public: + static ValueComparingNonnullRefPtr create() + { + return adopt_ref(*new (nothrow) FitContentStyleValue(LengthPercentage { Length::make_auto() })); + } + static ValueComparingNonnullRefPtr create(LengthPercentage length_percentage) + { + return adopt_ref(*new (nothrow) FitContentStyleValue(move(length_percentage))); + } + virtual ~FitContentStyleValue() override = default; + + virtual String to_string(SerializationMode) const override + { + if (m_length_percentage.is_auto()) + return "fit-content"_string; + return MUST(String::formatted("fit-content({})", m_length_percentage.to_string())); + } + + bool equals(CSSStyleValue const& other) const override + { + if (type() != other.type()) + return false; + return m_length_percentage == other.as_fit_content().m_length_percentage; + } + + [[nodiscard]] LengthPercentage const& length_percentage() const { return m_length_percentage; } + +private: + FitContentStyleValue(LengthPercentage length_percentage) + : CSSStyleValue(Type::FitContent) + , m_length_percentage(move(length_percentage)) + { + } + + LengthPercentage m_length_percentage; +}; + +} diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h index e322d35d700..10ca198be10 100644 --- a/Libraries/LibWeb/Forward.h +++ b/Libraries/LibWeb/Forward.h @@ -176,6 +176,7 @@ class EdgeStyleValue; class ElementInlineCSSStyleDeclaration; class ExplicitGridTrack; class FilterValueListStyleValue; +class FitContentStyleValue; class Flex; class FlexOrCalculated; class FlexStyleValue; diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp index 19970462957..858b258835f 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp @@ -30,6 +30,7 @@ static bool type_name_is_enum(StringView type_name) "custom-ident"sv, "easing-function"sv, "flex"sv, + "fit-content"sv, "frequency"sv, "image"sv, "integer"sv, @@ -230,6 +231,7 @@ enum class ValueType { CustomIdent, EasingFunction, FilterValueList, + FitContent, Flex, Frequency, Image, @@ -801,6 +803,8 @@ bool property_accepts_type(PropertyID property_id, ValueType value_type) property_generator.appendln(" case ValueType::CustomIdent:"); } else if (type_name == "easing-function") { property_generator.appendln(" case ValueType::EasingFunction:"); + } else if (type_name == "fit-content") { + property_generator.appendln(" case ValueType::FitContent:"); } else if (type_name == "flex") { property_generator.appendln(" case ValueType::Flex:"); } else if (type_name == "frequency") { diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/height-valid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/height-valid.txt index a329014aa4c..a8ba9c1b9b0 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/height-valid.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/height-valid.txt @@ -2,8 +2,8 @@ Harness status: OK Found 10 tests -6 Pass -4 Fail +8 Pass +2 Fail Pass e.style['height'] = "auto" should set the property value Pass e.style['height'] = "min-content" should set the property value Pass e.style['height'] = "max-content" should set the property value @@ -11,6 +11,6 @@ Pass e.style['height'] = "0" should set the property value Pass e.style['height'] = "10%" should set the property value Pass e.style['height'] = "0.5em" should set the property value Fail e.style['height'] = "calc(10% - 0.5em)" should set the property value -Fail e.style['height'] = "fit-content(10%)" should set the property value -Fail e.style['height'] = "fit-content(0.5em)" should set the property value +Pass e.style['height'] = "fit-content(10%)" should set the property value +Pass e.style['height'] = "fit-content(0.5em)" should set the property value Fail e.style['height'] = "fit-content(calc(10% - 0.5em))" should set the property value \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-height-computed.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-height-computed.txt index bd6ac7d1b5b..83d75c79fc4 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-height-computed.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-height-computed.txt @@ -2,8 +2,8 @@ Harness status: OK Found 12 tests -6 Pass -6 Fail +9 Pass +3 Fail Pass Property max-height value 'none' Pass Property max-height value 'min-content' Pass Property max-height value 'max-content' @@ -12,7 +12,7 @@ Pass Property max-height value '20%' Pass Property max-height value 'calc(10% + 40px)' Fail Property max-height value 'calc(10px - 0.5em)' Fail Property max-height value 'calc(10px + 0.5em)' -Fail Property max-height value 'fit-content(10px)' -Fail Property max-height value 'fit-content(20%)' -Fail Property max-height value 'fit-content(calc(10% + 40px))' +Pass Property max-height value 'fit-content(10px)' +Pass Property max-height value 'fit-content(20%)' +Pass Property max-height value 'fit-content(calc(10% + 40px))' Fail Property max-height value 'fit-content(calc(10px + 0.5em))' \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-height-valid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-height-valid.txt index b52e5cda0ab..9590c381552 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-height-valid.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-height-valid.txt @@ -2,8 +2,8 @@ Harness status: OK Found 10 tests -6 Pass -4 Fail +8 Pass +2 Fail Pass e.style['max-height'] = "none" should set the property value Pass e.style['max-height'] = "min-content" should set the property value Pass e.style['max-height'] = "max-content" should set the property value @@ -11,6 +11,6 @@ Pass e.style['max-height'] = "0" should set the property value Pass e.style['max-height'] = "10%" should set the property value Pass e.style['max-height'] = "0.5em" should set the property value Fail e.style['max-height'] = "calc(10% - 0.5em)" should set the property value -Fail e.style['max-height'] = "fit-content(10%)" should set the property value -Fail e.style['max-height'] = "fit-content(0.5em)" should set the property value +Pass e.style['max-height'] = "fit-content(10%)" should set the property value +Pass e.style['max-height'] = "fit-content(0.5em)" should set the property value Fail e.style['max-height'] = "fit-content(calc(10% - 0.5em))" should set the property value \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-width-computed.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-width-computed.txt index ad68f0daf46..c0cefcf6824 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-width-computed.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-width-computed.txt @@ -2,8 +2,8 @@ Harness status: OK Found 12 tests -6 Pass -6 Fail +9 Pass +3 Fail Pass Property max-width value 'none' Pass Property max-width value 'min-content' Pass Property max-width value 'max-content' @@ -12,7 +12,7 @@ Pass Property max-width value '20%' Pass Property max-width value 'calc(10% + 40px)' Fail Property max-width value 'calc(10px - 0.5em)' Fail Property max-width value 'calc(10px + 0.5em)' -Fail Property max-width value 'fit-content(10px)' -Fail Property max-width value 'fit-content(20%)' -Fail Property max-width value 'fit-content(calc(10% + 40px))' +Pass Property max-width value 'fit-content(10px)' +Pass Property max-width value 'fit-content(20%)' +Pass Property max-width value 'fit-content(calc(10% + 40px))' Fail Property max-width value 'fit-content(calc(10px + 0.5em))' \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-width-valid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-width-valid.txt index 41eca3c221b..7600c640825 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-width-valid.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/max-width-valid.txt @@ -2,8 +2,8 @@ Harness status: OK Found 10 tests -6 Pass -4 Fail +8 Pass +2 Fail Pass e.style['max-width'] = "none" should set the property value Pass e.style['max-width'] = "min-content" should set the property value Pass e.style['max-width'] = "max-content" should set the property value @@ -11,6 +11,6 @@ Pass e.style['max-width'] = "0" should set the property value Pass e.style['max-width'] = "10%" should set the property value Pass e.style['max-width'] = "0.5em" should set the property value Fail e.style['max-width'] = "calc(10% - 0.5em)" should set the property value -Fail e.style['max-width'] = "fit-content(10%)" should set the property value -Fail e.style['max-width'] = "fit-content(0.5em)" should set the property value +Pass e.style['max-width'] = "fit-content(10%)" should set the property value +Pass e.style['max-width'] = "fit-content(0.5em)" should set the property value Fail e.style['max-width'] = "fit-content(calc(10% - 0.5em))" should set the property value \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-height-computed.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-height-computed.txt index c4a353555e8..977b2e9df63 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-height-computed.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-height-computed.txt @@ -2,8 +2,8 @@ Harness status: OK Found 11 tests -5 Pass -6 Fail +8 Pass +3 Fail Pass Property min-height value 'min-content' Pass Property min-height value 'max-content' Pass Property min-height value '10px' @@ -11,7 +11,7 @@ Pass Property min-height value '20%' Pass Property min-height value 'calc(10% + 40px)' Fail Property min-height value 'calc(10px - 0.5em)' Fail Property min-height value 'calc(10px + 0.5em)' -Fail Property min-height value 'fit-content(10px)' -Fail Property min-height value 'fit-content(20%)' -Fail Property min-height value 'fit-content(calc(10% + 40px))' +Pass Property min-height value 'fit-content(10px)' +Pass Property min-height value 'fit-content(20%)' +Pass Property min-height value 'fit-content(calc(10% + 40px))' Fail Property min-height value 'fit-content(calc(10px + 0.5em))' \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-height-valid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-height-valid.txt index 224d89d89a9..98815e6b642 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-height-valid.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-height-valid.txt @@ -2,8 +2,8 @@ Harness status: OK Found 10 tests -6 Pass -4 Fail +8 Pass +2 Fail Pass e.style['min-height'] = "auto" should set the property value Pass e.style['min-height'] = "min-content" should set the property value Pass e.style['min-height'] = "max-content" should set the property value @@ -11,6 +11,6 @@ Pass e.style['min-height'] = "0" should set the property value Pass e.style['min-height'] = "10%" should set the property value Pass e.style['min-height'] = "0.5em" should set the property value Fail e.style['min-height'] = "calc(10% - 0.5em)" should set the property value -Fail e.style['min-height'] = "fit-content(10%)" should set the property value -Fail e.style['min-height'] = "fit-content(0.5em)" should set the property value +Pass e.style['min-height'] = "fit-content(10%)" should set the property value +Pass e.style['min-height'] = "fit-content(0.5em)" should set the property value Fail e.style['min-height'] = "fit-content(calc(10% - 0.5em))" should set the property value \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-width-computed.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-width-computed.txt index 4408d07297c..ee2a211c45f 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-width-computed.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-width-computed.txt @@ -2,8 +2,8 @@ Harness status: OK Found 11 tests -5 Pass -6 Fail +8 Pass +3 Fail Pass Property min-width value 'min-content' Pass Property min-width value 'max-content' Pass Property min-width value '10px' @@ -11,7 +11,7 @@ Pass Property min-width value '20%' Pass Property min-width value 'calc(10% + 40px)' Fail Property min-width value 'calc(10px - 0.5em)' Fail Property min-width value 'calc(10px + 0.5em)' -Fail Property min-width value 'fit-content(10px)' -Fail Property min-width value 'fit-content(20%)' -Fail Property min-width value 'fit-content(calc(10% + 40px))' +Pass Property min-width value 'fit-content(10px)' +Pass Property min-width value 'fit-content(20%)' +Pass Property min-width value 'fit-content(calc(10% + 40px))' Fail Property min-width value 'fit-content(calc(10px + 0.5em))' \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-width-valid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-width-valid.txt index 12f370e5bc2..9c1cc7f6238 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-width-valid.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/min-width-valid.txt @@ -2,8 +2,8 @@ Harness status: OK Found 10 tests -6 Pass -4 Fail +8 Pass +2 Fail Pass e.style['min-width'] = "auto" should set the property value Pass e.style['min-width'] = "min-content" should set the property value Pass e.style['min-width'] = "max-content" should set the property value @@ -11,6 +11,6 @@ Pass e.style['min-width'] = "0" should set the property value Pass e.style['min-width'] = "10%" should set the property value Pass e.style['min-width'] = "0.5em" should set the property value Fail e.style['min-width'] = "calc(10% - 0.5em)" should set the property value -Fail e.style['min-width'] = "fit-content(10%)" should set the property value -Fail e.style['min-width'] = "fit-content(0.5em)" should set the property value +Pass e.style['min-width'] = "fit-content(10%)" should set the property value +Pass e.style['min-width'] = "fit-content(0.5em)" should set the property value Fail e.style['min-width'] = "fit-content(calc(10% - 0.5em))" should set the property value \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/width-valid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/width-valid.txt index 5b40b93bbed..a6bc3d9de7b 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/width-valid.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-sizing/parsing/width-valid.txt @@ -2,8 +2,8 @@ Harness status: OK Found 10 tests -6 Pass -4 Fail +8 Pass +2 Fail Pass e.style['width'] = "auto" should set the property value Pass e.style['width'] = "min-content" should set the property value Pass e.style['width'] = "max-content" should set the property value @@ -11,6 +11,6 @@ Pass e.style['width'] = "0" should set the property value Pass e.style['width'] = "10%" should set the property value Pass e.style['width'] = "0.5em" should set the property value Fail e.style['width'] = "calc(10% - 0.5em)" should set the property value -Fail e.style['width'] = "fit-content(10%)" should set the property value -Fail e.style['width'] = "fit-content(0.5em)" should set the property value +Pass e.style['width'] = "fit-content(10%)" should set the property value +Pass e.style['width'] = "fit-content(0.5em)" should set the property value Fail e.style['width'] = "fit-content(calc(10% - 0.5em))" should set the property value \ No newline at end of file