mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Implement the SVG clip-rule
attribute
This controls the fill rule used when rasterizing `<clipPath>` elements.
This commit is contained in:
parent
8e00fba71d
commit
6c9069fa5d
Notes:
sideshowbarker
2024-07-16 22:34:39 +09:00
Author: https://github.com/MacDue
Commit: 6c9069fa5d
Pull-request: https://github.com/SerenityOS/serenity/pull/24300
Reviewed-by: https://github.com/AtkinsSJ ✅
13 changed files with 74 additions and 8 deletions
|
@ -158,6 +158,7 @@ void SVGGraphicsElement::apply_presentational_hints(CSS::StyleProperties& style)
|
|||
NamedPropertyID(CSS::PropertyID::Mask),
|
||||
NamedPropertyID(CSS::PropertyID::MaskType),
|
||||
NamedPropertyID(CSS::PropertyID::ClipPath),
|
||||
NamedPropertyID(CSS::PropertyID::ClipRule),
|
||||
};
|
||||
|
||||
CSS::Parser::ParsingContext parsing_context { document(), CSS::Parser::ParsingContext::Mode::SVGPresentationAttribute };
|
||||
|
@ -172,11 +173,9 @@ void SVGGraphicsElement::apply_presentational_hints(CSS::StyleProperties& style)
|
|||
});
|
||||
}
|
||||
|
||||
Optional<FillRule> SVGGraphicsElement::fill_rule() const
|
||||
static FillRule to_svg_fill_rule(CSS::FillRule fill_rule)
|
||||
{
|
||||
if (!layout_node())
|
||||
return {};
|
||||
switch (layout_node()->computed_values().fill_rule()) {
|
||||
switch (fill_rule) {
|
||||
case CSS::FillRule::Nonzero:
|
||||
return FillRule::Nonzero;
|
||||
case CSS::FillRule::Evenodd:
|
||||
|
@ -186,6 +185,20 @@ Optional<FillRule> SVGGraphicsElement::fill_rule() const
|
|||
}
|
||||
}
|
||||
|
||||
Optional<FillRule> SVGGraphicsElement::fill_rule() const
|
||||
{
|
||||
if (!layout_node())
|
||||
return {};
|
||||
return to_svg_fill_rule(layout_node()->computed_values().fill_rule());
|
||||
}
|
||||
|
||||
Optional<ClipRule> SVGGraphicsElement::clip_rule() const
|
||||
{
|
||||
if (!layout_node())
|
||||
return {};
|
||||
return to_svg_fill_rule(layout_node()->computed_values().clip_rule());
|
||||
}
|
||||
|
||||
Optional<Gfx::Color> SVGGraphicsElement::fill_color() const
|
||||
{
|
||||
if (!layout_node())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue