Last Comment Bug 706121 - moz-linear-gradient broken compared to Webkit / Opera (different calculation of gradient background-size when only one length is specified)
: moz-linear-gradient broken compared to Webkit / Opera (different calculation ...
Status: RESOLVED INVALID
:
Product: Core
Classification: Components
Component: Layout (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-29 08:07 PST by PurKat
Modified: 2011-11-30 18:45 PST (History)
9 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
testcase (963 bytes, text/html)
2011-11-29 17:51 PST, j.j.
no flags Details

Description PurKat 2011-11-29 08:07:21 PST
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
Comment 1 David Baron :dbaron: ⌚️UTC+2 (review requests must explain patch) 2011-11-29 16:34:16 PST
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.)
Comment 2 David Baron :dbaron: ⌚️UTC+2 (review requests must explain patch) 2011-11-29 16:37:11 PST
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.
Comment 3 David Baron :dbaron: ⌚️UTC+2 (review requests must explain patch) 2011-11-29 16:38:48 PST
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.
Comment 4 PurKat 2011-11-29 16:52:13 PST
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?
Comment 5 Tab Atkins Jr. 2011-11-29 16:53:55 PST
(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.
Comment 6 Lea Verou 2011-11-29 16:54:27 PST
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"
Comment 7 Lea Verou 2011-11-29 16:56:58 PST
(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.
Comment 8 Boris Zbarsky [:bz] 2011-11-29 17:22:48 PST
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!
Comment 9 PurKat 2011-11-29 17:30:16 PST
(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.
Comment 10 j.j. 2011-11-29 17:51:01 PST
Created attachment 577820 [details]
testcase
Comment 11 Jeff Walden [:Waldo] (remove +bmo to email) 2011-11-29 18:18:17 PST
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/
Comment 12 Tab Atkins Jr. 2011-11-29 18:20:13 PST
Goes to show how good my memory is.
Comment 13 Boris Zbarsky [:bz] 2011-11-29 18:24:20 PST
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.
Comment 14 PurKat 2011-11-30 02:39:55 PST
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

Note You need to log in before you can comment on or make changes to this bug.