1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:47:35 +00:00

LibWeb: Implement mask-type CSS property

This property allows specifying if a mask is an alpha or luminance mask.

See: https://drafts.fxtf.org/css-masking/#the-mask-type
This commit is contained in:
MacDue 2023-10-08 11:06:34 +01:00 committed by Andreas Kling
parent b0d75ef096
commit 479451498b
9 changed files with 43 additions and 2 deletions

View file

@ -131,6 +131,7 @@ public:
static CSS::TableLayout table_layout() { return CSS::TableLayout::Auto; }
static QuotesData quotes() { return QuotesData { .type = QuotesData::Type::Auto }; }
static CSS::MaskType mask_type() { return CSS::MaskType::Luminance; }
static CSS::MathShift math_shift() { return CSS::MathShift::Normal; }
static CSS::MathStyle math_style() { return CSS::MathStyle::Normal; }
static int math_depth() { return 0; }
@ -360,6 +361,7 @@ public:
float stop_opacity() const { return m_noninherited.stop_opacity; }
CSS::TextAnchor text_anchor() const { return m_inherited.text_anchor; }
Optional<MaskReference> const& mask() const { return m_noninherited.mask; }
CSS::MaskType mask_type() const { return m_noninherited.mask_type; }
Vector<CSS::Transformation> const& transformations() const { return m_noninherited.transformations; }
CSS::TransformOrigin const& transform_origin() const { return m_noninherited.transform_origin; }
@ -506,6 +508,7 @@ protected:
CSS::TableLayout table_layout { InitialValues::table_layout() };
Optional<MaskReference> mask;
CSS::MaskType mask_type { InitialValues::mask_type() };
} m_noninherited;
};
@ -624,6 +627,7 @@ public:
void set_outline_style(CSS::OutlineStyle value) { m_noninherited.outline_style = value; }
void set_outline_width(CSS::Length value) { m_noninherited.outline_width = value; }
void set_mask(MaskReference value) { m_noninherited.mask = value; }
void set_mask_type(CSS::MaskType value) { m_noninherited.mask_type = value; }
void set_math_shift(CSS::MathShift value) { m_inherited.math_shift = value; }
void set_math_style(CSS::MathStyle value) { m_inherited.math_style = value; }

View file

@ -276,6 +276,10 @@
"inside",
"outside"
],
"mask-type": [
"luminance",
"alpha"
],
"math-shift": [
"normal",
"compact"

View file

@ -68,6 +68,7 @@
"alias",
"all",
"all-scroll",
"alpha",
"alternate",
"alternate-reverse",
"anywhere",
@ -220,6 +221,7 @@
"lowercase",
"ltr",
"listbox",
"luminance",
"mark",
"marktext",
"math",

View file

@ -1502,6 +1502,14 @@
],
"initial": "none"
},
"mask-type": {
"inherited": false,
"affects-layout": false,
"valid-types": [
"mask-type"
],
"initial": "luminance"
},
"math-depth": {
"inherited": true,
"initial": "0",

View file

@ -1015,6 +1015,12 @@ Optional<CSS::TableLayout> StyleProperties::table_layout() const
return value_id_to_table_layout(value->to_identifier());
}
Optional<CSS::MaskType> StyleProperties::mask_type() const
{
auto value = property(CSS::PropertyID::MaskType);
return value_id_to_mask_type(value->to_identifier());
}
Color StyleProperties::stop_color() const
{
auto value = property(CSS::PropertyID::StopColor);

View file

@ -122,6 +122,7 @@ public:
Vector<CSS::Transformation> transformations() const;
CSS::TransformOrigin transform_origin() const;
Optional<CSS::MaskType> mask_type() const;
Color stop_color() const;
float stop_opacity() const;
float fill_opacity() const;