Closed
Bug 594934
Opened 14 years ago
Closed 14 years ago
support calc() on background-position, background-size, -moz-transform-origin, and background-image gradient stop positions
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla2.0b7
Tracking | Status | |
---|---|---|
blocking2.0 | --- | betaN+ |
People
(Reporter: dbaron, Assigned: dbaron)
References
Details
(Keywords: css3)
Attachments
(2 files, 1 obsolete file)
22.71 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
41.49 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
We probably want to support calc() on support calc on background-position, background-size, -moz-transform-position, and background-image gradient stop positions. These things all use the same syntax, and don't currently store in in nsStyleCoord form.
This is work that I did not do in bug 363249 / bug 585715, and am not currently planning to do for Mozilla 2 / Firefox 4.
However, it occurs to me that the removal of min() and max() currently pending review in bug 363249 might make this much easier, and thus something I would want to do. (I think I did get a request for it.)
Assignee | ||
Updated•14 years ago
|
Summary: support calc on background-position, background-size, -moz-transform-position, and background-image gradient stop positions → support calc on background-position, background-size, -moz-transform-origin, and background-image gradient stop positions
Assignee | ||
Updated•14 years ago
|
Summary: support calc on background-position, background-size, -moz-transform-origin, and background-image gradient stop positions → support calc() on background-position, background-size, -moz-transform-origin, and background-image gradient stop positions
Assignee | ||
Comment 1•14 years ago
|
||
Since the one piece of concrete feedback I got about http://dbaron.org/log/20100905-calc regarding missing properties was lack of calc() on background-position, I should try get this in; it's pretty easy (I did it this afternoon along with a bunch of other things).
blocking2.0: --- → betaN+
Assignee | ||
Comment 2•14 years ago
|
||
I think this makes nsStyleBackground 12 bytes larger.
Assignee | ||
Comment 3•14 years ago
|
||
This has some interdependencies on bug 520234 that aren't worth eliminating.
Attachment #474984 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 4•14 years ago
|
||
Actually, I had a separate patch right on top of this fixing a bug that it introduced; no point keeping it separate. (I actually filed bug 596138 before noticing this.)
Attachment #474984 -
Attachment is obsolete: true
Attachment #474985 -
Flags: review?(bzbarsky)
Attachment #474984 -
Flags: review?(bzbarsky)
Comment 5•14 years ago
|
||
Comment on attachment 474983 [details] [diff] [review]
patch 1: change background-position and background-size storage a little
>+++ b/layout/base/nsCSSRendering.cpp
>+ScaleDimension(const nsStyleBackground::Size::Dimension& aDimension,
>+ case nsStyleBackground::Size::eLengthPercentage:
>+ return (double(aDimension.mPercent) * double(aAvailLength) +
Unit analysis failure here. This needs a divide by double(aLength), right?
r=me with that fixed.
Attachment #474983 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 6•14 years ago
|
||
(In reply to comment #5)
> Comment on attachment 474983 [details] [diff] [review]
> patch 1: change background-position and background-size storage a little
>
> >+++ b/layout/base/nsCSSRendering.cpp
> >+ScaleDimension(const nsStyleBackground::Size::Dimension& aDimension,
> >+ case nsStyleBackground::Size::eLengthPercentage:
> >+ return (double(aDimension.mPercent) * double(aAvailLength) +
>
> Unit analysis failure here. This needs a divide by double(aLength), right?
>
> r=me with that fixed.
It has one. I guess I should rewrap the lines to match the parentheses better, though.
Comment 7•14 years ago
|
||
Comment on attachment 474985 [details] [diff] [review]
patch 2: implement calc() for these
> ScaleDimension(const nsStyleBackground::Size::Dimension& aDimension,
>- return (double(aDimension.mPercent) * double(aAvailLength) +
>- double(aDimension.mLength)) / double(aLength);
>+ // negative values could result from calc()
>+ return NS_MAX(double(aDimension.mPercent) * double(aAvailLength) +
>+ double(aDimension.mLength),
>+ 0.0) / double(aLength);
So this actually fixes the bug the previous patch introduced....
Please follow a followup on the FIXMEs in ExtractComputedValue?
r=me
Attachment #474985 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 8•14 years ago
|
||
(In reply to comment #7)
> Please follow a followup on the FIXMEs in ExtractComputedValue?
They're already fixed in patch 2 in bug 520234. I'll add a test, though; I realize that wasn't tested.
Assignee | ||
Comment 9•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/ad02d75f80ab
http://hg.mozilla.org/mozilla-central/rev/983d21f8af4a
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b7
You need to log in
before you can comment on or make changes to this bug.
Description
•