-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CSS Math Functions] Correctly serialize sin/cos/tan functions #15664
[CSS Math Functions] Correctly serialize sin/cos/tan functions #15664
Conversation
EWS run on previous version of this PR (hash ec758de) |
ec758de
to
935b154
Compare
EWS run on previous version of this PR (hash 935b154)
|
935b154
to
e477925
Compare
EWS run on previous version of this PR (hash e477925) |
@@ -132,6 +133,14 @@ float CalcExpressionOperation::evaluate(float maxValue) const | |||
case CalcOperator::Tan: { | |||
if (m_children.size() != 1) | |||
return std::numeric_limits<double>::quiet_NaN(); | |||
double x = std::fmod(m_children[0]->evaluate(maxValue), piDouble * 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should share this code, not write it out twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole file is duplicated unfortunately, we've had a bug where the hypot()
function was wrong in only one of the two files, so this is something I'd like to address. I have some ideas how to refactor to prevent duplication altogether, but I'd like to do it separately to catch potential regressions.
e477925
to
ccd42ec
Compare
EWS run on previous version of this PR (hash ccd42ec)
|
ccd42ec
to
7ca55ae
Compare
EWS run on current version of this PR (hash 7ca55ae) |
https://bugs.webkit.org/show_bug.cgi?id=259011 rdar://111947212 Reviewed by Darin Adler. There are 2 main changes: - We now always try to resolve top level sin/cos/tan functions, cos(0) will serialize as calc(1) instead of cos(0) for instance. This is consistent with how calc(cos(0)) is serialized. From the spec https://drafts.csswg.org/css-values-4/#calc-simplification: > If root is an operator node that’s not one of the calc-operator nodes, and all of its calculation children are numeric values with enough information to compute the operation root represents, return the result of running root’s operation using its children, expressed in the result’s canonical unit. - tan(90deg) & tan(-90deg) now return respectively calc(infinity) & calc(-infinity) * LayoutTests/imported/w3c/web-platform-tests/css/css-values/sin-cos-tan-serialize-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-values/sin-cos-tan-serialize.html: Update these tests from upstream WPT. * Source/WebCore/css/calc/CSSCalcOperationNode.cpp: (WebCore::CSSCalcOperationNode::evaluateOperator): * Source/WebCore/css/calc/CSSCalcOperationNode.h: * Source/WebCore/platform/calc/CalcExpressionOperation.cpp: (WebCore::CalcExpressionOperation::evaluate const): Canonical link: https://commits.webkit.org/265881@main
7ca55ae
to
15a8c32
Compare
Committed 265881@main (15a8c32): https://commits.webkit.org/265881@main Reviewed commits have been landed. Closing PR #15664 and removing active labels. |
15a8c32
7ca55ae
🧪 wpe-wk2🧪 ios-wk2🧪 api-mac🧪 mac-wk1🧪 gtk-wk2🧪 mac-wk2🧪 api-gtk🧪 mac-wk2-stress🛠 🧪 merge