Inline SVG with a viewBox attribute does not print

RESOLVED FIXED

Status

()

defect
RESOLVED FIXED
7 years ago
6 years ago

People

(Reporter: ghasemkiani, Assigned: jwatt)

Tracking

({regression})

17 Branch
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(firefox18 verified, firefox19 verified, firefox20 fixed)

Details

Attachments

(3 attachments)

Reporter

Description

7 years ago
Posted file test.zip
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20100101 Firefox/17.0
Build ID: 20121128204232

Steps to reproduce:

I used this HTML code:

<html>
	<head>
		<title>test</title>
	</head>
	<body>
		<p>test</p>
		<svg viewBox="0 0 30 30" width="3cm" height="3cm" style="background-color:yellow">
			<circle cx="10" cy="10" r="10" fill="red"/>
		</svg>
		<p>test</p>
	</body>
</html>


Actual results:

In Firefox 17.0.1, the file renders correctly (including coordinate space conversion according to the viewBox attribute), but the SVG does not print (and is not shown in print preview).
If the viewBox attribute is removed, the SVG appears in the print preview. Of course the coordinate system now assumes an ordinary DPI.


Expected results:

The SVG should appear in the printout as rendered on the normal browser page.

Comment 1

7 years ago
Posted file Reporter's testcase

Comment 2

7 years ago
Component: Untriaged → SVG
Product: Firefox → Core

Comment 3

7 years ago
The testcase shows various regressions. Old versions are able to print preview both tests but sometimes, yellow square is missing.
Reporter

Comment 4

7 years ago
(In reply to Loic from comment #3)
> The testcase shows various regressions. Old versions are able to print
> preview both tests but sometimes, yellow square is missing.

The background (yellow square) can be turned off by unchecking "Print Background (colors and images)" in the Page Setup dialog box.

Comment 5

7 years ago
True, I forgot that. :D
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 6

7 years ago
Regression window(m-c)
Good:
http://hg.mozilla.org/mozilla-central/rev/6dae57cd2f85
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Firefox/17.0 ID:20120720145842
Bad:
http://hg.mozilla.org/mozilla-central/rev/045c11dd41a6
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Firefox/17.0 ID:20120720205642
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=6dae57cd2f85&tochange=045c11dd41a6



Regression window(m-i)
Good:
http://hg.mozilla.org/integration/mozilla-inbound/rev/a746aaa32b22
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Firefox/17.0 ID:20120720114508
Bad:
http://hg.mozilla.org/integration/mozilla-inbound/rev/62f19ed60528
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Firefox/17.0 ID:20120720115241
Pushlog:
http://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=a746aaa32b22&tochange=62f19ed60528

Suspected: Bug 614732
Flags: in-testsuite?

Comment 7

7 years ago
I came across this same issue in Firefox 17.0.1; updated to nightly build (as of 02:30 GMT - 14 Dec. 2012) and confirmed the issue still existed. Issue did not exist in v16.x while testing.

I reproduced the issue by using an inline SVG with the viewBox attribute (where the SVG did not print at all) then removing the viewBox attribute (at which point the SVG did print properly).

Windows 8 x64
Assignee

Updated

7 years ago
OS: Windows XP → All
Hardware: x86 → All
Assignee

Comment 8

7 years ago
My fix for bug 813531 also fixed this. The fix is in the latest beta (Firefox 18 beta 5).
Status: NEW → RESOLVED
Closed: 7 years ago
Depends on: 813531
Resolution: --- → FIXED
Mozilla/5.0 (X11; Linux i686; rv:18.0) Gecko/20100101 Firefox/18.0

Confirming that this is fixed while using beta 6 on Windows 7 and Ubuntu 12.04.
The yellow background image is not displayed in print preview, but seems an old existing behavior (prior to Firefox 10).
Keywords: verifyme
QA Contact: virgil.dicu
Did you check Print Background colours and Images in the Page Setup dialogue? If this isn't checked (the default I think) then you won't see background images in the print preview.
The page is indeed printed with the yellow background, print preview however doesn't display that. Was comparing this to Opera's print preview.

I assume that Firefox just doesn't enable background colors by default in print preview. Are there any reasons behind that? This seems a bit strange at first.
print preview respects the Print Background colours and Images setting but printing doesn't? If so that sounds like a bug.
(In reply to Virgil Dicu [:virgil] [QA] from comment #11)
> I assume that Firefox just doesn't enable background colors by default in
> print preview. Are there any reasons behind that? This seems a bit strange
> at first.

It's to conserve ink, I think.  If you print a blog post that happens to have a photo (or just a solid color) as the <body> background image, chances are you don't want that background image in your printout -- you just care about the content.  We can't guess perfectly, of course, so we err on the side of wasting less ink.  (I'm pretty sure we change text-color, too, so e.g. white text on a dark-purple background will (by default) print black text, instead of printing a fully-white page.)

(In reply to Robert Longson from comment #12)
> print preview respects the Print Background colours and Images setting but
> printing doesn't? If so that sounds like a bug.

This is likely bug 464985. (Note that there's no dialog before Print Preview to let you tick e.g. "print background colors in this print-preview window" -- it just reads from a bundle of settings that were saved (or not saved, in this case) from a previous actual-print.)
(In reply to Daniel Holbert [:dholbert] from comment #13)
> (In reply to Virgil Dicu [:virgil] [QA] from comment #11)
> > I assume that Firefox just doesn't enable background colors by default in
> > print preview. Are there any reasons behind that? This seems a bit strange
> > at first.

(This is supposed to be default for print _and_ print-preview -- not sure why it's only affecting print-preview for you -- I suspect because you somehow got the "print bgcolors" pref turned on for one printer (and now can't revoke that, due to bug 464985), but your print preview is using the (default) settings associated with a different printer.  Or something like that.  In any case -- if you try a fresh profile, I suspect you'll get more consistent default behavior there.)
Given your explanations, Daniel, this works as expected (new profile):
-load testcase
-print preview--->no background colors
-page setup, select print with background colors and images
-print--->page printed with background colors
-print preview again--->background colors shown as expected

All on beta 18.
Retested on Firefox 19.0 beta 2
Mozilla/5.0 (X11; Linux i686; rv:19.0) Gecko/20100101 Firefox/19.0
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0
Mozilla/5.0 (Macintosh: Intel Mac OS X 10.7: rv:19.0) Gecko/20100101 Firefox/19.0)

> Given your explanations, Daniel, this works as expected (new profile):
> -load testcase
> -print preview--->no background colors
> -page setup, select print with background colors and images
> -print--->page printed with background colors
> -print preview again--->background colors shown as expected
mass remove verifyme requests greater than 4 months old
Keywords: verifyme
You need to log in before you can comment on or make changes to this bug.