mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Fail less when multiple mask images are defined
We don't yet support multiple images but we at least continue to use the first rather than having none
This commit is contained in:
parent
5371862d11
commit
1a5933cb04
Notes:
github-actions[bot]
2025-12-01 10:19:11 +00:00
Author: https://github.com/Calme1709
Commit: 1a5933cb04
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6972
Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 32 additions and 1 deletions
|
|
@ -787,7 +787,15 @@ void NodeWithStyle::apply_style(CSS::ComputedProperties const& computed_style)
|
|||
computed_values.set_shape_rendering(computed_style.shape_rendering());
|
||||
computed_values.set_paint_order(computed_style.paint_order());
|
||||
|
||||
auto const& mask_image = computed_style.property(CSS::PropertyID::MaskImage);
|
||||
// FIXME: We should actually support more than one mask image rather than just using the first
|
||||
auto const& mask_image = [&] -> CSS::StyleValue const& {
|
||||
auto const& value = computed_style.property(CSS::PropertyID::MaskImage);
|
||||
|
||||
if (value.is_value_list())
|
||||
return value.as_value_list().values()[0];
|
||||
|
||||
return value;
|
||||
}();
|
||||
if (mask_image.is_url()) {
|
||||
computed_values.set_mask(mask_image.as_url().url());
|
||||
} else if (mask_image.is_abstract_image()) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
#mask-image-box {
|
||||
background-color: green;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
</style>
|
||||
<div id="mask-image-box"></div>
|
||||
14
Tests/LibWeb/Ref/input/mask-image-multiple-same.html
Normal file
14
Tests/LibWeb/Ref/input/mask-image-multiple-same.html
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="match" href="../expected/mask-image-multiple-same-ref.html" />
|
||||
<style>
|
||||
#mask-image-box {
|
||||
background-color: green;
|
||||
width: 100px;
|
||||
height: 200px;
|
||||
mask-image: url("../data/mask-image-100x200.png"), url("../data/mask-image-100x200.png");
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="mask-image-box"></div>
|
||||
<!-- FIXME: Workaround to ensure CSS mask-image is loaded before taking screenshot: https://github.com/LadybirdBrowser/ladybird/issues/3448 -->
|
||||
<img style="display: none" src="../data/mask-image-100x200.png" />
|
||||
Loading…
Add table
Add a link
Reference in a new issue