From a91e945e1a71182d8ae43f066bfe0482c07648c8 Mon Sep 17 00:00:00 2001 From: Martin Bodin Date: Mon, 15 Jan 2024 16:25:37 +0100 Subject: [PATCH 1/3] Adding support for the clip-path presentation attribute. --- CHANGES.md | 5 +++++ lib/svg_f.ml | 3 +++ lib/svg_sigs.mli | 2 ++ 3 files changed, 10 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index bb71b71c5..74ecef559 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +# NEXT + +* Add support for the clip-path presentation attribute + (#333 by Martin @MBodin Bodin) + # 4.6.0 * Update for OCaml 5.0 and drop support for OCaml 4.2.0 diff --git a/lib/svg_f.ml b/lib/svg_f.ml index 3a6a13ff5..470a42b06 100644 --- a/lib/svg_f.ml +++ b/lib/svg_f.ml @@ -379,6 +379,9 @@ struct let a_patternTransform x = user_attrib C.string_of_transforms "patternTransform" x + let a_clip_path = + string_attrib "clip-path" + let a_clipPathUnits x = user_attrib C.string_of_big_variant "clipPathUnits" x diff --git a/lib/svg_sigs.mli b/lib/svg_sigs.mli index 94bf76ed7..bd5bbfc9b 100644 --- a/lib/svg_sigs.mli +++ b/lib/svg_sigs.mli @@ -298,6 +298,8 @@ module type T = sig val a_patternTransform : transforms wrap -> [> | `PatternTransform ] attrib + val a_clip_path : iri wrap -> [> | `Clip_Path ] attrib + val a_clipPathUnits : [< `UserSpaceOnUse | `ObjectBoundingBox ] wrap -> [> | `ClipPathUnits ] attrib From 588f01e0fd507a945f847857bc2966324021bca1 Mon Sep 17 00:00:00 2001 From: Martin Bodin Date: Mon, 15 Jan 2024 16:52:39 +0100 Subject: [PATCH 2/3] Adding a test for clip-path. --- test/test_svg.ml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/test_svg.ml b/test/test_svg.ml index 0e158a7ac..856cee226 100644 --- a/test/test_svg.ml +++ b/test/test_svg.ml @@ -32,9 +32,18 @@ let svg_filters = "svg filters", tyxml_tests Svg.[ ] +let svg_clip_path = "svg clip-path", tyxml_tests Svg.[ + + "use with clip-path", + use ~a:[ a_clip_path "url(#test-clip)"; a_href "#test-object"] [], + {||} + +] + let tests = [ svg_attributes ; - svg_filters + svg_filters ; + svg_clip_path ] let () = Alcotest.run "tyxml-svg" tests From 2bd65e6c93866141fbb5734908ec18a9912b80e0 Mon Sep 17 00:00:00 2001 From: Martin Bodin Date: Mon, 15 Jan 2024 17:19:07 +0100 Subject: [PATCH 3/3] Solving the test. --- test/test_svg.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_svg.ml b/test/test_svg.ml index 856cee226..9b16d03db 100644 --- a/test/test_svg.ml +++ b/test/test_svg.ml @@ -36,7 +36,7 @@ let svg_clip_path = "svg clip-path", tyxml_tests Svg.[ "use with clip-path", use ~a:[ a_clip_path "url(#test-clip)"; a_href "#test-object"] [], - {||} + {||} ]