Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upcalc() doesn't support dividing an expression #15192
Comments
|
Division is implemented as 1 / multiplication, which we probably shouldn't do. |
|
Do we want to keep enum CalcNode {
Value(CalcValueNode),
BinOp(CalcValueNode, BinOp, CalcValueNode),
}
enum BinOp {
Add, Mul, Div
} |
|
@upsuper https://drafts.csswg.org/css-values/#calc-syntax says |
|
Seems like the spec is wrong on this, both Firefox and WebKit don't mind the addition. |
|
Yeah, dbaron is right that we should support it, especially given that Gecko already supports it, and CSSWG is going to expand that to support even more powerful expression. |
|
The draft has been updated with an extended syntax to support different kinds of expressions. Taking a look at this. |
|
Blocked on #16728. |
|
#16728 seems to fix this. |
style: Rewrite calc to be cleaner and support arbitrary expressions. This improves Servo's calc support compliant with[1], and makes it cleaner and more straight-forward. (also fixes #15192) [1]: w3c/csswg-drafts#1241 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16728) <!-- Reviewable:end -->
style: Rewrite calc to be cleaner and support arbitrary expressions. This improves Servo's calc support compliant with[1], and makes it cleaner and more straight-forward. (also fixes #15192) [1]: w3c/csswg-drafts#1241 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16728) <!-- Reviewable:end -->
style: Rewrite calc to be cleaner and support arbitrary expressions. This improves Servo's calc support compliant with[1], and makes it cleaner and more straight-forward. (also fixes #15192) [1]: w3c/csswg-drafts#1241 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16728) <!-- Reviewable:end -->
calc(50px / 2)works, butcalc(50px / (1 + 1))doesn't work.