LibWeb/CSS: Implement mix-blend-mode

This adds support for the `mix-blend-mode` CSS property.
This commit is contained in:
Glenn Skrzypczak 2025-01-22 09:50:49 +01:00 committed by Sam Atkins
commit 0fe30886f5
Notes: github-actions[bot] 2025-02-05 11:28:01 +00:00
24 changed files with 311 additions and 57 deletions

View file

@ -240,6 +240,11 @@ bool Node::establishes_stacking_context() const
return true;
}
// https://drafts.fxtf.org/compositing/#mix-blend-mode
// Applying a blendmode other than normal to the element must establish a new stacking context.
if (computed_values().mix_blend_mode() != CSS::MixBlendMode::Normal)
return true;
return computed_values().opacity() < 1.0f;
}
@ -1039,6 +1044,9 @@ void NodeWithStyle::apply_style(CSS::ComputedProperties const& computed_style)
if (auto isolation = computed_style.isolation(); isolation.has_value())
computed_values.set_isolation(isolation.value());
if (auto mix_blend_mode = computed_style.mix_blend_mode(); mix_blend_mode.has_value())
computed_values.set_mix_blend_mode(mix_blend_mode.value());
propagate_style_to_anonymous_wrappers();
if (is<NodeWithStyleAndBoxModelMetrics>(this))