1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

LibWeb: Paint backgrounds with multiple layers :^)

This commit is contained in:
Sam Atkins 2021-11-12 12:44:22 +00:00 committed by Andreas Kling
parent cdeac132dc
commit e8b7946732
4 changed files with 20 additions and 36 deletions

View file

@ -49,13 +49,6 @@ void InlineNode::paint(PaintContext& context, PaintPhase phase)
auto& painter = context.painter();
if (phase == PaintPhase::Background) {
auto background_data = Painting::BackgroundData {
.color = computed_values().background_color(),
.image = background_image() ? background_image()->bitmap() : nullptr,
.repeat_x = computed_values().background_repeat().repeat_x,
.repeat_y = computed_values().background_repeat().repeat_y
};
auto top_left_border_radius = computed_values().border_top_left_radius();
auto top_right_border_radius = computed_values().border_top_right_radius();
auto bottom_right_border_radius = computed_values().border_bottom_right_radius();
@ -65,7 +58,7 @@ void InlineNode::paint(PaintContext& context, PaintPhase phase)
// FIXME: This recalculates our (InlineNode's) absolute_rect() for every single fragment!
auto rect = fragment.absolute_rect();
auto border_radius_data = Painting::normalized_border_radius_data(*this, rect, top_left_border_radius, top_right_border_radius, bottom_right_border_radius, bottom_left_border_radius);
Painting::paint_background(context, enclosing_int_rect(rect), background_data, border_radius_data);
Painting::paint_background(context, enclosing_int_rect(rect), computed_values().background_color(), &computed_values().background_layers(), border_radius_data);
if (auto computed_box_shadow = computed_values().box_shadow(); computed_box_shadow.has_value()) {
auto box_shadow_data = Painting::BoxShadowData {