diff options
Diffstat (limited to 'layout/reftests/text-svgglyphs')
57 files changed, 1356 insertions, 0 deletions
diff --git a/layout/reftests/text-svgglyphs/clip-ref.html b/layout/reftests/text-svgglyphs/clip-ref.html new file mode 100644 index 000000000..c310bfb86 --- /dev/null +++ b/layout/reftests/text-svgglyphs/clip-ref.html @@ -0,0 +1,21 @@ +<html> + <head> + <style type="text/css"> + @font-face { + font-family : svgttf; + src : url(resources/svg.woff); + } + + body { + font-family : svgttf; + font-size : 200px; + color : palevioletred; + } + </style> + </head> + <body> + <div> +O<br> + </div> + </body> +</html> diff --git a/layout/reftests/text-svgglyphs/clip.html b/layout/reftests/text-svgglyphs/clip.html new file mode 100644 index 000000000..f2d4a4654 --- /dev/null +++ b/layout/reftests/text-svgglyphs/clip.html @@ -0,0 +1,39 @@ +<html class="reftest-wait"> + <!-- + This test makes sure that the glyph extents are being extended to + the bounds of the SVG glyph by placing an SVG glyph in a div outside + the truetype extents but inside the SVG extents + --> + <head> + <style type="text/css"> + @font-face { + font-family : svgttf; + src : url(resources/svg.woff); + } + + body { + font-family : svgttf; + font-size : 200px; + color : palevioletred; + } + + div { + width : 160px; + overflow : hidden; + } + </style> + <script type="text/javascript"> + function expand() { + var div = document.getElementById("thediv"); + div.style.width = "200px"; + document.documentElement.removeAttribute("class"); + } + window.addEventListener("MozReftestInvalidate", expand, false); + </script> + </head> + <body> + <div id="thediv"> +O<br> + </div> + </body> +</html> diff --git a/layout/reftests/text-svgglyphs/reftest-stylo.list b/layout/reftests/text-svgglyphs/reftest-stylo.list new file mode 100644 index 000000000..af81c4772 --- /dev/null +++ b/layout/reftests/text-svgglyphs/reftest-stylo.list @@ -0,0 +1,27 @@ +# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing +pref(gfx.font_rendering.opentype_svg.enabled,false) == svg-glyph-basic.svg svg-glyph-basic.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(skiaContent,1,200) == svg-glyph-basic.svg svg-glyph-basic.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-invalid-ids.svg svg-glyph-invalid-ids.svg +pref(gfx.font_rendering.opentype_svg.enabled,false) == svg-glyph-positioning.svg svg-glyph-positioning.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(skiaContent,2,350) == svg-glyph-positioning.svg svg-glyph-positioning.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-html.html svg-glyph-html.html +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-direct.svg svg-glyph-direct.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-invalid.html svg-glyph-invalid.html +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-objectfill-solid.svg svg-glyph-objectfill-solid.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(skiaContent,2,200) == svg-glyph-objectstroke-solid.svg svg-glyph-objectstroke-solid.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy(1,7) fuzzy-if(gtkWidget&&/^Linux\x20x86_64/.test(http.oscpu),1,79) fuzzy-if(B2G,1,21) fuzzy-if(skiaContent,1,300) == svg-glyph-objectgradient.svg svg-glyph-objectgradient.svg +# see bug 871961#c5 +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(cocoaWidget,1,7028) fuzzy-if(gtkWidget&&/^Linux\x20x86_64/.test(http.oscpu),1,23) fuzzy-if(skiaContent,1,250) == svg-glyph-objectgradient-zoom.svg svg-glyph-objectgradient-zoom.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(gtkWidget,1,1438) fuzzy-if(winWidget,1,1954) fuzzy-if(Android||B2G,8,3795) == svg-glyph-objectpattern.svg svg-glyph-objectpattern.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) == clip.html clip.html +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy(1,13) fuzzy-if(gtkWidget&&/^Linux\x20x86_64/.test(http.oscpu),1,62) fuzzy-if(B2G,1,25) fuzzy-if(skiaContent,1,350) == svg-glyph-objectopacity.svg svg-glyph-objectopacity.svg +# see bug 871961#c5 +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(gtkWidget,1,2268) fuzzy-if(winWidget,1,3074) fuzzy-if(Android||B2G,5,4715) == svg-glyph-objectopacity2.svg svg-glyph-objectopacity2.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(skiaContent,2,200) == svg-glyph-paintnone.svg svg-glyph-paintnone.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(skiaContent,2,200) == svg-glyph-cachedopacity.svg svg-glyph-cachedopacity.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(cocoaWidget,255,100) == svg-glyph-objectvalue.svg svg-glyph-objectvalue.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-mask.svg svg-glyph-mask.svg +# bug 872483 +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-paint-server.svg svg-glyph-paint-server.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-transform.svg svg-glyph-transform.svg +skip == svg-glyph-extents.html svg-glyph-extents.html diff --git a/layout/reftests/text-svgglyphs/reftest.list b/layout/reftests/text-svgglyphs/reftest.list new file mode 100644 index 000000000..6f328ab73 --- /dev/null +++ b/layout/reftests/text-svgglyphs/reftest.list @@ -0,0 +1,23 @@ +pref(gfx.font_rendering.opentype_svg.enabled,false) != svg-glyph-basic.svg svg-glyph-basic-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(skiaContent,1,200) == svg-glyph-basic.svg svg-glyph-basic-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-invalid-ids.svg svg-glyph-invalid-ids-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,false) != svg-glyph-positioning.svg svg-glyph-positioning-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(skiaContent,2,350) == svg-glyph-positioning.svg svg-glyph-positioning-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-html.html svg-glyph-html-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-direct.svg svg-glyph-direct-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-invalid.html svg-glyph-invalid-ref.html +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-objectfill-solid.svg svg-glyph-objectfill-solid-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(skiaContent,2,200) == svg-glyph-objectstroke-solid.svg svg-glyph-objectstroke-solid-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy(1,7) fuzzy-if(gtkWidget&&/^Linux\x20x86_64/.test(http.oscpu),1,79) fuzzy-if(skiaContent,1,300) == svg-glyph-objectgradient.svg svg-glyph-objectgradient-ref.svg # see bug 871961#c5 +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(cocoaWidget,1,7028) fuzzy-if(gtkWidget&&/^Linux\x20x86_64/.test(http.oscpu),1,23) fuzzy-if(skiaContent,1,250) == svg-glyph-objectgradient-zoom.svg svg-glyph-objectgradient-zoom-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(gtkWidget,1,1438) fuzzy-if(winWidget,1,1954) fuzzy-if(Android,8,3795) fuzzy-if(skiaContent,14,13000) == svg-glyph-objectpattern.svg svg-glyph-objectpattern-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) == clip.html clip-ref.html +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy(1,13) fuzzy-if(gtkWidget&&/^Linux\x20x86_64/.test(http.oscpu),1,62) fuzzy-if(skiaContent,1,350) == svg-glyph-objectopacity.svg svg-glyph-objectopacity-ref.svg # see bug 871961#c5 +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(gtkWidget,1,2268) fuzzy-if(winWidget,1,3074) fuzzy-if(Android,5,4715) fuzzy-if(skiaContent,8,13000) == svg-glyph-objectopacity2.svg svg-glyph-objectopacity2-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(skiaContent,2,200) == svg-glyph-paintnone.svg svg-glyph-paintnone-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(skiaContent,2,200) == svg-glyph-cachedopacity.svg svg-glyph-cachedopacity-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fuzzy-if(cocoaWidget,255,100) == svg-glyph-objectvalue.svg svg-glyph-objectvalue-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) fails == svg-glyph-mask.svg svg-glyph-mask-ref.svg # bug 872483 +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-paint-server.svg svg-glyph-paint-server-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-transform.svg svg-glyph-transform-ref.svg +pref(gfx.font_rendering.opentype_svg.enabled,true) == svg-glyph-extents.html svg-glyph-extents-ref.html diff --git a/layout/reftests/text-svgglyphs/resources/README b/layout/reftests/text-svgglyphs/resources/README new file mode 100644 index 000000000..852e5e420 --- /dev/null +++ b/layout/reftests/text-svgglyphs/resources/README @@ -0,0 +1,61 @@ +.woff files for SVG-in-OpenType testing +======================================= + +There are three .woff files in this directory: + * nosvg.woff + * svg.woff + * rubbish.woff + +nosvg.woff +---------- +This font is FiraSansOT-Regular, with its metrics hacked so that its ascent +is 1000 and descent is 0. Its unitsPerEm value is 1000. + +It contains no 'SVG ' table. + +svg.woff +-------- +This font is the same as nosvg.woff above, but with the glyphs-*.svg SVG +documents from this directory embedded in it using the tools described below. + +rubbish.woff +------------ +This font is the same as nosvg.woff above, but with the addition of an 'SVG ' +table with the contents of rubbish.txt. Its purpose is to test that SVG tables +without valid XML are ignored. + +Creating the Fonts +------------------ +The tools used here are insertsvg.py from [1] and sfnt2woff from [2]. + +svg.woff can be recreated with: + +woff2sfnt nosvg.woff > nosvg.ttf +insertsvg.py nosvg.ttf svg.ttf glyphs-*.svg +sfnt2woff svg.ttf + +[1] https://github.com/edf825/SVG-OpenType-Utils +[2] http://people.mozilla.com/~jkew/woff/ + + + +Additional test fonts: +====================== + +svg-glyph-extents.otf +--------------------- + +This is a copy of Fira Sans with a simple SVG table added using the tool from +https://github.com/rocallahan/svg-opentype-workshop. The SVG table defines four +glyphs, corresponding to 'A' through 'D': + + <svg xmlns='http://www.w3.org/2000/svg'> + <rect id='glyph36' x='0' y='-1000' width='1000' height='1500' fill='red'/> + <rect id='glyph37' x='0' y='-1000' width='1000' height='1500' fill='green' transform='scale(2)'/> + <g id='glyph38'> + <rect x='0' y='-1000' width='1000' height='1500' fill='red'/> + </g> + <g id='glyph39'> + <rect x='0' y='-1000' width='1000' height='1500' fill='green' transform='scale(2)'/> + </g> + </svg> diff --git a/layout/reftests/text-svgglyphs/resources/glyphs-base.svg b/layout/reftests/text-svgglyphs/resources/glyphs-base.svg new file mode 100644 index 000000000..51c32135c --- /dev/null +++ b/layout/reftests/text-svgglyphs/resources/glyphs-base.svg @@ -0,0 +1,13 @@ +<svg xmlns="http://www.w3.org/2000/svg"> +<!-- + Basic test SVG glyphs + Covers glyph ID 47 +--> + <!-- char = L --> + <g id="glyph47"> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + stroke="black" fill="red"/> + <rect x="100" y="-1000" width="100" height="100" stroke="none" + fill="turquoise" /> + </g> +</svg> diff --git a/layout/reftests/text-svgglyphs/resources/glyphs-invalid.svg b/layout/reftests/text-svgglyphs/resources/glyphs-invalid.svg new file mode 100644 index 000000000..4740b4ff3 --- /dev/null +++ b/layout/reftests/text-svgglyphs/resources/glyphs-invalid.svg @@ -0,0 +1,40 @@ +<svg xmlns="http://www.w3.org/2000/svg"> +<!-- + Test handling of invalid ids +--> + <!-- not valid: leading space not allowed --> + <g id="glyph 48"> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + fill="red"/> + </g> + <!-- not valid: leading zero not allowed --> + <g id="glyph048"> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + fill="red"/> + </g> + <!-- not valid: trailing garbage not allowed --> + <g id="glyph48xxx"> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + fill="red"/> + </g> + <!-- not valid: trailing space not allowed --> + <g id="glyph48 "> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + fill="red"/> + </g> + <!-- not valid: floating point not allowed --> + <g id="glyph48.0"> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + fill="red"/> + </g> + <!-- char = M --> + <g id="glyph48"> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + fill="lime"/> + </g> + <!-- Ensure first glyph48 is picked --> + <g id="glyph48"> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + fill="red"/> + </g> +</svg> diff --git a/layout/reftests/text-svgglyphs/resources/glyphs-objectcolor.svg b/layout/reftests/text-svgglyphs/resources/glyphs-objectcolor.svg new file mode 100644 index 000000000..cf738d0cc --- /dev/null +++ b/layout/reftests/text-svgglyphs/resources/glyphs-objectcolor.svg @@ -0,0 +1,24 @@ +<svg xmlns="http://www.w3.org/2000/svg"> +<!-- + Test SVG glyphs for text object pattern inheritance + Covers glyph ID range 49 (N) to 52 (Q) +--> +<!-- context-fill, no stroke --> + <!-- N --> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + stroke="none" fill="context-fill" id="glyph49"/> + + <!-- O --> + <rect x="50" y="-950" width="900" height="900" stroke-width="100" + fill="context-fill" stroke="none" id="glyph50"/> + +<!-- context-stroke --> + <!-- P --> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + stroke="context-stroke" fill="burlywood" id="glyph51"/> + +<!-- both context-stroke and context-fill (but note swapped usage!) --> + <!-- Q --> + <rect x="50" y="-950" width="900" height="900" stroke-width="100" + fill="context-stroke" stroke="context-fill" id="glyph52"/> +</svg> diff --git a/layout/reftests/text-svgglyphs/resources/glyphs-objectopacity.svg b/layout/reftests/text-svgglyphs/resources/glyphs-objectopacity.svg new file mode 100644 index 000000000..7fc479e22 --- /dev/null +++ b/layout/reftests/text-svgglyphs/resources/glyphs-objectopacity.svg @@ -0,0 +1,59 @@ +<svg xmlns="http://www.w3.org/2000/svg"> +<!-- + Test SVG glyphs for text object opacity inheritance + Covers glyph ID range 53 (R) to 60 (Y) +--> + <!-- R --> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + fill="context-fill" stroke="context-stroke" + fill-opacity="context-fill-opacity" + stroke-opacity="context-stroke-opacity" id="glyph53"/> + + <!-- S --> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + fill="context-fill" stroke="context-stroke" + fill-opacity="context-stroke-opacity" + stroke-opacity="context-fill-opacity" id="glyph54"/> + + <!-- T --> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + fill="context-stroke" stroke="context-fill" + fill-opacity="context-fill-opacity" + stroke-opacity="context-stroke-opacity" id="glyph55"/> + + <!-- U --> + <!-- Test for bug where explicit `inherit' would fail for + *-opacity="objectStrokeOpacity" or "objectFillOpacity" --> + <g style="fill-opacity : context-stroke-opacity; stroke-opacity : context-fill-opacity"> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + fill="context-stroke" stroke="context-fill" + fill-opacity="inherit" stroke-opacity="inherit" id="glyph56"/> + </g> + + <!-- W --> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + fill="darkorchid" stroke="goldenrod" + fill-opacity="context-fill-opacity" + stroke-opacity="context-stroke-opacity" id="glyph58"/> + + <!-- X --> + <rect x="100" y="-900" width="800" height="800" stroke-width="50" + fill="darkorchid" stroke="goldenrod" + fill-opacity="context-stroke-opacity" + stroke-opacity="context-fill-opacity" id="glyph59"/> + + <style type="text/css"><![CDATA[ + #glyph60 { + fill-opacity : context-fill-opacity; + stroke-opacity : context-stroke-opacity; + } + #ychild { + color-interpolation : sRGB; + } + ]]></style> + <!-- Y --> + <g id="glyph60"> + <rect x="100" y="-900" width="800" height="300" stroke="red" stroke-width="50"/> + <rect x="100" y="-400" width="800" height="300" stroke="red" stroke-width="50" id="ychild" /> + </g> +</svg> diff --git a/layout/reftests/text-svgglyphs/resources/glyphs-objectstroke.svg b/layout/reftests/text-svgglyphs/resources/glyphs-objectstroke.svg new file mode 100644 index 000000000..44afb2f60 --- /dev/null +++ b/layout/reftests/text-svgglyphs/resources/glyphs-objectstroke.svg @@ -0,0 +1,25 @@ +<svg xmlns="http://www.w3.org/2000/svg"> +<!-- + Test SVG glyphs for text object stroke value inheritance + Covers glyph ID range 68 (a) to 71 (d) +--> + <!-- a --> + <rect x="100" y="-900" width="800" height="800" stroke="powderblue" + stroke-width="50" stroke-dashoffset="35" + stroke-dasharray="50 50" id="glyph68" /> + + <!-- b --> + <rect x="100" y="-900" width="800" height="800" stroke="chartreuse" + stroke-width="50" stroke-dashoffset="35" + stroke-dasharray="context-value" id="glyph69" /> + + <!-- c --> + <rect x="100" y="-900" width="800" height="800" stroke="sienna" + stroke-width="50" stroke-dasharray="50 50" + stroke-dashoffset="context-value" id="glyph70" /> + + <!-- d --> + <rect x="100" y="-900" width="800" height="800" stroke="olivedrab" + stroke-width="context-value" stroke-dasharray="context-value" + stroke-dashoffset="context-value" id="glyph71" /> +</svg> diff --git a/layout/reftests/text-svgglyphs/resources/glyphs-paintservers.svg b/layout/reftests/text-svgglyphs/resources/glyphs-paintservers.svg new file mode 100644 index 000000000..7f5a95ac0 --- /dev/null +++ b/layout/reftests/text-svgglyphs/resources/glyphs-paintservers.svg @@ -0,0 +1,28 @@ +<svg xmlns="http://www.w3.org/2000/svg"> +<!-- + SVG test glyphs for paint servers within SVG glyphs + e: tests that we can refer to paint servers within the SVG glyph doc + (i.e. fill="url(#grad)" works) + f: tests that stop-color="context-{fill,stroke}" uses the context fill/stroke + fallback color +--> + <defs> + <linearGradient id="grad"> + <stop offset="0%" stop-color="papayawhip" /> + <stop offset="100%" stop-color="plum" /> + </linearGradient> + + <linearGradient id="grad2"> + <stop offset="0%" stop-color="context-fill" /> + <stop offset="100%" stop-color="context-stroke" /> + </linearGradient> + </defs> + + <!-- char 'e' --> + <rect id="glyph72" x="250" y="-750" width="500" height="500" + fill="url(#grad)" /> + + <!-- char 'f' --> + <rect id="glyph73" x="250" y="-750" width="500" height="500" + fill="url(#grad2)" /> +</svg> diff --git a/layout/reftests/text-svgglyphs/resources/glyphs-transforms.svg b/layout/reftests/text-svgglyphs/resources/glyphs-transforms.svg new file mode 100644 index 000000000..ff3d9ffb7 --- /dev/null +++ b/layout/reftests/text-svgglyphs/resources/glyphs-transforms.svg @@ -0,0 +1,67 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> +<!-- + SVG test glyphs for transforms within SVG glyphs + 'g': simple red square used as a reference + 'h': a smaller square, with a transform that should make it match the 'g' + 'i': similar, applying a transform to the referenced element + 'j': has a large blue square that should be transformed such that it is + completely hidden by the red + 'k': tests the accumulation of several transforms + 'l': checks that a transform from outside the glyph element is NOT applied + 'm', 'n', 'o', 'p': all render the same <rect> but only 'm' and 'n' should be + transformed; 'o' and 'p' should match 'q' + 'q': the unscaled small square, reference for 'o' and 'p' above +--> + + <defs> + <!-- this rect will need to be scaled 5x to match the reference glyph 'g' --> + <rect id="small" x="50" y="-150" width="100" height="100" fill="red" /> + </defs> + + <!-- char 'g' --> + <rect id="glyph74" x="250" y="-750" width="500" height="500" fill="red" /> + + <!-- char 'h' --> + <rect id="glyph75" x="25" y="-75" width="50" height="50" transform="scale(10)" fill="red" /> + + <!-- char 'i' --> + <g id="glyph76"> + <use xlink:href="#small" transform="scale(5)" /> + </g> + + <!-- char 'j' --> + <g id="glyph77"> + <g transform="translate(300,-300) scale(0.4)"> + <rect x="0" y="-1000" width="1000" height="1000" fill="blue" /> + </g> + <g transform="scale(5)"> + <use xlink:href="#small" /> + </g> + </g> + + <!-- char 'k' --> + <g id="glyph78" transform="scale(0.5)"> + <g transform="scale(0.5)"> + <use xlink:href="#small" transform="scale(20)" /> + </g> + </g> + + <!-- char 'l' --> + <g transform="scale(2)"> + <g id="glyph79"> + <use xlink:href="#small" transform="scale(5)" /> + </g> + </g> + + <g id="glyph80"> <!-- char 'm' --> + <g id="glyph81" transform="scale(5)"> <!-- char 'n' --> + <g id="glyph82"> <!-- char 'o' --> + <use id="glyph83" xlink:href="#small" /> <!-- char 'p' --> + </g> + </g> + </g> + + <!-- char 'q' --> + <use id="glyph84" xlink:href="#small" /> + +</svg> diff --git a/layout/reftests/text-svgglyphs/resources/nosvg.woff b/layout/reftests/text-svgglyphs/resources/nosvg.woff Binary files differnew file mode 100644 index 000000000..ad5334187 --- /dev/null +++ b/layout/reftests/text-svgglyphs/resources/nosvg.woff diff --git a/layout/reftests/text-svgglyphs/resources/rubbish.txt b/layout/reftests/text-svgglyphs/resources/rubbish.txt new file mode 100644 index 000000000..1ad163181 --- /dev/null +++ b/layout/reftests/text-svgglyphs/resources/rubbish.txt @@ -0,0 +1 @@ +This is the text contained in the rubbish.ttf 'SVG ' table. It is obviously not XML, and should thus be ignored. diff --git a/layout/reftests/text-svgglyphs/resources/rubbish.woff b/layout/reftests/text-svgglyphs/resources/rubbish.woff Binary files differnew file mode 100644 index 000000000..3c83e02a3 --- /dev/null +++ b/layout/reftests/text-svgglyphs/resources/rubbish.woff diff --git a/layout/reftests/text-svgglyphs/resources/svg-glyph-extents.otf b/layout/reftests/text-svgglyphs/resources/svg-glyph-extents.otf Binary files differnew file mode 100644 index 000000000..1083f397f --- /dev/null +++ b/layout/reftests/text-svgglyphs/resources/svg-glyph-extents.otf diff --git a/layout/reftests/text-svgglyphs/resources/svg.woff b/layout/reftests/text-svgglyphs/resources/svg.woff Binary files differnew file mode 100644 index 000000000..6deee1460 --- /dev/null +++ b/layout/reftests/text-svgglyphs/resources/svg.woff diff --git a/layout/reftests/text-svgglyphs/svg-glyph-basic-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-basic-ref.svg new file mode 100644 index 000000000..205529a50 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-basic-ref.svg @@ -0,0 +1,8 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <g> + <rect x="20" y="20" width="160" height="160" stroke-width="10" + stroke="black" fill="red" /> + <rect x="20" y="0" width="20" height="20" stroke="none" + fill="turquoise" /> + </g> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-basic.svg b/layout/reftests/text-svgglyphs/svg-glyph-basic.svg new file mode 100644 index 000000000..6eea7d986 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-basic.svg @@ -0,0 +1,25 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <style type="text/css"> + <![CDATA[ + @font-face { + font-family: "Liberation"; + src:url(resources/svg.woff); + } + text + { + font-family: Liberation; + font-size: 200px; + stroke: black; + } + ]]> + </style> + <!-- + Test that SVG glyphs are being drawn instead of TrueType glyphs + Also testing that this does not happen if the + gfx.font_rendering.opentype_svg.enabled preference is set to true. + --> + <!-- glyphid --> + <text x="0" y="200"> + L + </text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-cachedopacity-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-cachedopacity-ref.svg new file mode 100644 index 000000000..944ad2efc --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-cachedopacity-ref.svg @@ -0,0 +1,6 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <rect x="20" y="20" width="160" height="60" stroke="red" stroke-width="10" + fill-opacity="0.5" stroke-opacity="0.5" /> + <rect x="20" y="120" width="160" height="60" stroke="red" stroke-width="10" + fill-opacity="0.5" stroke-opacity="0.5" /> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-cachedopacity.svg b/layout/reftests/text-svgglyphs/svg-glyph-cachedopacity.svg new file mode 100644 index 000000000..60b11344c --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-cachedopacity.svg @@ -0,0 +1,20 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <style type="text/css"><![CDATA[ + @font-face { + font-family : svgwoff; + src : url(resources/svg.woff); + } + text { + font-family : svgwoff; + font-size : 200px; + fill-opacity : 0.5; + stroke-opacity : 0.5; + } + ]]></style> + + <!-- + Test for a bug where cached fill-opacity and stroke-opacity values were + being destroyed + --> + <text x="0" y="200" stroke="black">Y</text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-direct-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-direct-ref.svg new file mode 100644 index 000000000..67a5fb8d2 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-direct-ref.svg @@ -0,0 +1,27 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + + <title>Reference for SVG glyphs being painted when painting properties are simple</title> + + <style> + <![CDATA[ + @font-face { + font-family: "Liberation"; + src: url(resources/svg.woff); + } + text { + font-family: Liberation; + font-size: 200px; + fill: url(#transparent); + } + ]]> + </style> + + <linearGradient id="transparent"> + <stop/> + </linearGradient> + + <!-- The gradient paint server fill is not used by the "L" glyph, + but setting it forces the code path that fills and strokes text + in the SVG text frame to be chosen. --> + <text x="0" y="200">L</text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-direct.svg b/layout/reftests/text-svgglyphs/svg-glyph-direct.svg new file mode 100644 index 000000000..c1e38a2ce --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-direct.svg @@ -0,0 +1,19 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + + <title>Test for SVG glyphs being painted when painting properties are simple</title> + + <style> + <![CDATA[ + @font-face { + font-family: "Liberation"; + src: url(resources/svg.woff); + } + text { + font-family: Liberation; + font-size: 200px; + } + ]]> + </style> + + <text x="0" y="200">L</text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-extents-ref.html b/layout/reftests/text-svgglyphs/svg-glyph-extents-ref.html new file mode 100644 index 000000000..bd9847928 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-extents-ref.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html> +<meta charset="utf-8"> +<head> +<style type="text/css"> +@font-face { + font-family: foo; + src: url(resources/svg-glyph-extents.otf); +} +body { + font-family: foo; + font-size: 10px; +} +div { + display: inline-block; + height: 100px; + width: 100px; +} +</style> +</head> +<body> +<div>A</div> +<div>B</div> +<div>C</div> +<div>D</div> +</body> +</html> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-extents.html b/layout/reftests/text-svgglyphs/svg-glyph-extents.html new file mode 100644 index 000000000..01679a3ad --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-extents.html @@ -0,0 +1,46 @@ +<!DOCTYPE html> +<html class="reftest-wait"> +<meta charset="utf-8"> +<head> +<style type="text/css"> +@font-face { + font-family: foo; + src: url(resources/svg-glyph-extents.otf); +} +body { + font-family: foo; + font-size: 10px; +} +@keyframes test { + from { + font-size: 100px; + } + to { + font-size: 10px; + } +} +div { + display: inline-block; + height: 100px; + width: 100px; + animation-duration: 3s; + animation-name: test; +} +</style> +<script type="text/javascript"> +function setup() { + var e = document.getElementById("watchme"); + e.addEventListener("animationend", listener, false); +} +function listener() { + document.documentElement.className = ""; +} +</script> +</head> +<body onload="setup()"> +<div>A</div> +<div id="watchme">B</div> +<div>C</div> +<div>D</div> +</body> +</html> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-html-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-html-ref.svg new file mode 100644 index 000000000..6360240ff --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-html-ref.svg @@ -0,0 +1,11 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <title>Reference for SVG glyphs being used in HTML content</title> + <style> + @font-face { + font-family: "Liberation"; + src: url(resources/svg.woff); + } + text { font: 200px Liberation; fill: fuchsia; stroke: black; } + </style> + <text x="0" y="200">b</text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-html.html b/layout/reftests/text-svgglyphs/svg-glyph-html.html new file mode 100644 index 000000000..5d4298f6d --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-html.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<title>Test for SVG glyphs being used in HTML content</title> +<style> + @font-face { + font-family: "Liberation"; + src: url(resources/svg.woff); + } + html { width: 400px; height: 400px; background-color: white; } + body { margin: 0; } + div { font: 200px Liberation; color: fuchsia; line-height: 1; stroke: none; } +</style> +<div>b</div> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-invalid-ids-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-invalid-ids-ref.svg new file mode 100644 index 000000000..8666756e4 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-invalid-ids-ref.svg @@ -0,0 +1,6 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <g> + <rect x="20" y="20" width="160" height="160" stroke-width="10" + fill="lime" /> + </g> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-invalid-ids.svg b/layout/reftests/text-svgglyphs/svg-glyph-invalid-ids.svg new file mode 100644 index 000000000..25813f297 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-invalid-ids.svg @@ -0,0 +1,22 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <style type="text/css"> + <![CDATA[ + @font-face { + font-family: "Liberation"; + src:url(resources/svg.woff); + } + text + { + font-family: Liberation; + font-size: 200px; + } + ]]> + </style> + <!-- + Test that the right SVG glyph is picked from a document containing various + invalid glyph IDs. + --> + <text x="0" y="200"> + M + </text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-invalid-ref.html b/layout/reftests/text-svgglyphs/svg-glyph-invalid-ref.html new file mode 100644 index 000000000..632e8f2ca --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-invalid-ref.html @@ -0,0 +1,18 @@ +<html> + <head> + <title>Reference for test that invalid XML in the 'SVG ' table is rejected</title> + <style> + @font-face { + font-family : 'Liberation'; + src : url(resources/nosvg.woff); + } + body { + font-family : 'Liberation'; + font-size : 200px; + } + </style> + </head> + <body> + LML︁ + </body> +</html> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-invalid.html b/layout/reftests/text-svgglyphs/svg-glyph-invalid.html new file mode 100644 index 000000000..3c785d02f --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-invalid.html @@ -0,0 +1,23 @@ +<html> + <head> + <title>Test that invalid XML in the 'SVG ' table is rejected</title> + <style> + @font-face { + font-family : 'Liberation'; + src : url(resources/rubbish.woff); + } + body { + font-family : 'Liberation'; + font-size : 200px; + } + </style> + </head> + <!-- + The font file resources/rubbish.woff contains an SVG table which + does not contain valid XML. This test makes sure it falls back + on rendering the text using the truetype outlines. + --> + <body> + LML︁ + </body> +</html> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-mask-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-mask-ref.svg new file mode 100644 index 000000000..4f3509c0d --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-mask-ref.svg @@ -0,0 +1,15 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <style> + @font-face { + font-family: "Liberation"; + src: url(resources/svg.woff); + } + </style> + <mask id="m" x="0" y="0" width="200" height="200"> + <rect x="30" y="60" width="80" height="80" stroke-width="5" + stroke="black" fill="red"/> + <rect x="30" y="50" width="10" height="10" stroke="none" + fill="turquoise" /> + </mask> + <rect width="200" height="200" mask="url(#m)"/> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-mask.svg b/layout/reftests/text-svgglyphs/svg-glyph-mask.svg new file mode 100644 index 000000000..930ce43e0 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-mask.svg @@ -0,0 +1,12 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <style> + @font-face { + font-family: "Liberation"; + src: url(resources/svg.woff); + } + </style> + <mask id="m" x="0" y="0" width="200" height="200"> + <text x="20" y="150" style="font: 100px Liberation">L</text> + </mask> + <rect width="200" height="200" mask="url(#m)"/> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectfill-solid-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectfill-solid-ref.svg new file mode 100644 index 000000000..dbaf7f5e1 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectfill-solid-ref.svg @@ -0,0 +1,4 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <rect x="20" y="20" width="160" height="160" fill="turquoise" /> + <rect x="10" y="210" width="180" height="180" fill="thistle" /> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectfill-solid.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectfill-solid.svg new file mode 100644 index 000000000..72b57b30b --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectfill-solid.svg @@ -0,0 +1,27 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <!-- + Test that solid colors are inherited when using the objectFill + paint server value in SVG glyphs + --> + + <style type="text/css"> + <![CDATA[ + @font-face { + font-family: "Liberation"; + src:url(resources/svg.woff); + } + text + { + font-family: Liberation; + font-size: 200px; + } + ]]> + </style> + + <text fill="turquoise" x="0" y="200"> + N + </text> + <text fill="thistle" x="0" y="400"> + O + </text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectgradient-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectgradient-ref.svg new file mode 100644 index 000000000..91ebb683d --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectgradient-ref.svg @@ -0,0 +1,25 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + + <defs> + <linearGradient id="grad" x1="0" y1="0" x2="800" y2="800" gradientUnits="userSpaceOnUse"> + <stop stop-color="purple" offset="0%" /> + <stop stop-color="lime" offset="100%" /> + </linearGradient> + <radialGradient id="grad2" cx="250" cy="400" r="400" gradientUnits="userSpaceOnUse"> + <stop stop-color="red" offset="0%" /> + <stop stop-color="blue" offset="100%" /> + </radialGradient> + </defs> + + <rect x="20" y="20" width="160" height="160" stroke="none" + fill="url(#grad)" /> + + <rect x="310" y="10" width="180" height="180" fill="url(#grad)" + stroke="none" /> + + <rect x="20" y="320" width="160" height="160" fill="burlywood" + stroke="url(#grad2)" stroke-width="10" /> + + <rect x="310" y="310" width="180" height="180" fill="url(#grad2)" + stroke="url(#grad)" stroke-width="20" /> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectgradient-zoom-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectgradient-zoom-ref.svg new file mode 100644 index 000000000..95f3d1bb7 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectgradient-zoom-ref.svg @@ -0,0 +1,25 @@ +<svg xmlns="http://www.w3.org/2000/svg" reftest-zoom="0.5"> + + <defs> + <linearGradient id="grad" x1="0" y1="0" x2="800" y2="800" gradientUnits="userSpaceOnUse"> + <stop stop-color="purple" offset="0%" /> + <stop stop-color="lime" offset="100%" /> + </linearGradient> + <radialGradient id="grad2" cx="250" cy="400" r="400" gradientUnits="userSpaceOnUse"> + <stop stop-color="red" offset="0%" /> + <stop stop-color="blue" offset="100%" /> + </radialGradient> + </defs> + + <rect x="20" y="20" width="160" height="160" stroke="none" + fill="url(#grad)" /> + + <rect x="310" y="10" width="180" height="180" fill="url(#grad)" + stroke="none" /> + + <rect x="20" y="320" width="160" height="160" fill="burlywood" + stroke="url(#grad2)" stroke-width="10" /> + + <rect x="310" y="310" width="180" height="180" fill="url(#grad2)" + stroke="url(#grad)" stroke-width="20" /> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectgradient-zoom.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectgradient-zoom.svg new file mode 100644 index 000000000..cebc4fb04 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectgradient-zoom.svg @@ -0,0 +1,35 @@ +<svg xmlns="http://www.w3.org/2000/svg" reftest-zoom="0.5"> + <!-- + Test that gradients are inherited from the outer object under zoom + --> + + <style type="text/css"><![CDATA[ + @font-face { + font-family: "Liberation"; + src:url("resources/svg.woff") format("woff"); + } + + text { + font-family: "Liberation"; + font-size: 200px; + stroke-width: 5; + } + ]]></style> + + <defs> + <linearGradient id="grad" x1="0" y1="0" x2="800" y2="800" gradientUnits="userSpaceOnUse"> + <stop stop-color="purple" offset="0%" /> + <stop stop-color="lime" offset="100%" /> + </linearGradient> + <radialGradient id="grad2" cx="250" cy="400" r="400" gradientUnits="userSpaceOnUse"> + <stop stop-color="red" offset="0%" /> + <stop stop-color="blue" offset="100%" /> + </radialGradient> + + </defs> + + <text x="0" y="200" fill="url(#grad)" stroke="url(#grad2)">N</text> + <text x="300" y="200" fill="url(#grad)" stroke="url(#grad2)">O</text> + <text x="0" y="500" fill="url(#grad)" stroke="url(#grad2)">P</text> + <text x="300" y="500" fill="url(#grad)" stroke="url(#grad2)">Q</text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectgradient.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectgradient.svg new file mode 100644 index 000000000..97f10bda4 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectgradient.svg @@ -0,0 +1,36 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <!-- + Test that gradients are inherited from the outer object when using + the objectFill and objectStroke paint server values in SVG glyphs + --> + + <style type="text/css"><![CDATA[ + @font-face { + font-family: "Liberation"; + src:url("resources/svg.woff") format("woff"); + } + + text { + font-family: "Liberation"; + font-size: 200px; + stroke-width: 5; + } + ]]></style> + + <defs> + <linearGradient id="grad" x1="0" y1="0" x2="800" y2="800" gradientUnits="userSpaceOnUse"> + <stop stop-color="purple" offset="0%" /> + <stop stop-color="lime" offset="100%" /> + </linearGradient> + <radialGradient id="grad2" cx="250" cy="400" r="400" gradientUnits="userSpaceOnUse"> + <stop stop-color="red" offset="0%" /> + <stop stop-color="blue" offset="100%" /> + </radialGradient> + + </defs> + + <text x="0" y="200" fill="url(#grad)" stroke="url(#grad2)">N</text> + <text x="300" y="200" fill="url(#grad)" stroke="url(#grad2)">O</text> + <text x="0" y="500" fill="url(#grad)" stroke="url(#grad2)">P</text> + <text x="300" y="500" fill="url(#grad)" stroke="url(#grad2)">Q</text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectopacity-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectopacity-ref.svg new file mode 100644 index 000000000..8dfb53ace --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectopacity-ref.svg @@ -0,0 +1,30 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + + <defs> + <linearGradient id="grad" x1="0" y1="0" x2="800" y2="800" gradientUnits="userSpaceOnUse"> + <stop stop-color="purple" offset="0%" /> + <stop stop-color="lime" offset="100%" /> + </linearGradient> + <radialGradient id="grad2" cx="250" cy="400" r="400" gradientUnits="userSpaceOnUse"> + <stop stop-color="red" offset="0%" /> + <stop stop-color="blue" offset="100%" /> + </radialGradient> + </defs> + + <rect x="20" y="20" width="160" height="160" stroke-width="10" + fill="url(#grad)" stroke="url(#grad2)" + fill-opacity="0.5" stroke-opacity="1.0" /> + + <rect x="320" y="20" width="160" height="160" stroke-width="10" + fill="url(#grad)" stroke="url(#grad2)" + fill-opacity="1.0" stroke-opacity="0.5" /> + + <rect x="20" y="320" width="160" height="160" stroke-width="10" + fill="url(#grad2)" stroke="url(#grad)" + fill-opacity="0.5" stroke-opacity="1.0" /> + + <rect x="320" y="320" width="160" height="160" stroke-width="10" + fill="url(#grad2)" stroke="url(#grad)" + fill-opacity="1.0" stroke-opacity="0.5" /> + +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectopacity.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectopacity.svg new file mode 100644 index 000000000..c323640d4 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectopacity.svg @@ -0,0 +1,40 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <!-- + Test that fill-opacity is correctly inherited from the outer text + object when -moz-objectFillOpacity is used in an SVG glyph. + --> + + <style type="text/css"><![CDATA[ + @font-face { + font-family: "Liberation"; + src:url("resources/svg.woff") format("woff"); + } + + text { + font-family: "Liberation"; + font-size: 200px; + stroke-width: 5; + fill-opacity: 0.5; + fill: url(#grad); + stroke-opacity: 1.0; + stroke: url(#grad2); + } + ]]></style> + + <defs> + <linearGradient id="grad" x1="0" y1="0" x2="800" y2="800" gradientUnits="userSpaceOnUse"> + <stop stop-color="purple" offset="0%" /> + <stop stop-color="lime" offset="100%" /> + </linearGradient> + <radialGradient id="grad2" cx="250" cy="400" r="400" gradientUnits="userSpaceOnUse"> + <stop stop-color="red" offset="0%" /> + <stop stop-color="blue" offset="100%" /> + </radialGradient> + + </defs> + + <text x="0" y="200">R</text> + <text x="300" y="200">S</text> + <text x="0" y="500">T</text> + <text x="300" y="500">U</text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectopacity2-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectopacity2-ref.svg new file mode 100644 index 000000000..6a261afdb --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectopacity2-ref.svg @@ -0,0 +1,30 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + + <defs> + <pattern id="pat" x="0" y="0" width="50" height="50" patternUnits="userSpaceOnUse"> + <rect x="5" y="5" width="30" height="30" stroke="salmon" stroke-width="5" + fill="mistyrose" /> + </pattern> + <pattern id="pat2" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"> + <rect x="5" y="5" width="10" height="10" stroke="lavenderblush" stroke-width="2" + fill="lemonchiffon" /> + </pattern> + </defs> + + <rect x="20" y="20" width="160" height="160" stroke-width="10" + fill="url(#pat)" stroke="url(#pat2)" + fill-opacity="1.0" stroke-opacity="0.5" /> + + <rect x="320" y="20" width="160" height="160" stroke-width="10" + fill="url(#pat)" stroke="url(#pat2)" + fill-opacity="0.5" stroke-opacity="1.0" /> + + <rect x="20" y="320" width="160" height="160" stroke-width="10" + fill="url(#pat2)" stroke="url(#pat)" + fill-opacity="1.0" stroke-opacity="0.5" /> + + <rect x="320" y="320" width="160" height="160" stroke-width="10" + fill="url(#pat2)" stroke="url(#pat)" + fill-opacity="0.5" stroke-opacity="1.0" /> + +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectopacity2.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectopacity2.svg new file mode 100644 index 000000000..40e4fadf0 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectopacity2.svg @@ -0,0 +1,39 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <!-- + Test that stroke-opacity is correctly inherited from the outer text + object when -moz-objectStrokeOpacity is used in an SVG glyph. + --> + + <style type="text/css"><![CDATA[ + @font-face { + font-family: "Liberation"; + src:url("resources/svg.woff") format("woff"); + } + + text { + font-family: "Liberation"; + font-size: 200px; + stroke-width: 5; + fill-opacity: 1.0; + fill: url(#pat); + stroke-opacity: 0.5; + stroke: url(#pat2); + } + ]]></style> + + <defs> + <pattern id="pat" x="0" y="0" width="50" height="50" patternUnits="userSpaceOnUse"> + <rect x="5" y="5" width="30" height="30" stroke="salmon" stroke-width="5" + fill="mistyrose" /> + </pattern> + <pattern id="pat2" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"> + <rect x="5" y="5" width="10" height="10" stroke="lavenderblush" stroke-width="2" + fill="lemonchiffon" /> + </pattern> + </defs> + + <text x="0" y="200">R</text> + <text x="300" y="200">S</text> + <text x="0" y="500">T</text> + <text x="300" y="500">U</text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectpattern-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectpattern-ref.svg new file mode 100644 index 000000000..e12e60d1b --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectpattern-ref.svg @@ -0,0 +1,25 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + + <defs> + <pattern id="pat" x="0" y="0" width="50" height="50" patternUnits="userSpaceOnUse"> + <rect x="5" y="5" width="30" height="30" stroke="salmon" stroke-width="5" + fill="mistyrose" /> + </pattern> + <pattern id="pat2" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"> + <rect x="5" y="5" width="10" height="10" stroke="lavenderblush" stroke-width="2" + fill="lemonchiffon" /> + </pattern> + </defs> + + <rect x="20" y="20" width="160" height="160" stroke="none" + fill="url(#pat)" /> + + <rect x="310" y="10" width="180" height="180" fill="url(#pat)" + stroke="none" /> + + <rect x="20" y="320" width="160" height="160" fill="burlywood" + stroke="url(#pat2)" stroke-width="10" /> + + <rect x="310" y="310" width="180" height="180" fill="url(#pat2)" + stroke="url(#pat)" stroke-width="20" /> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectpattern.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectpattern.svg new file mode 100644 index 000000000..475165cd4 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectpattern.svg @@ -0,0 +1,35 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <!-- + Test that patterns are inherited from the outer object when using + the objectFill and objectStroke paint server values in SVG glyphs + --> + + <style type="text/css"><![CDATA[ + @font-face { + font-family: "Liberation"; + src:url("resources/svg.woff") format("woff"); + } + + text { + font-family: "Liberation"; + font-size: 200px; + stroke-width: 5; + } + ]]></style> + + <defs> + <pattern id="pat" x="0" y="0" width="50" height="50" patternUnits="userSpaceOnUse"> + <rect x="5" y="5" width="30" height="30" stroke="salmon" stroke-width="5" + fill="mistyrose" /> + </pattern> + <pattern id="pat2" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"> + <rect x="5" y="5" width="10" height="10" stroke="lavenderblush" stroke-width="2" + fill="lemonchiffon" /> + </pattern> + </defs> + + <text x="0" y="200" fill="url(#pat)" stroke="url(#pat2)">N</text> + <text x="300" y="200" fill="url(#pat)" stroke="url(#pat2)">O</text> + <text x="0" y="500" fill="url(#pat)" stroke="url(#pat2)">P</text> + <text x="300" y="500" fill="url(#pat)" stroke="url(#pat2)">Q</text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectstroke-solid-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectstroke-solid-ref.svg new file mode 100644 index 000000000..797357537 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectstroke-solid-ref.svg @@ -0,0 +1,6 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <rect x="20" y="20" width="160" height="160" + stroke-width="10" stroke="cornflowerblue" fill="burlywood" /> + <rect x="10" y="210" width="180" height="180" + stroke-width="20" stroke="blanchedalmond" fill="darkolivegreen" /> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectstroke-solid.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectstroke-solid.svg new file mode 100644 index 000000000..8e1088df7 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectstroke-solid.svg @@ -0,0 +1,27 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <!-- + Test that solid colors are inherited when using the objectStroke + paint server value in SVG glyphs + --> + + <style type="text/css"> + <![CDATA[ + @font-face { + font-family: "Liberation"; + src:url(resources/svg.woff); + } + text + { + font-family: Liberation; + font-size: 200px; + } + ]]> + </style> + + <text stroke="cornflowerblue" x="0" y="200"> + P + </text> + <text fill="blanchedalmond" stroke="darkolivegreen" x="0" y="400"> + Q + </text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectvalue-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectvalue-ref.svg new file mode 100644 index 000000000..73e006f35 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectvalue-ref.svg @@ -0,0 +1,13 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <style type="text/css"><![CDATA[ + rect { + stroke-width: 10; + stroke-dasharray: 10 10; + stroke-dashoffset: 7; + } + ]]></style> + <rect x="20" y="20" width="160" height="160" stroke="powderblue" /> + <rect x="220" y="20" width="160" height="160" stroke="chartreuse" /> + <rect x="20" y="220" width="160" height="160" stroke="sienna" /> + <rect x="220" y="220" width="160" height="160" stroke="olivedrab" /> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-objectvalue.svg b/layout/reftests/text-svgglyphs/svg-glyph-objectvalue.svg new file mode 100644 index 000000000..1a94b4355 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-objectvalue.svg @@ -0,0 +1,21 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <style type="text/css"><![CDATA[ + @font-face { + font-family: svgwoff; + src: url(resources/svg.woff); + } + + text { + font-family: svgwoff; + font-size: 200px; + stroke-width: 10; + stroke-dasharray: 10 10; + stroke-dashoffset: 7; + stroke: black; + } + ]]></style> + <text x="0" y="200">a</text> + <text x="200" y="200">b</text> + <text x="0" y="400">c</text> + <text x="200" y="400">d</text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-paint-server-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-paint-server-ref.svg new file mode 100644 index 000000000..dde80a92f --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-paint-server-ref.svg @@ -0,0 +1,10 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <defs> + <linearGradient id="grad"> + <stop offset="0%" stop-color="papayawhip" /> + <stop offset="100%" stop-color="plum" /> + </linearGradient> + </defs> + + <rect x="50" y="50" width="100" height="100" fill="url(#grad)" /> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-paint-server.svg b/layout/reftests/text-svgglyphs/svg-glyph-paint-server.svg new file mode 100644 index 000000000..4e3bdd677 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-paint-server.svg @@ -0,0 +1,21 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <style type="text/css"> + <![CDATA[ + @font-face { + font-family: "Liberation"; + src:url(resources/svg.woff); + } + text + { + font-family: Liberation; + font-size: 200px; + } + ]]> + </style> + <!-- + Test that paintservers within SVG glyph documents are rendered properly + --> + <text x="0" y="200"> + e + </text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-paintnone-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-paintnone-ref.svg new file mode 100644 index 000000000..cde840eb4 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-paintnone-ref.svg @@ -0,0 +1,17 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <rect x="30" y="30" width="160" height="160" stroke-width="10" + fill="darkorchid" stroke="none" + fill-opacity="0.5" /> + + <rect x="30" y="230" width="160" height="160" stroke-width="10" + stroke="goldenrod" fill="none" + stroke-opacity="0.5" /> + + <rect x="230" y="30" width="160" height="160" stroke-width="10" + stroke="goldenrod" fill="none" + stroke-opacity="0.5" /> + + <rect x="230" y="230" width="160" height="160" stroke-width="10" + fill="darkorchid" stroke="none" + fill-opacity="0.5" /> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-paintnone.svg b/layout/reftests/text-svgglyphs/svg-glyph-paintnone.svg new file mode 100644 index 000000000..7b8d01d87 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-paintnone.svg @@ -0,0 +1,25 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <style type="text/css"> + <![CDATA[ + @font-face { + font-family: "Liberation"; + src:url(resources/svg.woff); + } + text + { + font-family: Liberation; + font-size: 200px; + stroke-opacity: 0.5; + fill-opacity: 0.5; + } + ]]> + </style> + <!-- + Test that objectFillOpacity evaluates to 0 when fill="none" even when + fill-opacity is set, and similar for objectStrokeOpacity. + --> + <text x="10" y="210" stroke="none" fill="black">W</text> + <text x="10" y="410" stroke="black" fill="none">W</text> + <text x="210" y="210" stroke="none" fill="black">X</text> + <text x="210" y="410" stroke="black" fill="none">X</text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-positioning-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-positioning-ref.svg new file mode 100644 index 000000000..10e8ff116 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-positioning-ref.svg @@ -0,0 +1,21 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <!-- The "L" glyph in Fira Sans has been hacked to have an advance of + exactly 500/1000 em, or 100px at a font size of 200px. --> + <!-- L --> + <rect x="20" y="20" width="160" height="160" stroke-width="10" + stroke="black" fill="red" /> + <rect x="20" y="0" width="20" height="20" stroke="none" + fill="turquoise" /> + + <!-- L --> + <rect x="120" y="20" width="160" height="160" stroke-width="10" + stroke="black" fill="red" /> + <rect x="120" y="0" width="20" height="20" stroke="none" + fill="turquoise" /> + + <!-- L --> + <rect x="220" y="20" width="160" height="160" stroke-width="10" + stroke="black" fill="red" /> + <rect x="220" y="0" width="20" height="20" stroke="none" + fill="turquoise" /> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-positioning.svg b/layout/reftests/text-svgglyphs/svg-glyph-positioning.svg new file mode 100644 index 000000000..a16056a24 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-positioning.svg @@ -0,0 +1,23 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <style type="text/css"> + <![CDATA[ + @font-face { + font-family: "Liberation"; + src:url(resources/svg.woff); + } + text + { + font-family: Liberation; + font-size: 200px; + stroke: black; + } + ]]> + </style> + <!-- + Test that we're rendering in the right place in the middle of a + text run + --> + <text x="0" y="200"> + LLL + </text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-transform-ref.svg b/layout/reftests/text-svgglyphs/svg-glyph-transform-ref.svg new file mode 100644 index 000000000..759e06ae4 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-transform-ref.svg @@ -0,0 +1,48 @@ +<svg xmlns="http://www.w3.org/2000/svg"> + <style type="text/css"> + <![CDATA[ + @font-face { + font-family: "Liberation"; + src:url(resources/svg.woff); + } + text + { + font-family: Liberation; + font-size: 100px; + } + ]]> + </style> + <!-- + Test that transforms within SVG glyph documents are applied properly + --> + <text x="0" y="100"> + g + </text> + <text x="0" y="200"> + g + </text> + <text x="0" y="300"> + g + </text> + + <text x="100" y="100"> + g + </text> + <text x="100" y="200"> + g + </text> + <text x="100" y="300"> + g + </text> + + <text x="200" y="100"> + g + </text> + <!-- note that the next two are different from the preceding glyphs! --> + <text x="200" y="200"> + q + </text> + <text x="200" y="300"> + q + </text> +</svg> diff --git a/layout/reftests/text-svgglyphs/svg-glyph-transform.svg b/layout/reftests/text-svgglyphs/svg-glyph-transform.svg new file mode 100644 index 000000000..933dea372 --- /dev/null +++ b/layout/reftests/text-svgglyphs/svg-glyph-transform.svg @@ -0,0 +1,48 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="300" height="600"> + <style type="text/css"> + <![CDATA[ + @font-face { + font-family: "Liberation"; + src:url(resources/svg.woff); + } + text + { + font-family: Liberation; + font-size: 100px; + } + ]]> + </style> + <!-- + Test that transforms within SVG glyph documents are applied properly + --> + <text x="0" y="100"> + h + </text> + <text x="0" y="200"> + i + </text> + <text x="0" y="300"> + j + </text> + + <text x="100" y="100"> + k + </text> + <text x="100" y="200"> + l + </text> + <text x="100" y="300"> + m + </text> + + <text x="200" y="100"> + n + </text> + <!-- note that the next two are different from the preceding glyphs! --> + <text x="200" y="200"> + o + </text> + <text x="200" y="300"> + p + </text> +</svg> |