Closed Bug 828962 Opened 13 years ago Closed 13 years ago

xml:space="preserve" changes how foreignObject html is rendered

Categories

(Core :: SVG, defect)

18 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla21
Tracking Status
firefox18 --- affected
firefox19 - ---
firefox20 - ---
firefox21 - fixed

People

(Reporter: reg-bugzilla, Assigned: heycam)

References

Details

(Keywords: regression)

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0 Build ID: 20130104151925 Steps to reproduce: Insert a SVG with a foreign object containing HTML. Indent the HTML of the foreign object for better code readability. Actual results: The whitespaces within the source code of the SVG's foreign object are displayed in the rendered page. This destroys the layout of the SVG with its foreign object. It worked correctly in the version 17 of firefox. Expected results: The white spaces used to indent the source code should be ignored when rendering the output.
Component: Untriaged → SVG
Product: Firefox → Core
Could you provide a minimal testcase, please.
Flags: needinfo?(reg-bugzilla)
Keywords: testcase-wanted
Flags: needinfo?(reg-bugzilla)
Attachment #703238 - Attachment mime type: text/plain → text/html
Cameron, it seems the xml:space="preserve" now feeds into foreignObject child content. Any thoughts on if we should do anything and if so, what?
Keywords: testcase-wanted
So this is due to the new UA style rule in svg.css: *[xml|space=preserve] { white-space: -moz-pre-discard-newlines; } I admittedly did not consider how this might affect <foreignObject>s. We could change -moz-pre-discard-newlines to mean "only preformatted but discarding newlines on SVG elements, but like 'normal' on other elements". Or, we could add another rule foreignObject { white-space: normal; } although this might be confusing if you wrote for example: <!doctype html> <body style="white-space: pre-line"> <svg> ... <foreignObject> ... </foreignObject> </svg> </body> Still, it might be acceptable, given that we really want to (at some point soon) convince people to use white-space rather than xml:space="".
And ideally the solution we choose should be palatable enough to put in specs.
Regression range: m-c good=2012-10-03 bad=2012-10-04 http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=635fcc11d2b1&tochange=4cb8f88213f5 Suspected bug: Cameron McCormack — Bug 655877 - Part 23b: Add UA style sheet rules to map xml:space='preserve' to white-space:-moz-pre-discard-newlines on SVG text elements. r=jwatt
Blocks: svgtext
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
I posted to www-svg to see if people there have opinions too. http://www.w3.org/mid/50F7E238.7040000@mcc.id.au
This will be odd with either solution. <!doctype html> <body style="white-space: pre-line"> <svg xml:space="preserve"> ... <foreignObject> <p>Where did my white-space pre-line go?</p> </foreignObject> </svg> </body>
FWIW I like your second idea more.
It appears that this issue can be easily worked around server-side, and has not caused significant breakage on the web. We'd accept uplift of a low risk fix, once found.
Summary: SVG with foreign objects source code not correctly rendered → xml:space="preserve" changes how foreignObject html is rendered
OS: Windows 7 → All
Hardware: x86_64 → All
Attached patch patchSplinter Review
No reply on the mailing list. Let's just do that second option for now. If others in the WG prefer a different solution, we can change.
Assignee: nobody → cam
Status: NEW → ASSIGNED
Attachment #706720 - Flags: review?(longsonr)
Comment on attachment 706720 [details] [diff] [review] patch Please create reftests: a) outer svg is xml:space="preserve" and fo has no white-space styles b) outer svg is xml:space="preserve" and fo has white-space: "something != normal"
Attachment #706720 - Flags: review?(longsonr) → review+
I don't think you pushed the reftest files themselves!
Forgot to "hg add" them...
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: