mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 06:09:08 +00:00
LibWeb: Add the clip-path
property and resolve it for SVG elements
This commit is contained in:
parent
3160733c1a
commit
03f957dc79
Notes:
sideshowbarker
2024-07-16 23:23:26 +09:00
Author: https://github.com/MacDue
Commit: 03f957dc79
Pull-request: https://github.com/SerenityOS/serenity/pull/23736
Issue: https://github.com/SerenityOS/serenity/issues/19648
Issue: https://github.com/SerenityOS/serenity/issues/23006
Reviewed-by: https://github.com/nico
6 changed files with 51 additions and 3 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <LibWeb/Layout/Node.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
#include <LibWeb/SVG/SVGClipPathElement.h>
|
||||
#include <LibWeb/SVG/SVGGradientElement.h>
|
||||
#include <LibWeb/SVG/SVGGraphicsElement.h>
|
||||
#include <LibWeb/SVG/SVGMaskElement.h>
|
||||
|
@ -76,6 +77,14 @@ JS::GCPtr<SVG::SVGMaskElement const> SVGGraphicsElement::mask() const
|
|||
return try_resolve_url_to<SVG::SVGMaskElement const>(mask_reference->url());
|
||||
}
|
||||
|
||||
JS::GCPtr<SVG::SVGClipPathElement const> SVGGraphicsElement::clip_path() const
|
||||
{
|
||||
auto const& clip_path_reference = layout_node()->computed_values().clip_path();
|
||||
if (!clip_path_reference.has_value())
|
||||
return {};
|
||||
return try_resolve_url_to<SVG::SVGClipPathElement const>(clip_path_reference->url());
|
||||
}
|
||||
|
||||
Gfx::AffineTransform transform_from_transform_list(ReadonlySpan<Transform> transform_list)
|
||||
{
|
||||
Gfx::AffineTransform affine_transform;
|
||||
|
@ -144,7 +153,8 @@ void SVGGraphicsElement::apply_presentational_hints(CSS::StyleProperties& style)
|
|||
NamedPropertyID(CSS::PropertyID::TextAnchor),
|
||||
NamedPropertyID(CSS::PropertyID::FontSize),
|
||||
NamedPropertyID(CSS::PropertyID::Mask),
|
||||
NamedPropertyID(CSS::PropertyID::MaskType)
|
||||
NamedPropertyID(CSS::PropertyID::MaskType),
|
||||
NamedPropertyID(CSS::PropertyID::ClipPath),
|
||||
};
|
||||
|
||||
CSS::Parser::ParsingContext parsing_context { document(), CSS::Parser::ParsingContext::Mode::SVGPresentationAttribute };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue