Bug 230073 - Implement round,mod,rem functions for calc
Summary: Implement round,mod,rem functions for calc
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nikos Mouchtaris
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-09-08 17:09 PDT by Nikos Mouchtaris
Modified: 2021-09-24 22:03 PDT (History)
10 users (show)

See Also:


Attachments
Patch (21.05 KB, patch)
2021-09-08 17:09 PDT, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (42.54 KB, patch)
2021-09-17 11:46 PDT, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (58.70 KB, patch)
2021-09-17 18:24 PDT, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff
Patch (66.72 KB, patch)
2021-09-21 16:55 PDT, Nikos Mouchtaris
simon.fraser: review+
Details | Formatted Diff | Diff
round/mod/rem functions (65.07 KB, patch)
2021-09-24 18:01 PDT, Nikos Mouchtaris
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikos Mouchtaris 2021-09-08 17:09:12 PDT
Implement round,mod,rem functions for calc
Comment 1 Nikos Mouchtaris 2021-09-08 17:09:26 PDT
Created attachment 437687 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2021-09-15 17:10:21 PDT
<rdar://problem/83174669>
Comment 3 Nikos Mouchtaris 2021-09-17 11:46:33 PDT
Created attachment 438495 [details]
Patch
Comment 4 EWS Watchlist 2021-09-17 11:47:28 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 5 Nikos Mouchtaris 2021-09-17 18:24:21 PDT
Created attachment 438539 [details]
Patch
Comment 6 Nikos Mouchtaris 2021-09-21 16:55:45 PDT
Created attachment 438888 [details]
Patch
Comment 7 Simon Fraser (smfr) 2021-09-22 15:33:45 PDT
Comment on attachment 438888 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=438888&action=review

> Source/WebCore/ChangeLog:6
> +        Reviewed by NOBODY (OOPS!).

Add blank line below here.

> Source/WebCore/css/calc/CSSCalcOperationNode.cpp:451
> +        LOG_WITH_STREAM(Calc, stream << "Failed to create round node because unable to determine category from " << prettyPrintNodes(values));

round -> step

> Source/WebCore/platform/calc/CalcExpressionOperation.cpp:37
> +    double lowerB = std::floor(a / std::abs(b))*std::abs(b);
> +    double upperB = lowerB + std::abs(b);

Maybe avoid calling std::abs(b) threee times. Also space around *

> Source/WebCore/platform/calc/CalcExpressionOperation.cpp:145
> +        return std::numeric_limits<double>::quiet_NaN();

Should this ASSERT_NOT_REACHED?

> Source/WebCore/platform/calc/CalcExpressionOperation.cpp:151
> +        auto upperB = ret.second;
> +        return upperB;

No need for upperB

> Source/WebCore/platform/calc/CalcExpressionOperation.cpp:157
> +        auto lowerB = ret.first;

Ditto

> Source/WebCore/platform/calc/CalcExpressionOperation.cpp:163
> +        auto ret = getNearestMultiples(m_children[0]->evaluate(maxValue), m_children[1]->evaluate(maxValue));

Put m_children[0]->evaluate(maxValue) etc into local variables?

> Source/WebCore/platform/calc/CalcExpressionOperation.cpp:166
> +        return std::abs(upperB-m_children[0]->evaluate(maxValue)) <= std::abs(m_children[1]->evaluate(maxValue)) / 2 ? upperB : lowerB;

space around -
Comment 8 Nikos Mouchtaris 2021-09-24 18:01:43 PDT
Created attachment 439224 [details]
round/mod/rem functions
Comment 9 EWS 2021-09-24 22:03:15 PDT
Committed r283073 (242131@main): <https://commits.webkit.org/242131@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 439224 [details].