Bug 221550 - A Pattern with an SVG image is not rendered correctly
Summary: A Pattern with an SVG image is not rendered correctly
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks: 219468
  Show dependency treegraph
 
Reported: 2021-02-08 06:45 PST by Said Abou-Hallawa
Modified: 2021-02-10 14:34 PST (History)
11 users (show)

See Also:


Attachments
Patch (9.19 KB, patch)
2021-02-08 06:51 PST, Said Abou-Hallawa
simon.fraser: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (9.99 KB, patch)
2021-02-08 12:26 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (9.22 KB, patch)
2021-02-08 13:28 PST, 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-02-08 06:45:54 PST
Before r269614, the pattern with SVG image was not rendered at all. After this revision the pattern is drawn as a black rectangle. The reason is with r269614 Pattern::createPlatformPattern() returns a null CGPatternRef if the NativeImage of the SVG is null. Before this change we were returning a non-null CGPatternRef but with an invalid image.

The test imported/blink/svg/canvas/canvas-draw-pattern-size.html did not catch this case before this change or after it, because the expected result page draws a pattern but with a different size. 

The fix of this bug is implement the method SVGImage::nativeImage(). Also we need to change the expected result imported/blink/svg/canvas/canvas-draw-pattern-size-expected.html to not use the pattern in its drawing.
Comment 1 Said Abou-Hallawa 2021-02-08 06:51:32 PST
Created attachment 419585 [details]
Patch
Comment 2 Said Abou-Hallawa 2021-02-08 12:26:08 PST
Created attachment 419611 [details]
Patch
Comment 3 Said Abou-Hallawa 2021-02-08 12:27:39 PST
(In reply to Said Abou-Hallawa from comment #2)
> Created attachment 419611 [details]
> Patch

I added this null check in SVGImage::nativeImage()

    if (!imageBuffer)
        return nullptr;
Comment 4 Said Abou-Hallawa 2021-02-08 13:28:50 PST
Created attachment 419621 [details]
Patch
Comment 5 EWS 2021-02-08 14:23:17 PST
Committed r272549: <https://commits.webkit.org/r272549>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 419621 [details].
Comment 6 Radar WebKit Bug Importer 2021-02-10 14:34:07 PST
<rdar://problem/74206675>