mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb/CSS: Improved implementation of background-blend-mode
This is a improved version ofa73cd88f0c
The old commit was reverted in552dd18696
The new version only paints an element into a new layer if background blend modes other than normal are used. The rasterization performance of most websites should therefore not suffer. Co-Authored-By: Alexander Kalenik <kalenik.aliaksandr@gmail.com>
This commit is contained in:
parent
6906f1722a
commit
9973b01848
Notes:
github-actions[bot]
2025-04-01 11:39:02 +00:00
Author: https://github.com/skyz1
Commit: 9973b01848
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4150
16 changed files with 311 additions and 198 deletions
|
@ -397,6 +397,7 @@ void NodeWithStyle::apply_style(CSS::ComputedProperties const& computed_style)
|
|||
auto const& y_positions = computed_style.property(CSS::PropertyID::BackgroundPositionY);
|
||||
auto const& repeats = computed_style.property(CSS::PropertyID::BackgroundRepeat);
|
||||
auto const& sizes = computed_style.property(CSS::PropertyID::BackgroundSize);
|
||||
auto const& background_blend_modes = computed_style.property(CSS::PropertyID::BackgroundBlendMode);
|
||||
|
||||
auto count_layers = [](auto const& maybe_style_value) -> size_t {
|
||||
if (maybe_style_value.is_value_list())
|
||||
|
@ -510,6 +511,8 @@ void NodeWithStyle::apply_style(CSS::ComputedProperties const& computed_style)
|
|||
layer.repeat_y = repeat_value->as_background_repeat().repeat_y();
|
||||
}
|
||||
|
||||
layer.blend_mode = CSS::keyword_to_mix_blend_mode(value_for_layer(background_blend_modes, layer_index)->to_keyword()).value_or(CSS::MixBlendMode::Normal);
|
||||
|
||||
layers.append(move(layer));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue