`context-value` stroke attributes in SVG glyphs are handled incorrectly
Categories
(Core :: SVG, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox102 | --- | fixed |
People
(Reporter: jfkthame, Assigned: jfkthame)
Details
Attachments
(3 files)
When an SVG-in-OpenType glyph uses the context-value keyword for stroke properties such as stroke-width, the resulting value is computed incorrectly depending on the device-pixel scale of the context.
Testcase: from a local mozilla-central checkout, load the two files
layout/reftests/text-svgglyphs/svg-glyph-objectvalue.svg
layout/reftests/text-svgglyphs/svg-glyph-objectvalue-ref.svg
These should render four squares with dashed borders, and the two files should render identically. These are SVG glyphs found in the test font's SVG table; the four glyphs are encoded as 'a' through 'd':
<svgDoc endGlyphID="71" startGlyphID="68">
<![CDATA[<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>
]]>
</svgDoc>
On a display with 100% scaling (devicePixelRatio = 1.0), the test document does indeed match the reference file.
However, on a Mac retina (200%) display, or a Windows display with scaling > 100%, the borders of the glyphs where context-value is used vary in their dashing and/or width, because the context-value is evaluated incorrectly.
This error can also be seen even on a low-dpi (100% scaling) display by simply zooming the document. As the display is zoomed in (and so the CSS-to-devicePixel ratio changes), the dashing of the three test squares progressively changes.
| Assignee | ||
Comment 1•4 years ago
|
||
This makes the context-value option for stroke width and dash properties in SVG glyphs work
consistently in non-1.0 devicePixelRatio situations (e.g. browser zoom, high-dpi displays).
Updated•4 years ago
|
| Assignee | ||
Comment 2•4 years ago
|
||
This checks for CSS-vs-devicePixel confusion when setting "context-value" properties
for the stroke.
Depends on D146886
Updated•4 years ago
|
Updated•4 years ago
|
Comment 4•4 years ago
|
||
Backed out for causing reftest failures on svg-glyph-objectvalue.svg
- Backout link
- Push with failures
- Failure Log
- Failure line: REFTEST TEST-UNEXPECTED-FAIL | layout/reftests/text-svgglyphs/svg-glyph-objectvalue.svg != layout/reftests/text-svgglyphs/svg-glyph-objectvalue-75.svg | image comparison, max difference: 0, number of differing pixels: 0
Updated•4 years ago
|
| Assignee | ||
Comment 5•4 years ago
|
||
The failure appears only on the reftest-snapshot job, which apparently doesn't respect reftest-zoom. I'll annotate it as failing there.
| Assignee | ||
Updated•4 years ago
|
Comment 7•4 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/6f75b115c177
https://hg.mozilla.org/mozilla-central/rev/bd92b2280e0d
Description
•