Closed Bug 1547939 Opened 5 years ago Closed 5 years ago

Consider simplifying -moz-linear-gradient parsing


(Core :: CSS Parsing and Computation, defect)

Not set



Tracking Status
firefox68 --- fixed


(Reporter: emilio, Assigned: emilio)



(Keywords: dev-doc-complete, site-compat)


(1 file)

As far as I can tell, we need -moz-* linear gradients for compat. But most of the weirdness of them is actually parsing the weird position syntax.

All of the regressions from bug 1337655 are compatible with standard gradients, so I want to make -moz-linear-gradient just an alias for linear-gradient.

All the regressions from the other un-shipping bugs are not an issue with this,
and this lets us massively simplify the gradient code, if it sticks.

All of the regressions from bug 1337655 are compatible with standard gradients, so I want to make -moz-linear-gradient just an alias for linear-gradient.

Maybe I'm misunderstanding, but I don't think this is correct... Per bug 1183994 comment 13, we found Zimbra using a gradient like "-moz-linear-gradient(top,#FFFFFF, #4AA6F1)", which is not valid as a standard gradient. IIRC standard syntax requires a to keyword before the box-side keyword (top) in order to make it valid.

As a quick example: the first of these works (and is effectively what Zimbra uses), and the second does not (with -moz removed to trigger standard-gradient parsing):

  data:text/html,<div style="background:-moz-linear-gradient(top,teal,lime)">abc
  data:text/html,<div style="background:linear-gradient(top,teal,lime)">abc
Flags: needinfo?(emilio)

Yeah, I'm aware of it, and with this patch we do still render that correctly (I went through all those bugs, I promise!).

This patch roughly makes position parsing more webkit-like (webkit gradients do accept no to keyword), though if we see a to keyword we still "upgrade" it to a modern gradient, like -moz- gradients actually do.

What I want to get rid of is basically the extremely complex position parsing that allows both angles and position.

Flags: needinfo?(emilio)

Which reminds me I need to update the pref description in the patch.

Keywords: dev-doc-needed
Pushed by
Add a pref for a simpler -moz- gradient parsing. r=dholbert
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Regressions: 1521253
Regressions: 1484418
Regressions: 1548765

I see you marked this as dev-doc-needed - what docs updates on MDN do you think this needs?

Flags: needinfo?(emilio)

Wherever we describe the -moz-{linear, radial} gradient syntax, it needs to be updated to reflect the new syntax, which is a mix of the standard and the webkit-like syntax.

If you point me to it I'm happy to take a stab at it. If we don't document the prefixed syntax then no changes are needed.

Flags: needinfo?(emilio)
Depends on: 1557110

We have no documentation for the prefixed versions of these (that is, -moz-linear-gradient and such), so I don't believe we need to update documentation. This is, however, mentioned on Firefox 68 for developers.

Depends on: 1565981
Regressions: 1565981
You need to log in before you can comment on or make changes to this bug.