diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h index d2e869217e7..adbce49c4bd 100644 --- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h +++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h @@ -106,6 +106,7 @@ public: static CSS::BorderCollapse border_collapse() { return CSS::BorderCollapse::Separate; } static Vector> grid_template_areas() { return {}; } static CSS::Time transition_delay() { return CSS::Time::make_seconds(0); } + static CSS::ObjectFit object_fit() { return CSS::ObjectFit::Fill; } }; enum class BackgroundSize { diff --git a/Userland/Libraries/LibWeb/CSS/Enums.json b/Userland/Libraries/LibWeb/CSS/Enums.json index 00834682268..681733c80f9 100644 --- a/Userland/Libraries/LibWeb/CSS/Enums.json +++ b/Userland/Libraries/LibWeb/CSS/Enums.json @@ -238,6 +238,13 @@ "inside", "outside" ], + "object-fit": [ + "fill", + "contain", + "cover", + "none", + "scale-down" + ], "overflow": [ "auto", "clip", diff --git a/Userland/Libraries/LibWeb/CSS/Identifiers.json b/Userland/Libraries/LibWeb/CSS/Identifiers.json index 052b876bd8b..fe05098ce5f 100644 --- a/Userland/Libraries/LibWeb/CSS/Identifiers.json +++ b/Userland/Libraries/LibWeb/CSS/Identifiers.json @@ -131,6 +131,7 @@ "fantasy", "fast", "fine", + "fill", "fit-content", "fixed", "flex", @@ -262,6 +263,7 @@ "s-resize", "safe", "sans-serif", + "scale-down", "scroll", "se-resize", "self-end", diff --git a/Userland/Libraries/LibWeb/CSS/Properties.json b/Userland/Libraries/LibWeb/CSS/Properties.json index a58ba98e52f..18c51055530 100644 --- a/Userland/Libraries/LibWeb/CSS/Properties.json +++ b/Userland/Libraries/LibWeb/CSS/Properties.json @@ -1559,6 +1559,13 @@ "unitless-length" ] }, + "object-fit": { + "inherited": false, + "initial": "fill", + "valid-types": [ + "object-fit" + ] + }, "opacity": { "affects-layout": false, "affects-stacking-context": true, diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp index 94624622d2b..16ad612786c 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -937,6 +937,12 @@ String StyleProperties::grid_area() const return value->as_string().to_string().release_value_but_fixme_should_propagate_errors(); } +Optional StyleProperties::object_fit() const +{ + auto value = property(CSS::PropertyID::ObjectFit); + return value_id_to_object_fit(value->to_identifier()); +} + Color StyleProperties::stop_color() const { auto value = property(CSS::PropertyID::StopColor); diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.h b/Userland/Libraries/LibWeb/CSS/StyleProperties.h index 717dd8ce542..c857f7dd084 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.h +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.h @@ -110,6 +110,7 @@ public: Optional border_collapse() const; Vector> grid_template_areas() const; String grid_area() const; + Optional object_fit() const; Vector transformations() const; CSS::TransformOrigin transform_origin() const;