If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

unitless CSS lengths in SVG should default to px

RESOLVED WONTFIX

Status

()

Core
SVG
RESOLVED WONTFIX
13 years ago
13 years ago

People

(Reporter: Andrew Douglas, Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050313 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050313 Firefox/1.0+

The font-size length isn't defaulting to user units. Unitless is always in user
units which equals px when there's no transform.

Reproducible: Always

Steps to Reproduce:
see test case.

Actual Results:  
"hello" and "world" text is rendered at different sizes

Expected Results:  
"hello" and "world" text should be the same size
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Reporter)

Comment 1

13 years ago
Created attachment 177386 [details]
test case for defaulting to the user units

Test case uses viewbox to make it easier to see, but it fails without viewbox
too.

Comment 2

13 years ago
(In reply to comment #0)
> The font-size length isn't defaulting to user units. Unitless is always in user
> units which equals px when there's no transform.

I introduced you in error by being a little too terse. Unitless is equal to px, period. When there are no 
transform it's equivalent to the parent's notion of px. See http://www.w3.org/TR/SVG11/
coords.html#Units and sorry for the confusion.

Comment 3

13 years ago
(In reply to comment #1)
> Created an attachment (id=177386) [edit]
> test case for defaulting to the user units
> 
> Test case uses viewbox to make it easier to see, but it fails without viewbox
> too.

The problem is that CSS explicitly forbids unitless numbers, so the fontsize
that you get is unscaled.  If you want to have a unitless font size, you can
specify it using an attribute.  So, insted of:
    <text style="fill: #000000; text-anchor:start; font-size: 0.8; font-family:
sans; font-style: normal; font-weight: normal" x="13" y="13">world</text>
you would use:
    <text style="fill: #000000; text-anchor:start; font-family: sans;
font-style: normal; font-weight: normal" font-size="0.8" x="13" y="13">world</text>

As far as I understand, this is an outstanding inconsistency between the SVG and
the CSS specifications.  CSS explicitly forbids unitless values, and SVG defines
 the behaviour of the unitless value.  We compromised by leaving the CSS parser
alone, but allowing the attribute to be unitless.  For more discussion on this,
see bug#234789.

 
(Reporter)

Comment 4

13 years ago
Wow.. okay. So that being said: this test case was a snippet from an export from
Dia. Which, apparently, is perfectly valid SVG. I think I'll have a hard time
convincing them to change their export so that moz can handle it.. but hey.. I
guess it's worth a try since this doesn't appear to be going anywhere. I'm going
to go ahead and mark this "wontfix" then to save everyone the trouble.. If
that's not okay, I apologize.

Thanks!
-Andrew
Status: NEW → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → WONTFIX
*** Bug 292491 has been marked as a duplicate of this bug. ***
Summary: unspecified unit for font-size length should default to px → unitless CSS lengths in SVG should default to px

Comment 6

13 years ago
OK. From the answer I received also from the Bug 292491, I understand your/their
point of view.

Reading these explanations, as a "purist", I now would tend to think your
reasonning is acceptable and that the choice of the Firefox developers is the
good one.

I just wonder how many documents will be broken by this choice.
My SVG was created in 2003 using Illustrator. This is not a trivial software.
I suppose there are a bunch of SVG files out there that are perfectly valid svg
files but won't display in Firefox. 

I am not for hacks in general but well, writting a hack so that Firefox respect
the SVG spec when SVG is used alone would make sense.

It is just a matter a marketing. 
First the SVG of my testcase is a perfectly valid SVG so it will be difficult
for Mozilla to explain that their stantard compliant browser reject a valid SVG
picture (without entering the kind of explanation you gave me but that not
everybody can understand).

Second there are already a number of hacks in Firefox to accomodate the bad
coding behaviour of many webmaster. If it was not the case, Firefox would not
display properly a quater of the current world, wide, web... If Firefox is
accepting hacks for marketing purpose in order to display non-validating html,
is that so difficult to accept an hack to display correctly perfectly validating
and conformant SVG ?

Just a thought, I am not a specialist and I will be happy with whatever the
Firefox SVG team shall decide.

Thaks to the Firefox SVG team for their wonderfull job. This native SVG support
was long awaited, for sure !
You need to log in before you can comment on or make changes to this bug.