Support ::first-letter and ::first-line on SVG <text>
Categories
(Core :: SVG, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox124 | --- | fixed |
People
(Reporter: sebo, Assigned: longsonr)
References
()
Details
(Keywords: dev-doc-complete, Whiteboard: tlt-backlog, [wptsync upstream])
Attachments
(3 files, 1 obsolete file)
SVG 2 requires the ::first-letter and ::first-line pseudo-elements to apply to <text> elements[1]. This bug is to add support for them. Sebastian [1] https://svgwg.org/svg2-draft/text.html#TextProperties
Updated•8 years ago
|
Updated•8 years ago
|
Reporter | ||
Comment 1•8 years ago
|
||
In the attached test case the 'a' should be displayed bigger (which it is) and be green and the 'b' should be blue. Sebastian
Assignee | ||
Comment 2•8 years ago
|
||
SVG text is coloured using the CSS fill property and not the html color property. I think the testcase is displaying as it should.
Assignee | ||
Comment 3•8 years ago
|
||
Assignee | ||
Updated•8 years ago
|
Assignee | ||
Comment 4•8 years ago
|
||
Although swapping color for fill seems not to work.
Reporter | ||
Comment 5•8 years ago
|
||
(In reply to Robert Longson from comment #2) > SVG text is coloured using the CSS fill property and not the html color > property. I think the testcase is displaying as it should. Oops, sorry, tried different things and forgot to change it back to 'fill'. As you mentioned, 'fill' doesn't work either, unfortunately. Sebastian
Updated•7 years ago
|
Reporter | ||
Updated•5 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 6•3 months ago
|
||
Updated•3 months ago
|
Assignee | ||
Comment 7•3 months ago
|
||
Depends on D200595
Assignee | ||
Updated•3 months ago
|
Assignee | ||
Comment 8•3 months ago
|
||
Assignee | ||
Comment 9•3 months ago
|
||
Comment 10•3 months ago
|
||
Pushed by longsonr@gmail.com: https://hg.mozilla.org/integration/autoland/rev/3983fe0bd56f Part 1 - clean up spec references r=emilio https://hg.mozilla.org/integration/autoland/rev/1118131d963c Part 2 - support SVG properties on first-letter and first-line r=jfkthame,emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/44440 for changes under testing/web-platform/tests
Updated•3 months ago
|
Comment hidden (obsolete) |
Assignee | ||
Updated•3 months ago
|
Comment 13•3 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/3983fe0bd56f
https://hg.mozilla.org/mozilla-central/rev/1118131d963c
Upstream PR merged by moz-wptsync-bot
Assignee | ||
Comment 15•3 months ago
•
|
||
Release Note Request (optional, but appreciated)
[Why is this notable]:
Relevant SVG CSS text properties can be applied to the ::first-letter and ::first-line pseudo elements now. So you can fill and stroke the first letter of SVG text using the ::first-letter as well as change the font. Note that you'll need to use the white-space CSS property to force SVG text to respect newlines if you want to make use of first-line.
[Affects Firefox for Android]:
yes
[Suggested wording]:
[Links (documentation, blog post, etc)]:
https://www.w3.org/TR/SVG2/text.html#TextProperties
https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter
https://developer.mozilla.org/en-US/docs/Web/CSS/::first-line
https://codepen.io/CodeRedDigital/pen/MWxROBR
There's a testcase in this bug too.
Reporter | ||
Comment 16•3 months ago
|
||
This should also be added to the related browser compat data.
Sebastian
Comment 17•2 months ago
•
|
||
I have been experimenting with this and the test-case.
text::first-letter {
fill: red;
}
fill has no effect nor does stroke.
There appears absolutely no way to add multiple line text so there is no way to target ::first-line
in a <text>
element.
Using <tspan>
is not the solution for this as they are treated as separate <span>
elements.
Assignee | ||
Comment 18•2 months ago
|
||
First letter works for me, the bug landed with a test to prove it works.
First line works too but you'd need to engineer separate lines and to do that you'd need to use the white-space CSS property to force the text to respect newlines.
Comment 19•2 months ago
|
||
Thank you for your assistance I now have this all working as expected.
Description
•