mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibWeb/SVG: Resolve stroke URI reference values
This commit is contained in:
parent
05432d7157
commit
030e670fcb
|
|
@ -180,13 +180,19 @@ Optional<Gfx::Color> SVGGraphicsElement::stroke_color() const
|
|||
{
|
||||
if (!layout_node())
|
||||
return {};
|
||||
// FIXME: In the working-draft spec, `stroke` is intended to be a shorthand, with `stroke-color`
|
||||
// being what we actually want to use. But that's not final or widely supported yet.
|
||||
return layout_node()->computed_values().stroke().map([](auto& paint) -> Gfx::Color {
|
||||
if (!paint.is_color())
|
||||
return Color::Black;
|
||||
return paint.as_color();
|
||||
});
|
||||
|
||||
auto paint = layout_node()->computed_values().stroke();
|
||||
if (!paint.has_value())
|
||||
return {};
|
||||
|
||||
if (paint->is_url()) {
|
||||
if (auto referenced_element = try_resolve_url_to<SVGGraphicsElement const>(paint->as_url()))
|
||||
return referenced_element->stroke_color();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
return paint->as_color();
|
||||
}
|
||||
|
||||
Optional<float> SVGGraphicsElement::fill_opacity() const
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml" stroke="red" stroke-width="50">
|
||||
<h:link rel="match" href="../../../../../expected/wpt-import/svg/pservers/reftests/reference/green-100x100.svg"/>
|
||||
<rect x="25" y="25" width="50" height="50" fill="none" stroke="green"/>
|
||||
<rect x="25" y="25" width="50" height="50" fill="none" stroke="url(#nonexisting)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 394 B |
Loading…
Reference in New Issue
Block a user