From 4c5d48f86139d1460cf532d3be8e240477c88863 Mon Sep 17 00:00:00 2001 From: MacDue Date: Sat, 4 Nov 2023 21:31:35 +0000 Subject: [PATCH] LibWeb: Support transforms, stroking, gradients, etc for SVG This makes use of the new Gfx::Path::text() to handle SVG text elements, with this text is just a regular path, and can be manipulated like any other graphics element. This removes the SVGTextPaintable and makes both and geometry elements use a new (shared) SVGPathPaintable. This is identical to the old SVGGeometryPaintable. This simplifies painting as once something is resolved to a Gfx::Path, the painting logic is the same. --- .../css-namespace-tag-name-selector.txt | 2 +- ...-aspect-ratio-and-automatic-cross-size.txt | 2 +- ...tem-that-only-has-natural-aspect-ratio.txt | 2 +- .../expected/svg-preserve-aspect-ratio.txt | 26 ++++----- .../Layout/expected/svg-text-with-viewbox.txt | 16 +++--- .../expected/svg-transforms-and-viewboxes.txt | 38 ++++++------- .../svg/svg-different-types-of-opacity.txt | 2 +- .../expected/svg/svg-fill-with-bogus-url.txt | 2 +- .../expected/svg/svg-g-with-opacity.txt | 4 +- .../Layout/expected/svg/svg-inside-svg.txt | 2 +- .../svg-intrinsic-size-in-one-dimension.txt | 4 +- .../svg-negative-elliptical-arg-number.txt | 2 +- .../svg/svg-path-with-implicit-lineto.txt | 2 +- .../expected/svg/svg-symbol-with-viewbox.txt | 2 +- ...with-css-variable-in-presentation-hint.txt | 2 +- .../expected/svg/svg-with-display-block.txt | 2 +- ...ith-zero-intrinsic-size-and-no-viewbox.txt | 2 +- .../Layout/expected/svg/text-fill-none.txt | 6 +-- .../reference/images/svg-text-effects-ref.png | Bin 0 -> 9436 bytes .../Ref/reference/svg-text-effects-ref.html | 15 ++++++ Tests/LibWeb/Ref/svg-text-effects.html | 31 +++++++++++ Userland/Libraries/LibWeb/CMakeLists.txt | 3 +- .../Libraries/LibWeb/Layout/LayoutState.cpp | 6 +-- .../LibWeb/Layout/SVGFormattingContext.cpp | 34 ++++++------ .../LibWeb/Layout/SVGGeometryBox.cpp | 4 +- .../Libraries/LibWeb/Layout/SVGTextBox.cpp | 4 +- ...etryPaintable.cpp => SVGPathPaintable.cpp} | 16 +++--- ...GeometryPaintable.h => SVGPathPaintable.h} | 12 ++--- .../LibWeb/Painting/SVGTextPaintable.cpp | 50 ------------------ .../LibWeb/Painting/SVGTextPaintable.h | 31 ----------- 30 files changed, 144 insertions(+), 180 deletions(-) create mode 100644 Tests/LibWeb/Ref/reference/images/svg-text-effects-ref.png create mode 100644 Tests/LibWeb/Ref/reference/svg-text-effects-ref.html create mode 100644 Tests/LibWeb/Ref/svg-text-effects.html rename Userland/Libraries/LibWeb/Painting/{SVGGeometryPaintable.cpp => SVGPathPaintable.cpp} (88%) rename Userland/Libraries/LibWeb/Painting/{SVGGeometryPaintable.h => SVGPathPaintable.h} (62%) delete mode 100644 Userland/Libraries/LibWeb/Painting/SVGTextPaintable.cpp delete mode 100644 Userland/Libraries/LibWeb/Painting/SVGTextPaintable.h diff --git a/Tests/LibWeb/Layout/expected/css-namespace-tag-name-selector.txt b/Tests/LibWeb/Layout/expected/css-namespace-tag-name-selector.txt index 5008ccc680..645b56c2ec 100644 --- a/Tests/LibWeb/Layout/expected/css-namespace-tag-name-selector.txt +++ b/Tests/LibWeb/Layout/expected/css-namespace-tag-name-selector.txt @@ -9,7 +9,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline frag 2 from Box start: 0, length: 0, rect: [319,51 0x108] SVGSVGBox at (9,9) content-size 300x150 [SVG] children: inline InlineNode - SVGTextBox at (29,9) content-size 198.90625x80 children: inline + SVGTextBox at (29,25.015625) content-size 193.59375x67.578125 children: inline TextNode <#text> TextNode <#text> Box at (319,51) content-size 0x108 children: not-inline diff --git a/Tests/LibWeb/Layout/expected/flex/flex-column-item-with-natural-aspect-ratio-and-automatic-cross-size.txt b/Tests/LibWeb/Layout/expected/flex/flex-column-item-with-natural-aspect-ratio-and-automatic-cross-size.txt index c1ebffb6e5..e7f7a97794 100644 --- a/Tests/LibWeb/Layout/expected/flex/flex-column-item-with-natural-aspect-ratio-and-automatic-cross-size.txt +++ b/Tests/LibWeb/Layout/expected/flex/flex-column-item-with-natural-aspect-ratio-and-automatic-cross-size.txt @@ -8,4 +8,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x100] PaintableBox (Box) [0,0 800x100] SVGSVGPaintable (SVGSVGBox) [0,0 200x100] - SVGGeometryPaintable (SVGGeometryBox) [0,0 200x100] + SVGPathPaintable (SVGGeometryBox) [0,0 200x100] diff --git a/Tests/LibWeb/Layout/expected/flex/intrinsic-height-of-flex-container-with-svg-item-that-only-has-natural-aspect-ratio.txt b/Tests/LibWeb/Layout/expected/flex/intrinsic-height-of-flex-container-with-svg-item-that-only-has-natural-aspect-ratio.txt index 3f3508e559..53ec2567ba 100644 --- a/Tests/LibWeb/Layout/expected/flex/intrinsic-height-of-flex-container-with-svg-item-that-only-has-natural-aspect-ratio.txt +++ b/Tests/LibWeb/Layout/expected/flex/intrinsic-height-of-flex-container-with-svg-item-that-only-has-natural-aspect-ratio.txt @@ -8,4 +8,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x16] PaintableBox (Box) [8,8 784x0] SVGSVGPaintable (SVGSVGBox) [400,8 0x0] - SVGGeometryPaintable (SVGGeometryBox) [400,8 0x0] + SVGPathPaintable (SVGGeometryBox) [400,8 0x0] diff --git a/Tests/LibWeb/Layout/expected/svg-preserve-aspect-ratio.txt b/Tests/LibWeb/Layout/expected/svg-preserve-aspect-ratio.txt index 0b4873403c..c812ce40bf 100644 --- a/Tests/LibWeb/Layout/expected/svg-preserve-aspect-ratio.txt +++ b/Tests/LibWeb/Layout/expected/svg-preserve-aspect-ratio.txt @@ -108,39 +108,39 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x600] PaintableWithLines (BlockContainer) [8,8 784x257.46875] SVGSVGPaintable (SVGSVGBox) [8,83 102x52] - SVGGeometryPaintable (SVGGeometryBox) [34,84 50x50] + SVGPathPaintable (SVGGeometryBox) [34,84 50x50] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [118,83 102x52] - SVGGeometryPaintable (SVGGeometryBox) [119,84 50x50] + SVGPathPaintable (SVGGeometryBox) [119,84 50x50] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [228,83 102x52] - SVGGeometryPaintable (SVGGeometryBox) [279,84 50x50] + SVGPathPaintable (SVGGeometryBox) [279,84 50x50] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [338,83 102x52] - SVGGeometryPaintable (SVGGeometryBox) [339,84 100x100] + SVGPathPaintable (SVGGeometryBox) [339,84 100x100] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [448,83 102x52] - SVGGeometryPaintable (SVGGeometryBox) [449,59 100x100] + SVGPathPaintable (SVGGeometryBox) [449,59 100x100] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [558,83 102x52] - SVGGeometryPaintable (SVGGeometryBox) [559,34 100x100] + SVGPathPaintable (SVGGeometryBox) [559,34 100x100] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [668,8 52x127] - SVGGeometryPaintable (SVGGeometryBox) [669,9 50x50] + SVGPathPaintable (SVGGeometryBox) [669,9 50x50] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [728,8 52x127] - SVGGeometryPaintable (SVGGeometryBox) [729,46.5 50x50] + SVGPathPaintable (SVGGeometryBox) [729,46.5 50x50] SVGSVGPaintable (SVGSVGBox) [8,135 52x127] - SVGGeometryPaintable (SVGGeometryBox) [9,211 50x50] + SVGPathPaintable (SVGGeometryBox) [9,211 50x50] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [68,135 52x127] - SVGGeometryPaintable (SVGGeometryBox) [69,136 125x125] + SVGPathPaintable (SVGGeometryBox) [69,136 125x125] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [128,135 52x127] - SVGGeometryPaintable (SVGGeometryBox) [91.5,136 125x125] + SVGPathPaintable (SVGGeometryBox) [91.5,136 125x125] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [188,135 52x127] - SVGGeometryPaintable (SVGGeometryBox) [114,136 125x125] + SVGPathPaintable (SVGGeometryBox) [114,136 125x125] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [248,200 162x62] - SVGGeometryPaintable (SVGGeometryBox) [299,201 60x60] + SVGPathPaintable (SVGGeometryBox) [299,201 60x60] diff --git a/Tests/LibWeb/Layout/expected/svg-text-with-viewbox.txt b/Tests/LibWeb/Layout/expected/svg-text-with-viewbox.txt index b4bde816ff..82e0b45ac1 100644 --- a/Tests/LibWeb/Layout/expected/svg-text-with-viewbox.txt +++ b/Tests/LibWeb/Layout/expected/svg-text-with-viewbox.txt @@ -6,16 +6,16 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline SVGSVGBox at (8,8) content-size 784x261.328125 [SVG] children: inline TextNode <#text> TextNode <#text> - SVGTextBox at (73.34375,79.859375) content-size 50.265625x42.46875 children: inline + SVGTextBox at (73.34375,88.359375) content-size 48.109375x37.484375 children: inline TextNode <#text> TextNode <#text> - SVGTextBox at (138.6875,24.328125) content-size 153.703125x98 children: inline + SVGTextBox at (138.6875,43.953125) content-size 148.234375x79.71875 children: inline TextNode <#text> TextNode <#text> - SVGTextBox at (187.671875,145.1875) content-size 36.90625x42.46875 children: inline + SVGTextBox at (187.671875,153.703125) content-size 34.59375x34.703125 children: inline TextNode <#text> TextNode <#text> - SVGTextBox at (220.34375,57) content-size 526.609375x130.65625 children: inline + SVGTextBox at (220.34375,83.15625) content-size 519.34375x115.359375 children: inline TextNode <#text> TextNode <#text> TextNode <#text> @@ -24,7 +24,7 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x600] PaintableWithLines (BlockContainer) [8,8 784x261.328125] SVGSVGPaintable (SVGSVGBox) [8,8 784x261.328125] - SVGTextPaintable (SVGTextBox.small) [73.34375,79.859375 50.265625x42.46875] - SVGTextPaintable (SVGTextBox.heavy) [138.6875,24.328125 153.703125x98] - SVGTextPaintable (SVGTextBox.small) [187.671875,145.1875 36.90625x42.46875] - SVGTextPaintable (SVGTextBox.Rrrrr) [220.34375,57 526.609375x130.65625] + SVGPathPaintable (SVGTextBox.small) [73.34375,88.359375 48.109375x37.484375] + SVGPathPaintable (SVGTextBox.heavy) [138.6875,43.953125 148.234375x79.71875] + SVGPathPaintable (SVGTextBox.small) [187.671875,153.703125 34.59375x34.703125] + SVGPathPaintable (SVGTextBox.Rrrrr) [220.34375,83.15625 519.34375x115.359375] diff --git a/Tests/LibWeb/Layout/expected/svg-transforms-and-viewboxes.txt b/Tests/LibWeb/Layout/expected/svg-transforms-and-viewboxes.txt index e5b118e3a1..ba7dce4e37 100644 --- a/Tests/LibWeb/Layout/expected/svg-transforms-and-viewboxes.txt +++ b/Tests/LibWeb/Layout/expected/svg-transforms-and-viewboxes.txt @@ -100,33 +100,33 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x700] PaintableWithLines (BlockContainer) [50,50 700x600] SVGSVGPaintable (SVGSVGBox) [50,150 200x100] SVGGraphicsPaintable (SVGGraphicsBox) [45.6875,199.828125 118.78125x47.453125] - SVGGeometryPaintable (SVGGeometryBox) [45.6875,199.828125 118.78125x47.453125] + SVGPathPaintable (SVGGeometryBox) [45.6875,199.828125 118.78125x47.453125] SVGGraphicsPaintable (SVGGraphicsBox) [84.5,159.5 81x81] - SVGGeometryPaintable (SVGGeometryBox) [84.5,159.5 81x81] + SVGPathPaintable (SVGGeometryBox) [84.5,159.5 81x81] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [258,50 200x200] - SVGGeometryPaintable (SVGGeometryBox) [268,60 30x20] - SVGGeometryPaintable (SVGGeometryBox) [288,130 110x90] + SVGPathPaintable (SVGGeometryBox) [268,60 30x20] + SVGPathPaintable (SVGGeometryBox) [288,130 110x90] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [466,50 200x200] - SVGGeometryPaintable (SVGGeometryBox) [506,90 120x120] - SVGGeometryPaintable (SVGGeometryBox) [471.359375,90 189.28125x120] + SVGPathPaintable (SVGGeometryBox) [506,90 120x120] + SVGPathPaintable (SVGGeometryBox) [471.359375,90 189.28125x120] SVGSVGPaintable (SVGSVGBox) [50,250 200x200] - SVGGeometryPaintable (SVGGeometryBox) [120.59375,320.59375 58.828125x58.828125] - SVGGeometryPaintable (SVGGeometryBox) [52.4375,310.375 68.140625x68.140625] - SVGGeometryPaintable (SVGGeometryBox) [179.40625,321.484375 68.140625x68.140625] + SVGPathPaintable (SVGGeometryBox) [120.59375,320.59375 58.828125x58.828125] + SVGPathPaintable (SVGGeometryBox) [52.4375,310.375 68.140625x68.140625] + SVGPathPaintable (SVGGeometryBox) [179.40625,321.484375 68.140625x68.140625] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [258,250 200x200] - SVGGeometryPaintable (SVGGeometryBox) [278,270 160x160] - SVGGeometryPaintable (SVGGeometryBox) [338,270 40x160] - SVGGeometryPaintable (SVGGeometryBox) [278,330 160x40] - SVGGeometryPaintable (SVGGeometryBox) [338,330 40x40] + SVGPathPaintable (SVGGeometryBox) [278,270 160x160] + SVGPathPaintable (SVGGeometryBox) [338,270 40x160] + SVGPathPaintable (SVGGeometryBox) [278,330 160x40] + SVGPathPaintable (SVGGeometryBox) [338,330 40x40] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [466,250 200x200] - SVGGeometryPaintable (SVGGeometryBox) [506,290 120x120] - SVGGeometryPaintable (SVGGeometryBox) [506,255.359375 120x189.28125] + SVGPathPaintable (SVGGeometryBox) [506,290 120x120] + SVGPathPaintable (SVGGeometryBox) [506,255.359375 120x189.28125] SVGSVGPaintable (SVGSVGBox) [50,450 200x200] - SVGGeometryPaintable (SVGGeometryBox) [60,460 80x80] - SVGGeometryPaintable (SVGGeometryBox) [160,460 80x80] - SVGGeometryPaintable (SVGGeometryBox) [60,560 80x80] - SVGGeometryPaintable (SVGGeometryBox) [160,560 80x80] + SVGPathPaintable (SVGGeometryBox) [60,460 80x80] + SVGPathPaintable (SVGGeometryBox) [160,460 80x80] + SVGPathPaintable (SVGGeometryBox) [60,560 80x80] + SVGPathPaintable (SVGGeometryBox) [160,560 80x80] diff --git a/Tests/LibWeb/Layout/expected/svg/svg-different-types-of-opacity.txt b/Tests/LibWeb/Layout/expected/svg/svg-different-types-of-opacity.txt index f0e0d0b516..77fc7b87d8 100644 --- a/Tests/LibWeb/Layout/expected/svg/svg-different-types-of-opacity.txt +++ b/Tests/LibWeb/Layout/expected/svg/svg-different-types-of-opacity.txt @@ -13,4 +13,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x800] PaintableWithLines (BlockContainer) [0,0 800x800] PaintableWithLines (BlockContainer) [8,8 784x784] SVGSVGPaintable (SVGSVGBox) [8,8 784x784] - SVGGeometryPaintable (SVGGeometryBox) [47.1875,47.1875 548.796875x548.796875] + SVGPathPaintable (SVGGeometryBox) [47.1875,47.1875 548.796875x548.796875] diff --git a/Tests/LibWeb/Layout/expected/svg/svg-fill-with-bogus-url.txt b/Tests/LibWeb/Layout/expected/svg/svg-fill-with-bogus-url.txt index f801ae6981..1507c40481 100644 --- a/Tests/LibWeb/Layout/expected/svg/svg-fill-with-bogus-url.txt +++ b/Tests/LibWeb/Layout/expected/svg/svg-fill-with-bogus-url.txt @@ -10,4 +10,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x800] PaintableWithLines (BlockContainer) [0,0 800x800] PaintableWithLines (BlockContainer) [8,8 784x784] SVGSVGPaintable (SVGSVGBox) [8,8 784x784] - SVGGeometryPaintable (SVGGeometryBox) [8,8 784x784] + SVGPathPaintable (SVGGeometryBox) [8,8 784x784] diff --git a/Tests/LibWeb/Layout/expected/svg/svg-g-with-opacity.txt b/Tests/LibWeb/Layout/expected/svg/svg-g-with-opacity.txt index 974cbb61f9..c6d8c44192 100644 --- a/Tests/LibWeb/Layout/expected/svg/svg-g-with-opacity.txt +++ b/Tests/LibWeb/Layout/expected/svg/svg-g-with-opacity.txt @@ -19,5 +19,5 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x800] PaintableWithLines (BlockContainer) [8,8 784x784] SVGSVGPaintable (SVGSVGBox) [8,8 784x784] SVGGraphicsPaintable (SVGGraphicsBox) [121.671875,121.671875 556.65625x556.65625] - SVGGeometryPaintable (SVGGeometryBox) [121.671875,121.671875 399.84375x399.84375] - SVGGeometryPaintable (SVGGeometryBox) [278.484375,278.484375 399.84375x399.84375] + SVGPathPaintable (SVGGeometryBox) [121.671875,121.671875 399.84375x399.84375] + SVGPathPaintable (SVGGeometryBox) [278.484375,278.484375 399.84375x399.84375] diff --git a/Tests/LibWeb/Layout/expected/svg/svg-inside-svg.txt b/Tests/LibWeb/Layout/expected/svg/svg-inside-svg.txt index 3e8185fabb..51f38ebc05 100644 --- a/Tests/LibWeb/Layout/expected/svg/svg-inside-svg.txt +++ b/Tests/LibWeb/Layout/expected/svg/svg-inside-svg.txt @@ -15,4 +15,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] SVGSVGPaintable (SVGSVGBox) [8,8 24x24] SVGGraphicsPaintable (SVGGraphicsBox) [8,8 24x24] SVGSVGPaintable (SVGSVGBox) [8,8 24x24] - SVGGeometryPaintable (SVGGeometryBox) [8,8 24x24] + SVGPathPaintable (SVGGeometryBox) [8,8 24x24] diff --git a/Tests/LibWeb/Layout/expected/svg/svg-intrinsic-size-in-one-dimension.txt b/Tests/LibWeb/Layout/expected/svg/svg-intrinsic-size-in-one-dimension.txt index 01efac30da..c0cc06b47e 100644 --- a/Tests/LibWeb/Layout/expected/svg/svg-intrinsic-size-in-one-dimension.txt +++ b/Tests/LibWeb/Layout/expected/svg/svg-intrinsic-size-in-one-dimension.txt @@ -10,6 +10,6 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x170] PaintableWithLines (BlockContainer) [8,8 784x154] SVGSVGPaintable (SVGSVGBox) [8,8 102x52] - SVGGeometryPaintable (SVGGeometryBox) [21.5,21.5 75x25] + SVGPathPaintable (SVGGeometryBox) [21.5,21.5 75x25] SVGSVGPaintable (SVGSVGBox) [8,60 202x102] - SVGGeometryPaintable (SVGGeometryBox) [34,86 150x50] + SVGPathPaintable (SVGGeometryBox) [34,86 150x50] diff --git a/Tests/LibWeb/Layout/expected/svg/svg-negative-elliptical-arg-number.txt b/Tests/LibWeb/Layout/expected/svg/svg-negative-elliptical-arg-number.txt index a25f3b9ef4..78212a296c 100644 --- a/Tests/LibWeb/Layout/expected/svg/svg-negative-elliptical-arg-number.txt +++ b/Tests/LibWeb/Layout/expected/svg/svg-negative-elliptical-arg-number.txt @@ -10,4 +10,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x116] PaintableWithLines (BlockContainer) [8,8 784x100] SVGSVGPaintable (SVGSVGBox) [8,8 100x100] - SVGGeometryPaintable (SVGGeometryBox) [8,10 100x48] + SVGPathPaintable (SVGGeometryBox) [8,10 100x48] diff --git a/Tests/LibWeb/Layout/expected/svg/svg-path-with-implicit-lineto.txt b/Tests/LibWeb/Layout/expected/svg/svg-path-with-implicit-lineto.txt index 38970279e7..e93f7aa73b 100644 --- a/Tests/LibWeb/Layout/expected/svg/svg-path-with-implicit-lineto.txt +++ b/Tests/LibWeb/Layout/expected/svg/svg-path-with-implicit-lineto.txt @@ -10,4 +10,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x116] PaintableWithLines (BlockContainer) [8,8 784x100] SVGSVGPaintable (SVGSVGBox) [8,8 100x100] - SVGGeometryPaintable (SVGGeometryBox) [28,28 60x60] + SVGPathPaintable (SVGGeometryBox) [28,28 60x60] diff --git a/Tests/LibWeb/Layout/expected/svg/svg-symbol-with-viewbox.txt b/Tests/LibWeb/Layout/expected/svg/svg-symbol-with-viewbox.txt index 11a1857ff3..8b2b2d5922 100644 --- a/Tests/LibWeb/Layout/expected/svg/svg-symbol-with-viewbox.txt +++ b/Tests/LibWeb/Layout/expected/svg/svg-symbol-with-viewbox.txt @@ -27,4 +27,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] SVGSVGPaintable (SVGSVGBox) [8,8 300x150] PaintableBox (Box) [8,8 0x0] PaintableBox (Box#braces) [8,8 0x0] - SVGGeometryPaintable (SVGGeometryBox) [92.375,26.75 131.25x112.15625] + SVGPathPaintable (SVGGeometryBox) [92.375,26.75 131.25x112.15625] diff --git a/Tests/LibWeb/Layout/expected/svg/svg-with-css-variable-in-presentation-hint.txt b/Tests/LibWeb/Layout/expected/svg/svg-with-css-variable-in-presentation-hint.txt index 96c3571daa..933a05aec5 100644 --- a/Tests/LibWeb/Layout/expected/svg/svg-with-css-variable-in-presentation-hint.txt +++ b/Tests/LibWeb/Layout/expected/svg/svg-with-css-variable-in-presentation-hint.txt @@ -10,4 +10,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x118] PaintableWithLines (BlockContainer) [8,8 784x102] SVGSVGPaintable (SVGSVGBox) [8,8 102x102] - SVGGeometryPaintable (SVGGeometryBox) [29,29 60x60] + SVGPathPaintable (SVGGeometryBox) [29,29 60x60] diff --git a/Tests/LibWeb/Layout/expected/svg/svg-with-display-block.txt b/Tests/LibWeb/Layout/expected/svg/svg-with-display-block.txt index 24143cec5c..7fe6f82d0c 100644 --- a/Tests/LibWeb/Layout/expected/svg/svg-with-display-block.txt +++ b/Tests/LibWeb/Layout/expected/svg/svg-with-display-block.txt @@ -8,4 +8,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x800] PaintableWithLines (BlockContainer) [0,0 800x800] PaintableWithLines (BlockContainer) [8,8 784x784] SVGSVGPaintable (SVGSVGBox) [8,8 784x784] - SVGGeometryPaintable (SVGGeometryBox) [8,8 784x784] + SVGPathPaintable (SVGGeometryBox) [8,8 784x784] diff --git a/Tests/LibWeb/Layout/expected/svg/svg-with-zero-intrinsic-size-and-no-viewbox.txt b/Tests/LibWeb/Layout/expected/svg/svg-with-zero-intrinsic-size-and-no-viewbox.txt index 46020a446a..6a82ee705a 100644 --- a/Tests/LibWeb/Layout/expected/svg/svg-with-zero-intrinsic-size-and-no-viewbox.txt +++ b/Tests/LibWeb/Layout/expected/svg/svg-with-zero-intrinsic-size-and-no-viewbox.txt @@ -26,4 +26,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] ImagePaintable (ImageBox) [8,21 0x0] TextPaintable (TextNode<#text>) SVGSVGPaintable (SVGSVGBox) [16,21 0x0] - SVGGeometryPaintable (SVGGeometryBox) [16,21 1x1] + SVGPathPaintable (SVGGeometryBox) [16,21 1x1] diff --git a/Tests/LibWeb/Layout/expected/svg/text-fill-none.txt b/Tests/LibWeb/Layout/expected/svg/text-fill-none.txt index bd127e4e9e..dbd39cc3cd 100644 --- a/Tests/LibWeb/Layout/expected/svg/text-fill-none.txt +++ b/Tests/LibWeb/Layout/expected/svg/text-fill-none.txt @@ -4,11 +4,11 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline line 0 width: 300, height: 150, bottom: 150, baseline: 150 frag 0 from SVGSVGBox start: 0, length: 0, rect: [8,8 300x150] SVGSVGBox at (8,8) content-size 300x150 [SVG] children: not-inline - SVGTextBox at (8,-8) content-size 0x16 children: not-inline + SVGTextBox at (8,8) content-size 0x0 children: not-inline TextNode <#text> ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x600] PaintableWithLines (BlockContainer) [8,8 784x150] - SVGSVGPaintable (SVGSVGBox) [8,8 300x150] overflow: [8,-8 300x166] - SVGTextPaintable (SVGTextBox) [8,-8 0x16] + SVGSVGPaintable (SVGSVGBox) [8,8 300x150] + SVGPathPaintable (SVGTextBox) [8,8 0x0] diff --git a/Tests/LibWeb/Ref/reference/images/svg-text-effects-ref.png b/Tests/LibWeb/Ref/reference/images/svg-text-effects-ref.png new file mode 100644 index 0000000000000000000000000000000000000000..6b9419739113ad9b34b82d78be1bd06b5133ed3b GIT binary patch literal 9436 zcmeAS@N?(olHy`uVBq!ia0y~yV4T3f!0?QNiGhKkJZ?-TyLxYYYdp;ur!yzUH1`ciphD1gNh89)^1_3dIn1T*M z%pn4z4kXsF0iq5h2GR%<0~rPr0~rQV2NFZJ0GpUasD(`5p+kojEn2i|mlX#$!-R|5 zPMtn|`e*&8&!1PXUahFZ;IQnr*1;p4!rI!}ck|3!SQ$>ZMElM#P&79WU#0tL{mmCT z9NY~X-C|?shWHHdkNjSdkEDcUN6-a2=Zou9bQaWb+HE_N%t z6PlN&*IE1N^XJPSxvyQl>RI2-BN@t-$e0izwsh%I%VVCwt2E}yCFgz6u&orj>=?n2 zBCO)FYQ>5PezPY%ZOBPXy>3&Qx!+pRH>za=gMoU_qGYZ~Y^zRs%&~b|w!3p`$4-%@ zVR3QuT;DgCJXGBu*fvMBh4lcZ@WgDRjVpONmz>!D?AfzZhqyl77tIZgiSb#Uslqtr zTU=U5al<^5;Hqacjr}DLF$IK9)Y<9X6S2@&rC6XkZ_1k!Pc}T8XVb~(c_l0=Dk?HE z^WDT$R-KYv%muGPU2B#^YEIYvyOcXLG&D3zU$J__%ey|EMw4Hj{=0-#$Ldnc28I(B zp_*)wn}SSEDoHL=uw3va-!+{;nRTE!3mhC(>@7%nTp5^v4 zW=ETvns&}q^W^m9X*#lVanfXQ>z0-c3?BMo-L2b%cG`LREUd`(H#_K8ws?Z=kC}Cf-wCEWYnVjeFk$ zv1X6!{OPgj%%DK^__8JQvRaYhfoKItykPt9xvwCyKC8YB!1KU zOXgfxpQ(m~ggr;B5F!K)$55K&%^5`|+qt=t2xpfPOF-T?jg(-^fv^eEgD4{01@Pe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vt@HndS2j8Mha^trxp?i>!DI2au5X?jdM7FN z&fBaHkJrgJY}hm_RCHD3!-huR88;tKddaIf=>%7Q&z2Rossh~mZ{4>!{BNO8MDXn> zv69l-C(>y;*BBWNoszq^CPehwL@8(YS6P1ym9@VV9}hmmb=7Q%$Aiuy{qNiTw!hoA zZ0*B+=dOLPb^ajIu;G~4>(wExU#Ay2yGw1bJs=P^{k`ws_FE=9yq*hX%sQBHL;i4* z6hmUK=eFysxK?kwabY6UUunrhR=0k~|Kh(Y{BA+(*Yb^{F0_W?9wF{d!9#{R&YImt#Lp|M><8|Y?`{ixBKSnZgWZ!wbWkbu>)rT$| zwCQuTGH<%3qSW$y+xa=Uv;RGNFsq~CYc0berWQwY?}+^A5>^ts-_;$d-M(<~Ui&Qz z=Wc$e%p@T8qyCVLcZBz69$6iuOULFtY5y+m5TRh2xG~&OdgbopTaT%-AMTjJ(83zD z&|Gmq42NEv<=_Fq^xcP92aWap!1jeV;wUG_mTrWHq$nk zoi!@i@Zdq1YohGC9d`_Wm;^a7BsN~r&`sbx{UAZ7@%fTNR`-lnt}bt^U(zUUvF9?w zAtudYe?jjE@19%_#}^s1aL?*6m0jzpB4&BjjIVywRv*%Hw#0{RK_>!g2k>0 zvwrkn)mzrf#E{rnQnVmWZ;h+#$7fc13>h3EW*&docD^;#M)BX3H5Jvu_kx`czUBA%gUD1QH3=D@(xYq4RnE%mFocG=An!=ZR3=9kmp00i_ I>zopr0PU>-!~g&Q literal 0 HcmV?d00001 diff --git a/Tests/LibWeb/Ref/reference/svg-text-effects-ref.html b/Tests/LibWeb/Ref/reference/svg-text-effects-ref.html new file mode 100644 index 0000000000..24b8a82f0b --- /dev/null +++ b/Tests/LibWeb/Ref/reference/svg-text-effects-ref.html @@ -0,0 +1,15 @@ + + + diff --git a/Tests/LibWeb/Ref/svg-text-effects.html b/Tests/LibWeb/Ref/svg-text-effects.html new file mode 100644 index 0000000000..a656f34075 --- /dev/null +++ b/Tests/LibWeb/Ref/svg-text-effects.html @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + +There you go :^) +thakis + diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 4a82b04ab9..7e714f4a46 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -491,11 +491,10 @@ set(SOURCES Painting/ProgressPaintable.cpp Painting/RadioButtonPaintable.cpp Painting/RecordingPainter.cpp - Painting/SVGGeometryPaintable.cpp + Painting/SVGPathPaintable.cpp Painting/SVGGraphicsPaintable.cpp Painting/SVGPaintable.cpp Painting/SVGSVGPaintable.cpp - Painting/SVGTextPaintable.cpp Painting/ShadowPainting.cpp Painting/StackingContext.cpp Painting/TableBordersPainting.cpp diff --git a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp index 98ed65a2eb..7c35847431 100644 --- a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp +++ b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include namespace Web::Layout { @@ -272,8 +272,8 @@ void LayoutState::commit(Box& root) svg_graphics_paintable.set_computed_transforms(*used_values.computed_svg_transforms()); } - if (used_values.computed_svg_path().has_value() && is(paintable_box)) { - auto& svg_geometry_paintable = static_cast(paintable_box); + if (used_values.computed_svg_path().has_value() && is(paintable_box)) { + auto& svg_geometry_paintable = static_cast(paintable_box); svg_geometry_paintable.set_computed_path(move(*used_values.computed_svg_path())); } } diff --git a/Userland/Libraries/LibWeb/Layout/SVGFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/SVGFormattingContext.cpp index caf71c7c55..e7ba0590eb 100644 --- a/Userland/Libraries/LibWeb/Layout/SVGFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/SVGFormattingContext.cpp @@ -196,27 +196,20 @@ void SVGFormattingContext::run(Box const& box, LayoutMode layout_mode, Available graphics_box_state.set_computed_svg_transforms(Painting::SVGGraphicsPaintable::ComputedTransforms(viewbox_transform, svg_transform)); auto to_css_pixels_transform = Gfx::AffineTransform {}.multiply(viewbox_transform).multiply(svg_transform); + Gfx::Path path; if (is(descendant)) { - auto path = static_cast(dom_node).get_path(); - auto path_bounding_box = to_css_pixels_transform.map(path.bounding_box()).to_type(); - // Stroke increases the path's size by stroke_width/2 per side. - CSSPixels stroke_width = CSSPixels::nearest_value_for(graphics_box.dom_node().visible_stroke_width() * viewbox_transform.x_scale()); - path_bounding_box.inflate(stroke_width, stroke_width); - graphics_box_state.set_content_offset(path_bounding_box.top_left()); - graphics_box_state.set_content_width(path_bounding_box.width()); - graphics_box_state.set_content_height(path_bounding_box.height()); - graphics_box_state.set_computed_svg_path(move(path)); + path = static_cast(dom_node).get_path(); } else if (is(descendant)) { auto& text_element = static_cast(dom_node); // FIXME: Support arbitrary path transforms for fonts. // FIMXE: This assumes transform->x_scale() == transform->y_scale(). - auto& scaled_font = graphics_box.scaled_font(to_css_pixels_transform.x_scale()); + auto& font = graphics_box.font(); auto text_contents = text_element.text_contents(); + Utf8View text_utf8 { text_contents }; + auto text_width = font.width(text_utf8); - auto text_offset = text_element.get_offset().transformed(to_css_pixels_transform).to_type(); - auto text_width = CSSPixels::nearest_value_for(scaled_font.width(Utf8View { text_contents })); - + auto text_offset = text_element.get_offset(); // https://svgwg.org/svg2-draft/text.html#TextAnchoringProperties switch (text_element.text_anchor().value_or(SVG::TextAnchor::Start)) { case SVG::TextAnchor::Start: @@ -240,11 +233,18 @@ void SVGFormattingContext::run(Box const& box, LayoutMode layout_mode, Available VERIFY_NOT_REACHED(); } - auto text_height = CSSPixels::nearest_value_for(scaled_font.pixel_size()); - graphics_box_state.set_content_offset(text_offset.translated(0, -text_height)); - graphics_box_state.set_content_width(text_width); - graphics_box_state.set_content_height(text_height); + path.move_to(text_offset); + path.text(text_utf8, font); } + + auto path_bounding_box = to_css_pixels_transform.map(path.bounding_box()).to_type(); + // Stroke increases the path's size by stroke_width/2 per side. + CSSPixels stroke_width = CSSPixels::nearest_value_for(graphics_box.dom_node().visible_stroke_width() * viewbox_transform.x_scale()); + path_bounding_box.inflate(stroke_width, stroke_width); + graphics_box_state.set_content_offset(path_bounding_box.top_left()); + graphics_box_state.set_content_width(path_bounding_box.width()); + graphics_box_state.set_content_height(path_bounding_box.height()); + graphics_box_state.set_computed_svg_path(move(path)); } else if (is(descendant)) { SVGFormattingContext nested_context(m_state, static_cast(descendant), this); nested_context.run(static_cast(descendant), layout_mode, available_space); diff --git a/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp b/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp index 88b0dc13ae..88b8212787 100644 --- a/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.cpp @@ -6,7 +6,7 @@ */ #include -#include +#include #include #include @@ -19,7 +19,7 @@ SVGGeometryBox::SVGGeometryBox(DOM::Document& document, SVG::SVGGeometryElement& JS::GCPtr SVGGeometryBox::create_paintable() const { - return Painting::SVGGeometryPaintable::create(*this); + return Painting::SVGPathPaintable::create(*this); } } diff --git a/Userland/Libraries/LibWeb/Layout/SVGTextBox.cpp b/Userland/Libraries/LibWeb/Layout/SVGTextBox.cpp index a7257c89a5..a9c2bc1af5 100644 --- a/Userland/Libraries/LibWeb/Layout/SVGTextBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/SVGTextBox.cpp @@ -5,7 +5,7 @@ */ #include -#include +#include #include namespace Web::Layout { @@ -17,7 +17,7 @@ SVGTextBox::SVGTextBox(DOM::Document& document, SVG::SVGTextPositioningElement& JS::GCPtr SVGTextBox::create_paintable() const { - return Painting::SVGTextPaintable::create(*this); + return Painting::SVGPathPaintable::create(*this); } } diff --git a/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp b/Userland/Libraries/LibWeb/Painting/SVGPathPaintable.cpp similarity index 88% rename from Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp rename to Userland/Libraries/LibWeb/Painting/SVGPathPaintable.cpp index 979ef84df8..f9b28d02fb 100644 --- a/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/SVGPathPaintable.cpp @@ -6,27 +6,27 @@ */ #include -#include +#include #include namespace Web::Painting { -JS::NonnullGCPtr SVGGeometryPaintable::create(Layout::SVGGeometryBox const& layout_box) +JS::NonnullGCPtr SVGPathPaintable::create(Layout::SVGGraphicsBox const& layout_box) { - return layout_box.heap().allocate_without_realm(layout_box); + return layout_box.heap().allocate_without_realm(layout_box); } -SVGGeometryPaintable::SVGGeometryPaintable(Layout::SVGGeometryBox const& layout_box) +SVGPathPaintable::SVGPathPaintable(Layout::SVGGraphicsBox const& layout_box) : SVGGraphicsPaintable(layout_box) { } -Layout::SVGGeometryBox const& SVGGeometryPaintable::layout_box() const +Layout::SVGGraphicsBox const& SVGPathPaintable::layout_box() const { - return static_cast(layout_node()); + return static_cast(layout_node()); } -Optional SVGGeometryPaintable::hit_test(CSSPixelPoint position, HitTestType type) const +Optional SVGPathPaintable::hit_test(CSSPixelPoint position, HitTestType type) const { auto result = SVGGraphicsPaintable::hit_test(position, type); if (!result.has_value() || !computed_path().has_value()) @@ -49,7 +49,7 @@ static Gfx::Painter::WindingRule to_gfx_winding_rule(SVG::FillRule fill_rule) } } -void SVGGeometryPaintable::paint(PaintContext& context, PaintPhase phase) const +void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const { if (!is_visible() || !computed_path().has_value()) return; diff --git a/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.h b/Userland/Libraries/LibWeb/Painting/SVGPathPaintable.h similarity index 62% rename from Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.h rename to Userland/Libraries/LibWeb/Painting/SVGPathPaintable.h index 97831534bf..051e079e29 100644 --- a/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.h +++ b/Userland/Libraries/LibWeb/Painting/SVGPathPaintable.h @@ -6,22 +6,22 @@ #pragma once -#include +#include #include namespace Web::Painting { -class SVGGeometryPaintable final : public SVGGraphicsPaintable { - JS_CELL(SVGGeometryPaintable, SVGGraphicsPaintable); +class SVGPathPaintable final : public SVGGraphicsPaintable { + JS_CELL(SVGPathPaintable, SVGGraphicsPaintable); public: - static JS::NonnullGCPtr create(Layout::SVGGeometryBox const&); + static JS::NonnullGCPtr create(Layout::SVGGraphicsBox const&); virtual Optional hit_test(CSSPixelPoint, HitTestType) const override; virtual void paint(PaintContext&, PaintPhase) const override; - Layout::SVGGeometryBox const& layout_box() const; + Layout::SVGGraphicsBox const& layout_box() const; void set_computed_path(Gfx::Path path) { @@ -31,7 +31,7 @@ public: Optional const& computed_path() const { return m_computed_path; } protected: - SVGGeometryPaintable(Layout::SVGGeometryBox const&); + SVGPathPaintable(Layout::SVGGraphicsBox const&); Optional m_computed_path = {}; }; diff --git a/Userland/Libraries/LibWeb/Painting/SVGTextPaintable.cpp b/Userland/Libraries/LibWeb/Painting/SVGTextPaintable.cpp deleted file mode 100644 index ac1c2f0b83..0000000000 --- a/Userland/Libraries/LibWeb/Painting/SVGTextPaintable.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2023, Aliaksandr Kalenik - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include -#include - -namespace Web::Painting { - -JS::NonnullGCPtr SVGTextPaintable::create(Layout::SVGTextBox const& layout_box) -{ - return layout_box.heap().allocate_without_realm(layout_box); -} - -SVGTextPaintable::SVGTextPaintable(Layout::SVGTextBox const& layout_box) - : SVGGraphicsPaintable(layout_box) -{ -} - -void SVGTextPaintable::paint(PaintContext& context, PaintPhase phase) const -{ - if (!is_visible()) - return; - - if (!layout_node().computed_values().fill().has_value()) - return; - - if (layout_node().computed_values().fill()->is_url()) { - dbgln("FIXME: Using url() as fill is not supported for svg text"); - return; - } - - SVGGraphicsPaintable::paint(context, phase); - - if (phase != PaintPhase::Foreground) - return; - - auto& painter = context.painter(); - auto const& dom_node = layout_box().dom_node(); - auto paint_transform = computed_transforms().svg_to_device_pixels_transform(context); - auto& scaled_font = layout_box().scaled_font(paint_transform.x_scale()); - auto text_rect = context.enclosing_device_rect(absolute_rect()).to_type(); - auto text_contents = dom_node.text_contents(); - - painter.draw_text_run(text_rect.bottom_left(), Utf8View { text_contents }, scaled_font, layout_node().computed_values().fill()->as_color(), text_rect); -} - -} diff --git a/Userland/Libraries/LibWeb/Painting/SVGTextPaintable.h b/Userland/Libraries/LibWeb/Painting/SVGTextPaintable.h deleted file mode 100644 index 7476722964..0000000000 --- a/Userland/Libraries/LibWeb/Painting/SVGTextPaintable.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2023, Aliaksandr Kalenik - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include -#include - -namespace Web::Painting { - -class SVGTextPaintable final : public SVGGraphicsPaintable { - JS_CELL(SVGTextPaintable, SVGGraphicsPaintable); - -public: - static JS::NonnullGCPtr create(Layout::SVGTextBox const&); - - virtual void paint(PaintContext&, PaintPhase) const override; - - Layout::SVGTextBox const& layout_box() const - { - return static_cast(layout_node()); - } - -protected: - SVGTextPaintable(Layout::SVGTextBox const&); -}; - -}