Bug 230145 - Linear gradient sometimes is drawn incorrectly and sometimes hangs
Summary: Linear gradient sometimes is drawn incorrectly and sometimes hangs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-09-09 23:19 PDT by Said Abou-Hallawa
Modified: 2021-09-15 00:26 PDT (History)
6 users (show)

See Also:


Attachments
test case (737 bytes, image/svg+xml)
2021-09-09 23:19 PDT, Said Abou-Hallawa
no flags Details
Patch (6.21 KB, patch)
2021-09-09 23:26 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (10.81 KB, patch)
2021-09-12 22:31 PDT, Said Abou-Hallawa
simon.fraser: review+
Details | Formatted Diff | Diff
gradient-start-end-repeat (3.25 KB, image/svg+xml)
2021-09-12 22:33 PDT, Said Abou-Hallawa
no flags Details
gradient-start-end-reflect (3.25 KB, image/svg+xml)
2021-09-12 22:33 PDT, Said Abou-Hallawa
no flags Details
gradient-start-end-negative-repeat (3.30 KB, image/svg+xml)
2021-09-12 22:34 PDT, Said Abou-Hallawa
no flags Details
gradient-start-end-negative-reflect (3.30 KB, image/svg+xml)
2021-09-12 22:34 PDT, Said Abou-Hallawa
no flags Details
Patch (10.83 KB, patch)
2021-09-14 22:53 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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].