LibWeb: Add 'object-fit' property

This patch adds support for the 'object-fit' CSS property. :^)
This commit is contained in:
Tobias Christiansen 2023-08-01 20:06:50 +02:00 committed by Sam Atkins
parent 86ad896f35
commit 5fc6bff582
Notes: sideshowbarker 2024-07-17 04:49:48 +09:00
6 changed files with 24 additions and 0 deletions

View file

@ -106,6 +106,7 @@ public:
static CSS::BorderCollapse border_collapse() { return CSS::BorderCollapse::Separate; }
static Vector<Vector<String>> 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 {

View file

@ -238,6 +238,13 @@
"inside",
"outside"
],
"object-fit": [
"fill",
"contain",
"cover",
"none",
"scale-down"
],
"overflow": [
"auto",
"clip",

View file

@ -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",

View file

@ -1559,6 +1559,13 @@
"unitless-length"
]
},
"object-fit": {
"inherited": false,
"initial": "fill",
"valid-types": [
"object-fit"
]
},
"opacity": {
"affects-layout": false,
"affects-stacking-context": true,

View file

@ -937,6 +937,12 @@ String StyleProperties::grid_area() const
return value->as_string().to_string().release_value_but_fixme_should_propagate_errors();
}
Optional<CSS::ObjectFit> 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);

View file

@ -110,6 +110,7 @@ public:
Optional<CSS::BorderCollapse> border_collapse() const;
Vector<Vector<String>> grid_template_areas() const;
String grid_area() const;
Optional<CSS::ObjectFit> object_fit() const;
Vector<CSS::Transformation> transformations() const;
CSS::TransformOrigin transform_origin() const;