Closed Bug 706121 Opened 13 years ago Closed 13 years ago

moz-linear-gradient broken compared to Webkit / Opera (different calculation of gradient background-size when only one length is specified)

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: purkat, Unassigned)

Details

Attachments

(1 file)

963 bytes, text/html
Details
User Agent: Mozilla/5.0 (Windows NT 6.1; rv:11.0a1) Gecko/20111128 Firefox/11.0a1
Build ID: 20111128031052

Steps to reproduce:

Viewed demo of CSS gradient patterns at http://css3pie.com/demos/gradient-patterns/


Actual results:

Firefox 11.0a did not display correctly. See http://i.imgur.com/ZOptn.png


Expected results:

The CSS demo should show stripes as per Chrome: http://i.imgur.com/mrpLA.png
Component: General → Layout
Product: Firefox → Core
QA Contact: general → layout
I think this is because Chrome hasn't updated to the latest spec draft for background-size, which says:

The first value gives the width of the corresponding image, the second value its height. If only one value is given the second is assumed to be ‘auto’. 

I think the older draft treated '50px' as '50px 50px'; now it's '50px auto'.  (I'm not sure why that change was made, though.)
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
Actually, sorry, it's not that the repetition rules changed.  It's that the rules for how gradients were treated in background-size (since they don't have an intrinsic ratio or intrinsic dimensions) changed.
Though that's not it either.  Maybe an old draft of gradients said they were implicitly square and now it says that have no intrinsic aspect ratio?

Waldo probably knows.
So Chrome 17 and Opera 12 have got it wrong but Fx has got it right? Seems unlikely.

Should this remain RESOLVED > INVALID if it is not certain what is happening?
(In reply to David Baron [:dbaron] from comment #3)
> Though that's not it either.  Maybe an old draft of gradients said they were
> implicitly square and now it says that have no intrinsic aspect ratio?
> 
> Waldo probably knows.

Well, I know that part's not true, at least.  Gradients have always had no aspect ratio.
The spec seems a bit unclear to me as to whether gradients have an intrinsic aspect ratio, although it seems they inherit the intrinsic aspect ratio of the background sizing area. I CCed Tab, hopefully he can clear that up for us, or if it's a spec bug, work on fixing it.

Also, the title should be changed to something more descriptive. I'd suggest something like 
"Incorrect(?) calculation of gradient background-size when only one length is specified"
or
"CSS gradients do not maintain their intrinsic aspect ratio when background-size is set to one value"
(In reply to PurKat from comment #4)
> So Chrome 17 and Opera 12 have got it wrong but Fx has got it right? Seems
> unlikely.

That was uncalled for. I've seen many CSS issues where only one engine gets it right, and yes, sometimes that one engine is Gecko.
Reopening pending definitively sorting out what's up.

> So Chrome 17 and Opera 12 have got it wrong but Fx has got it right? Seems unlikely.

Happens all the time, especially with specs that aren't finalized.  It just takes one spec change and a later implementation by someone for that to be the case.  Welcome to the web!
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: INVALID → ---
Summary: moz-linear-gradient broken compared to Webkit / Opera → moz-linear-gradient broken compared to Webkit / Opera (different calculation of gradient background-size when only one length is specified)
OS: Windows 7 → All
Hardware: x86 → All
Version: 11 Branch → Trunk
(In reply to Boris Zbarsky (:bz) from comment #8)

Thanks, Boris. Makes sense. I just assumed majority rule! Silly newbie. :)


(In reply to Lea Verou from comment #7)
> That was uncalled for. 

I think your response is "uncalled for". I asked an honest and civil question. No need to be so aggressive about it. We are not all experts and clearly David Baron was not certain what is happening. I was just trying to understand why my ticket was RESOLVED > INVALID.
Attached file testcase
This is precisely that gradients used to -- wrongly -- inherit the intrinsic ratio of the background positioning area.  I called out the old gradient behavior as different in bug 609714 comment 25, discussed these semantics with Tab in #whatwg and concluded that the current behavior is the desired one[0] (search for "jwalden" and "TabAtkins" for the relevant discussion), called out this change in the first paragraph of bug 609714 comment 26, documented it on MDN[1] as noted in bug 609714 comment 43 (specifically calling out that specifying a single length, rather than two, should be avoided due to current browsers being inconsistent), and noted it in a blog post[2] mentioned in bug 609714 comment 45.  Gecko is correct here unless specs change.

I'd also note that this is the first bug, deriving from the web and not from Mozilla code, to be filed on this change by someone not intricately involved in this change.  There's bug 692612, which I was aware of when bug 609714 originally landed but which I didn't take the time to file at the time, which dholbert (one of the change's reviewers) filed.  But other than that bug and this one, I can't think of any other bugs filed as a result of this change.

0. http://krijnhoetmer.nl/irc-logs/whatwg/20110524
1. https://developer.mozilla.org/en/CSS/background-size
2. http://whereswalden.com/2011/10/21/properly-resizing-vector-image-backgrounds/
Goes to show how good my memory is.
OK, so comment 2 was actually it.  ;)

PurKat, thanks for filing this.  Sorry about all the hassle, especially with the mutating specs...  Good thing this stuff is all vendor-prefixed so far.
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → INVALID
Boris, thank you. And thanks everyone else. Glad that I could help just a little. 

Now Webkit and Opera need to get with the times!! :p
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: