Closed Bug 364638 Opened 18 years ago Closed 5 years ago

CSS lengths less than 1/120 px treated as zero

Categories

(Core :: SVG, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1523343

People

(Reporter: x00000000, Unassigned)

References

Details

Attachments

(2 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.6) Gecko/20060814 SeaMonkey/1.0.4
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a2pre) Gecko/20061221 Minefield/3.0a2pre

CSS lengths less than ~ .035714286px (~ 1/28 px) seem to be treated as zero
(the exact limit may be system dependent). This is no problem in typical HTML
applications, but a major limitation in SVG, where px refer to user units.

There is no such limitiation when using attributes instead of CSS.


Reproducible: Always

Steps to Reproduce:
1. Load the testcase

Actual Results:  
The left hand side boxes have no diagonal stroke.


Expected Results:  
All 4 boxes should have a diagonal stroke. Its width is .035714285px for the
upper left box and .035714286px for the upper right box. The lower boxes have
a stroke width of .01px, which is set with CSS for the lower left box and with
an XML attribute for the lower right box.
Attached image testcase (obsolete) —
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
I think this is covered here:
http://wiki.mozilla.org/Mozilla2:Units#Twips_per_CSS_pixel_must_be_an_integer.2C_so_we_unnecessarily_restrict_screen_DPI_values

which as far as I can tell makes this a duplicate of bug 177805 (or at least blocked by it).
A fix for bug 177805 will most likely fix the testcase but not the underlying
problem. Haven't read the whole bug, but the first comments suggest that the
layout units will just be somewhat smaller than now. For use in SVG, there
shouldn't be any conversion to layout units at all before all transformations
are complete.
Sorry, haven't even read the original report of bug 177805 thoroughly enough.

> 3) Scale these units to device units inside GFX. Do not perform any device unit
> scaling outside GFX.

might mean that this bug will be fixed.
Attached image another testcase
Large CSS lengths (> 2**32 / 28) do not work either.

There should be 6 black squares (produced with short strokes).
Upper row uses XML attributes, lower row CSS.
Stroke widths are (left to right) 1e9, 1 and 1e-9 user units (written in
non-scientific notation because of bug 302971).

And ignore my comment #4. The cited text talks about /device/ units, but the
problem is caused by using the /layout/ units.
From bug 177805 comment #146:

> This isn't going to fix that bug.  The style system stores all lengths in app
> units, and this patch doesn't change that; it just changes what exactly app
> units refer to.
The XML attribute "stroke-width" stops to work if I add a "px" to the value.
Other attributes like "font-size" never work if the range is exceeded (with
or without explicit "px").

I think the problem is here:
http://lxr.mozilla.org/seamonkey/source/layout/style/nsRuleNode.cpp#268

SVG properties need their own SetCoord(), converting units to eStyleUnit_Factor
instead of eStyleUnit_Coord.

(I may be wrong; I just poked around in the code and do not really understand
it.)
With bug 177805 fixed, the new limit is 1/120 px (if CSS pixel == device pixel).
Summary: CSS lengths less than 1/28 px treated as zero → CSS lengths less than 1/120 px treated as zero
Attachment #249385 - Attachment is obsolete: true
Assignee: general → nobody
QA Contact: ian → general
As a submitter of a duplicate (bug 886309), I wanted to indicate that I consider this bug to be significant.

I'm a mathematician, and would prefer to code the SVG in natural coordinates. So, for a drawing in the unit circle, it would be nice to use coordinates where x and y are less than one in absolute value. Unfortunately, this causes stroke-widths to go below the 1/120px limit. See the attachment to bug 886309.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: