1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibWeb: Implement SVG opacity properties

This implements the stop-opacity, fill-opacity, and stroke-opacity
properties (in CSS). This replaces the existing more ad-hoc
fill-opacity attribute handling.
This commit is contained in:
MacDue 2023-05-19 20:35:39 +01:00 committed by Andreas Kling
parent 120e5b6b6f
commit 00cda96e2d
13 changed files with 141 additions and 29 deletions

View file

@ -32,12 +32,16 @@ void SVGGraphicsPaintable::before_children_paint(PaintContext& context, PaintPha
auto& graphics_element = layout_box().dom_node();
if (graphics_element.fill_color().has_value())
context.svg_context().set_fill_color(graphics_element.fill_color().value());
if (graphics_element.stroke_color().has_value())
context.svg_context().set_stroke_color(graphics_element.stroke_color().value());
if (graphics_element.stroke_width().has_value())
context.svg_context().set_stroke_width(graphics_element.stroke_width().value());
if (auto fill_color = graphics_element.fill_color(); fill_color.has_value())
context.svg_context().set_fill_color(*fill_color);
if (auto stroke_color = graphics_element.stroke_color(); stroke_color.has_value())
context.svg_context().set_stroke_color(*stroke_color);
if (auto stroke_width = graphics_element.stroke_width(); stroke_width.has_value())
context.svg_context().set_stroke_width(*stroke_width);
if (auto fill_opacity = graphics_element.fill_opacity(); fill_opacity.has_value())
context.svg_context().set_fill_opacity(*fill_opacity);
if (auto stroke_opacity = graphics_element.stroke_opacity(); stroke_opacity.has_value())
context.svg_context().set_stroke_opacity(*stroke_opacity);
}
}