Bug 238401

Summary: Clamp degenerate calc() values for <angle>
Product: WebKit Reporter: Nikos Mouchtaris <nmouchtaris>
Component: New BugsAssignee: Nikos Mouchtaris <nmouchtaris>
Status: RESOLVED FIXED    
Severity: Normal CC: esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, macpherson, menard, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
simon.fraser: review+
Patch none

Description Nikos Mouchtaris 2022-03-25 17:54:05 PDT
Clamp degenerate calc() values for <angle>
Comment 1 Nikos Mouchtaris 2022-03-25 22:49:31 PDT
Created attachment 455827 [details]
Patch
Comment 2 Simon Fraser (smfr) 2022-03-28 15:17:46 PDT
Comment on attachment 455827 [details]
Patch

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

> Source/WebCore/ChangeLog:8
> +        Clamp nan, infinity and -infinity to zero for <angle>.

Spec (or issue) link here please.

> Source/WebCore/css/calc/CSSCalcValue.cpp:329
> +    if (primitiveType() == CSSUnitType::CSS_DEG && (isnan(value) || isinf(value)))
> +        return 0;

Are we always CSS_DEG here because of canonicalization, or can we end up here with CSS_RAD, CSS_GRAD etc?
Comment 3 Nikos Mouchtaris 2022-03-28 15:20:25 PDT
Created attachment 455962 [details]
Patch
Comment 4 Nikos Mouchtaris 2022-03-28 15:21:20 PDT
(In reply to Simon Fraser (smfr) from comment #2)
> Comment on attachment 455827 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=455827&action=review
> 
> > Source/WebCore/ChangeLog:8
> > +        Clamp nan, infinity and -infinity to zero for <angle>.
> 
> Spec (or issue) link here please.
Added GitHub issue link.
> 
> > Source/WebCore/css/calc/CSSCalcValue.cpp:329
> > +    if (primitiveType() == CSSUnitType::CSS_DEG && (isnan(value) || isinf(value)))
> > +        return 0;
> 
> Are we always CSS_DEG here because of canonicalization, or can we end up
> here with CSS_RAD, CSS_GRAD etc?
Yes it will always be CSS_DEG due to canonicalization. Test covers this.
Comment 5 EWS 2022-03-28 18:17:42 PDT
Committed r292018 (248962@main): <https://commits.webkit.org/248962@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 455962 [details].
Comment 6 Radar WebKit Bug Importer 2022-03-28 18:18:15 PDT
<rdar://problem/90957174>