Bug 221550

Summary: A Pattern with an SVG image is not rendered correctly
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: ImagesAssignee: Said Abou-Hallawa <sabouhallawa>
Severity: Normal CC: dino, ews-watchlist, fmalita, gyuyoung.kim, pdr, schenney, sergio, simon.fraser, thorton, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=218427
Bug Depends on:    
Bug Blocks: 219468    
Description Flags
simon.fraser: review+, ews-feeder: commit-queue-
Patch none

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]
Comment 2 Said Abou-Hallawa 2021-02-08 12:26:08 PST
Created attachment 419611 [details]
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]
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