Bug 230145

Summary: Linear gradient sometimes is drawn incorrectly and sometimes hangs
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: SVGAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: sabouhallawa, sam, simon.fraser, thorton, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
test case
none
Patch
none
Patch
simon.fraser: review+
gradient-start-end-repeat
none
gradient-start-end-reflect
none
gradient-start-end-negative-repeat
none
gradient-start-end-negative-reflect
none
Patch none

Description Said Abou-Hallawa 2021-09-09 23:19:46 PDT
Created attachment 437839 [details]
test case

Open the attached test case.

The linear gradient is not displayed correctly because the start point is greater the end point. The gradient has to be flipped in this case.
Comment 1 Said Abou-Hallawa 2021-09-09 23:22:29 PDT
<rdar://82428383>
Comment 2 Said Abou-Hallawa 2021-09-09 23:26:44 PDT
Created attachment 437840 [details]
Patch
Comment 3 Said Abou-Hallawa 2021-09-12 22:31:57 PDT
Created attachment 438012 [details]
Patch
Comment 4 Said Abou-Hallawa 2021-09-12 22:33:17 PDT
Created attachment 438013 [details]
gradient-start-end-repeat
Comment 5 Said Abou-Hallawa 2021-09-12 22:33:39 PDT
Created attachment 438014 [details]
gradient-start-end-reflect
Comment 6 Said Abou-Hallawa 2021-09-12 22:34:08 PDT
Created attachment 438015 [details]
gradient-start-end-negative-repeat
Comment 7 Said Abou-Hallawa 2021-09-12 22:34:33 PDT
Created attachment 438016 [details]
gradient-start-end-negative-reflect
Comment 8 Said Abou-Hallawa 2021-09-12 22:41:34 PDT
Some of the gradients in the attached test cases are not drawn correctly. And If the comments are removed from them, they will hang. The attached patch fixes the correctness and the hang.
Comment 9 Simon Fraser (smfr) 2021-09-14 13:05:27 PDT
Comment on attachment 438012 [details]
Patch

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

> Source/WebCore/platform/graphics/cg/GradientCG.cpp:154
> +                    return CGRectGetMaxX(boundingBox) <= std::min(start, end);

For symmetry I would write this as `return std::min(start, end) > CGRectGetMaxX(boundingBox)`
Comment 10 Said Abou-Hallawa 2021-09-14 22:53:25 PDT
Created attachment 438214 [details]
Patch
Comment 11 EWS 2021-09-15 00:26:26 PDT
Committed r282443 (241696@main): <https://commits.webkit.org/241696@main>

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