Closed
Bug 572317
Opened 15 years ago
Closed 15 years ago
-moz-transform depends on the window width -- bad rounding
Categories
(Core :: Graphics, defect)
Core
Graphics
Tracking
()
RESOLVED
FIXED
People
(Reporter: protz, Assigned: roc)
References
()
Details
(Keywords: testcase)
Attachments
(2 files, 1 obsolete file)
|
783 bytes,
text/html
|
Details | |
|
5.01 KB,
patch
|
jrmuizel
:
review+
|
Details | Diff | Splinter Review |
Testcase here:
http://jonathan.protzenko.free.fr/bugtransform/testcase.html
Basically, I have two squares perfectly stacked.
___
| ^ |
|___|
___
| |
|___|
To the top one, I apply:
-moz-transform-origin: bottom left;
-moz-transform: rotate(-90deg) translate(-100px, 0);
The rotate gives:
___
| < |
|___|
___
| |
|___|
And finally, the translate gives:
___ ___
| < || |
|___||___|
(The < shows the orientation of the top cube).
The issue is that the final layout depends on the viewport's width. Try to resize the main window pixel by pixel, and you will see that the position of the left cube is off-by-one half of the time.
Google Chrome does not have this issue, and always renders it properly.
Tested in 3.7a5.
Comment 1•15 years ago
|
||
Hmm. So the issue appears when the left margin is nonintegral. I believe the issue is that when we paint we snap the non-transformed div to screen pixels but don't snap the transformed one (because snapping there makes no sense).
Chrome "doesn't have this issue" because it never allows non-integer margins, even if you explicitly specify one (which leads it to have other bugs in terms of layout, like "auto" margins not actually centering correctly). This testcase doesn't depend on the window width and shows the behavior clearly.
Over to graphics, since the layout here is in fact correct; the frame coordinates just happen to fall on non-integer pixel positions).
Updated•15 years ago
|
Component: Layout → Graphics
QA Contact: layout → thebes
| Assignee | ||
Comment 2•15 years ago
|
||
We should be snapping the transformed div, actually. gfxContext::UserToDevicePixelSnapped should be modified so that if rotations by multiples of 90 degrees don't prevent snapping.
| Assignee | ||
Comment 3•15 years ago
|
||
Like so
Assignee: nobody → roc
Attachment #451759 -
Flags: review?(jmuizelaar)
Comment 4•15 years ago
|
||
Comment on attachment 451759 [details] [diff] [review]
fix
>- // rectangle is no longer axis-aligned after transforming, so we can't snap
>- if (p1.x != p4.x ||
>- p2.x != p3.x ||
>- p1.y != p3.y ||
>- p2.y != p4.y)
>- return PR_FALSE;
>+ // Check that the rectangle is axis-aligned. For an axis-aligned rectangle,
>+ // two opposite corners define the entire rectangle. So check if
>+ // the axis-aligned rectangle with opposite corners p1 and p3
>+ // define an axis-aligned rectangle whose other corners are p2 and p4.
>+ if ((p2 == gfxPoint(p1.x, p3.y) && p4 == gfxPoint(p3.x, p1.y)) ||
>+ (p4 == gfxPoint(p1.x, p3.y) && p2 == gfxPoint(p3.x, p1.y))) {
>+ p1.Round();
>+ p3.Round();
>
Clever
Attachment #451759 -
Flags: review?(jmuizelaar) → review+
| Assignee | ||
Updated•15 years ago
|
Whiteboard: [needs landing]
| Assignee | ||
Updated•15 years ago
|
Whiteboard: [needs landing]
| Assignee | ||
Comment 5•15 years ago
|
||
Actually we can be even more clever and avoid computing p4.
Attachment #451759 -
Attachment is obsolete: true
Attachment #452212 -
Flags: review?(jmuizelaar)
Updated•15 years ago
|
Attachment #452212 -
Flags: review?(jmuizelaar) → review+
| Assignee | ||
Updated•15 years ago
|
Whiteboard: [needs landing]
| Assignee | ||
Comment 6•15 years ago
|
||
Status: NEW → RESOLVED
Closed: 15 years ago
Flags: in-testsuite+
OS: Linux → All
Hardware: x86 → All
Resolution: --- → FIXED
Whiteboard: [needs landing]
You need to log in
before you can comment on or make changes to this bug.
Description
•