RESOLVED FIXED 112032
SVG rendering ignores xml:space="preserve" attribute for text
https://bugs.webkit.org/show_bug.cgi?id=112032
Summary SVG rendering ignores xml:space="preserve" attribute for text
Peter Boström
Reported 2013-03-11 08:39:01 PDT
Rendering a SVG file which contains multiple spaces inside text, and the xml:space="preserve" attribute will will still compact space characters. (Acting like xml:space="default".) I think the offending line is in RenderSVGInlineText::RenderSVGInlineText on line 69 in chromium/src/third_party/WebKit/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp, but I am overall unfamiliar with the WebRTC code base. The constructor for RenderSVGInlineText strips additional whitespace regardless of this tag. Attaching screenshot of this bug in Chromium, using WebKit 537.32 (trunk@143310), and expected result as rendered inside Firefox.
Attachments
Screenshot of render error (328.35 KB, image/png)
2013-03-11 08:40 PDT, Peter Boström
no flags
Example SVG file (2.52 KB, image/svg+xml)
2013-03-11 08:41 PDT, Peter Boström
no flags
Simpler test case (265 bytes, image/svg+xml)
2014-12-05 17:00 PST, Said Abou-Hallawa
no flags
Peter Boström
Comment 1 2013-03-11 08:40:39 PDT
Created attachment 192477 [details] Screenshot of render error
Peter Boström
Comment 2 2013-03-11 08:41:07 PDT
Created attachment 192478 [details] Example SVG file
Arty
Comment 3 2013-11-21 02:23:31 PST
It seems that xml:space attribute is simply not inherited. In your example SVG file this attribute is specified on the enclosing text tag and it does not work. If you specify this attribute directly in the tspan tag, the white space will be preserved. This is clearly a bug as xml:space attribute should be inheritable according to section 10.15 of the Scalable Vector Graphics (SVG) 1.1 (Second Edition) specification.
Said Abou-Hallawa
Comment 4 2014-12-05 16:59:14 PST
Here is a simpler test case. Open the following SVG in WebKit: <svg xmlns="http://www.w3.org/2000/svg" version="1.1" font-family="monospace" font-size="20" xml:space="preserve"> <text x="30" y="50"> Hello there</text> <text x="30" y="100">Hello there</text> </svg> Result: The two lines of text are aligned vertically with one space between the two words in each of them. Expected: The leading spaces in the first line should shift the display position of the word "Hello". Also the spaces between the word "Hello" and the word "there" of the first line should be persevered.
Said Abou-Hallawa
Comment 5 2014-12-05 17:00:13 PST
Created attachment 242682 [details] Simpler test case
Radar WebKit Bug Importer
Comment 6 2014-12-05 17:01:14 PST
EWS
Comment 7 2022-10-24 09:44:18 PDT
Committed 255917@main (40db7d1db402): <https://commits.webkit.org/255917@main> Reviewed commits have been landed. Closing PR #5670 and removing active labels.
Ahmad Saleem
Comment 8 2022-10-27 09:32:25 PDT
*** Bug 149665 has been marked as a duplicate of this bug. ***
Tim Nguyen (:ntim)
Comment 9 2023-01-13 17:28:30 PST
Bug 250603 will revert this change due to a regression on wsj.com
Ahmad Saleem
Comment 10 2023-04-26 10:24:20 PDT
(In reply to Tim Nguyen (:ntim) from comment #9) > Bug 250603 will revert this change due to a regression on wsj.com Do we have web page where I can test locally whether this is something on our end or wsj.com end and why this is not reproducible in Chrome, which has this patch.
EWS
Comment 11 2024-07-25 14:06:55 PDT
Committed 281364@main (e4359d3e33a4): <https://commits.webkit.org/281364@main> Reviewed commits have been landed. Closing PR #31060 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.