Open Bug 683707 Opened 13 years ago Updated 2 years ago

-moz-transform: scaleX/Y(-1) distorts image

Categories

(Core :: Layout, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: shorlander, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(4 files, 1 obsolete file)

We use -moz-transform: scaleX(-1) to flip images to avoid duplication and for RTL mode. In some cases it distorts the image making it blurry/indistinct. For example the the tab-overflow arrows (bug 580194)
Maybe this is related to some of the pixel-snapping we do being disabled when there's a transform?  If so, should we distinguish between some types of transforms that should disable pixel snapping and some that shouldn't?  That said, doing so would likely make animations of transforms look bad in a bunch of cases.
gfxMatrix::HasNonTranslationOrFlip needs to be extended to support xx==-1.0. Cab someone roll a patch for that? My tree's not in a good state.

If that doesn't fix it, we probably have some places that check gfxMatrix::HasNonIntegerTranslation that should be checking gfxMatrix::HasNonTranslationOrFlip.
Not sure if this actually fixes the problem, is there a test case to check?
Attachment #557394 - Flags: review?(roc)
Comment on attachment 557394 [details] [diff] [review]
Detect X flips in HasNonTranslationOrFlip

Review of attachment 557394 [details] [diff] [review]:
-----------------------------------------------------------------

I don't know if this will fix the bug, but we should definitely do this.

It might possibly fix the bug by changing this path:
http://mxr.mozilla.org/mozilla-central/source/layout/base/FrameLayerBuilder.cpp#1703
Attachment #557394 - Flags: review?(roc) → review+
(In reply to Matt Woodrow (:mattwoodrow) from comment #3)
> Created attachment 557394 [details] [diff] [review]
> Detect X flips in HasNonTranslationOrFlip
> 
> Not sure if this actually fixes the problem, is there a test case to check?

Doesn't appear to fix the issue.
Can you reproduce this in a standalone html testcase?

It'd be great to be able to test this locally.
(In reply to Matt Woodrow (:mattwoodrow) from comment #6)
> Can you reproduce this in a standalone html testcase?
> 
> It'd be great to be able to test this locally.

Yes, let me try and reproduce in HTML.
(In reply to Stephen Horlander from comment #7)
> (In reply to Matt Woodrow (:mattwoodrow) from comment #6)
> > Can you reproduce this in a standalone html testcase?
> > 
> > It'd be great to be able to test this locally.
> 
> Yes, let me try and reproduce in HTML.

So I managed to reproduce it here: http://people.mozilla.com/~shorlander/scale-test/scalex-test.html

Something I noticed is that if I set a width/height on the container then it doesn't blur the image. This works no matter what dimensions I set.
(In reply to Stephen Horlander from comment #8)
> Something I noticed is that if I set a width/height on the container then it
> doesn't blur the image. This works no matter what dimensions I set.

Even if you set fractional pixel widths (try 50.1px, 50.2px, etc...)?
(In reply to David Baron [:dbaron] from comment #9)
> (In reply to Stephen Horlander from comment #8)
> > Something I noticed is that if I set a width/height on the container then it
> > doesn't blur the image. This works no matter what dimensions I set.
> 
> Even if you set fractional pixel widths (try 50.1px, 50.2px, etc...)?

Ah, yes setting fractional widths makes it fuzzy.
I was able to work around this issue by adding:

-moz-transform: scale(-1, 1);
image-rendering: -moz-crisp-edges;

See: https://developer.mozilla.org/en/CSS/image-rendering
Blocks: 996568
So the testcase works for me on both OS X and Windows, but the tab bar overflow arrows are blurry and wrong again on Windows (see bug 996568).

Matt, is there any chance you'll have time to look into what's going on here soon?
Flags: needinfo?(matt.woodrow)
Keywords: testcase
Whoops, didn't mean to set this after all, seeing as the testcase is fixed but I'm still seeing a 'real' issue...
Keywords: testcase
Attached file 683707_testcase_2.htm (obsolete) —
(In reply to :Gijs Kruitbosch from comment #12)
> So the testcase works for me on both OS X and Windows ...

The testcase in comment 8 was fixed in this range...
Last good revision: f7c89de3ab43 (2012-09-16)
First bad revision: 3f0587ce1774 (2012-09-17)
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=f7c89de3ab43&tochange=3f0587ce1774

... but it broke scaleY in the process, see attachment.
Attached file 683707_testcase_2.htm
Wrong dates, sorry.
Attachment #8408137 - Attachment is obsolete: true
Flags: firefox-backlog?
Flags: firefox-backlog? → firefox-backlog-
Flags: needinfo?(matt.woodrow)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: