haikuwebkit/LayoutTests/fast/css/background-svg-image-loadin...

27 lines
877 B
HTML
Raw Permalink Normal View History

The layout of SVGImage should force the layout for its clients https://bugs.webkit.org/show_bug.cgi?id=221253 <rdar://problem/74138641> Reviewed by Simon Fraser. Source/WebCore: Unlike the bitmap image, the intrinsic size of SVGImage can only be known after running its layout. Because SVGImage can be used by multiple clients, CachedImage maintains an SVGImageCache which maps a client to an SVGImageForContainer. SVGImageForContainer is just a wrapper of SVGImage with the intrinsic size of the client. Because we may set an entry for the renderer in SVGImageCache early before running a layout for SVGImage and because the renderer intrinsic size depends on the intrinsic size of SVGImage, SVGImageForContainer may have an empty intrinsic size. So basically it is a race condition: knowing the intrinsic size of the SVGImage client depends on the intrinsic size of SVGImage itself. And the intrinsic size of SVGImageForContainer depends on the intrinsic size of the client. This may lead to not rendering the clients because their sizes are empty. To fix this issue we need to force calculateBackgroundImageGeometry() once we finish the layout of the SVGImage which happens after receiving all its data and calling RenderBox::imageChanged(). Test: fast/css/background-svg-image-loading.html * loader/cache/CachedImage.cpp: (WebCore::CachedImage::finishLoading): * rendering/RenderBox.cpp: (WebCore::RenderBox::repaintLayerRectsForImage): LayoutTests: * fast/css/background-svg-image-loading-expected.html: Added. * fast/css/background-svg-image-loading.html: Added. Canonical link: https://commits.webkit.org/234765@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-02 23:22:20 +00:00
<style>
.container {
zoom: 50%;
The layout of SVGImage should force the layout for its clients https://bugs.webkit.org/show_bug.cgi?id=221253 <rdar://problem/74138641> Reviewed by Simon Fraser. Source/WebCore: Unlike the bitmap image, the intrinsic size of SVGImage can only be known after running its layout. Because SVGImage can be used by multiple clients, CachedImage maintains an SVGImageCache which maps a client to an SVGImageForContainer. SVGImageForContainer is just a wrapper of SVGImage with the intrinsic size of the client. Because we may set an entry for the renderer in SVGImageCache early before running a layout for SVGImage and because the renderer intrinsic size depends on the intrinsic size of SVGImage, SVGImageForContainer may have an empty intrinsic size. So basically it is a race condition: knowing the intrinsic size of the SVGImage client depends on the intrinsic size of SVGImage itself. And the intrinsic size of SVGImageForContainer depends on the intrinsic size of the client. This may lead to not rendering the clients because their sizes are empty. To fix this issue we need to force calculateBackgroundImageGeometry() once we finish the layout of the SVGImage which happens after receiving all its data and calling RenderBox::imageChanged(). Test: fast/css/background-svg-image-loading.html * loader/cache/CachedImage.cpp: (WebCore::CachedImage::finishLoading): * rendering/RenderBox.cpp: (WebCore::RenderBox::repaintLayerRectsForImage): LayoutTests: * fast/css/background-svg-image-loading-expected.html: Added. * fast/css/background-svg-image-loading.html: Added. Canonical link: https://commits.webkit.org/234765@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-02 23:22:20 +00:00
width: 900px;
}
.line {
background-color: green;
font-size: 32px;
padding-left: 5px;
The layout of SVGImage should force the layout for its clients https://bugs.webkit.org/show_bug.cgi?id=221253 <rdar://problem/74138641> Reviewed by Simon Fraser. Source/WebCore: Unlike the bitmap image, the intrinsic size of SVGImage can only be known after running its layout. Because SVGImage can be used by multiple clients, CachedImage maintains an SVGImageCache which maps a client to an SVGImageForContainer. SVGImageForContainer is just a wrapper of SVGImage with the intrinsic size of the client. Because we may set an entry for the renderer in SVGImageCache early before running a layout for SVGImage and because the renderer intrinsic size depends on the intrinsic size of SVGImage, SVGImageForContainer may have an empty intrinsic size. So basically it is a race condition: knowing the intrinsic size of the SVGImage client depends on the intrinsic size of SVGImage itself. And the intrinsic size of SVGImageForContainer depends on the intrinsic size of the client. This may lead to not rendering the clients because their sizes are empty. To fix this issue we need to force calculateBackgroundImageGeometry() once we finish the layout of the SVGImage which happens after receiving all its data and calling RenderBox::imageChanged(). Test: fast/css/background-svg-image-loading.html * loader/cache/CachedImage.cpp: (WebCore::CachedImage::finishLoading): * rendering/RenderBox.cpp: (WebCore::RenderBox::repaintLayerRectsForImage): LayoutTests: * fast/css/background-svg-image-loading-expected.html: Added. * fast/css/background-svg-image-loading.html: Added. Canonical link: https://commits.webkit.org/234765@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-02 23:22:20 +00:00
}
</style>
<body>
<p>PASS when all the lines below have visible green background.<p>
The layout of SVGImage should force the layout for its clients https://bugs.webkit.org/show_bug.cgi?id=221253 <rdar://problem/74138641> Reviewed by Simon Fraser. Source/WebCore: Unlike the bitmap image, the intrinsic size of SVGImage can only be known after running its layout. Because SVGImage can be used by multiple clients, CachedImage maintains an SVGImageCache which maps a client to an SVGImageForContainer. SVGImageForContainer is just a wrapper of SVGImage with the intrinsic size of the client. Because we may set an entry for the renderer in SVGImageCache early before running a layout for SVGImage and because the renderer intrinsic size depends on the intrinsic size of SVGImage, SVGImageForContainer may have an empty intrinsic size. So basically it is a race condition: knowing the intrinsic size of the SVGImage client depends on the intrinsic size of SVGImage itself. And the intrinsic size of SVGImageForContainer depends on the intrinsic size of the client. This may lead to not rendering the clients because their sizes are empty. To fix this issue we need to force calculateBackgroundImageGeometry() once we finish the layout of the SVGImage which happens after receiving all its data and calling RenderBox::imageChanged(). Test: fast/css/background-svg-image-loading.html * loader/cache/CachedImage.cpp: (WebCore::CachedImage::finishLoading): * rendering/RenderBox.cpp: (WebCore::RenderBox::repaintLayerRectsForImage): LayoutTests: * fast/css/background-svg-image-loading-expected.html: Added. * fast/css/background-svg-image-loading.html: Added. Canonical link: https://commits.webkit.org/234765@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-02 23:22:20 +00:00
<div class="container">
<div class="line" style="background-size: 24px;">This line should have a visible green background.</div>
</div>
<div class="container">
<div class="line" style="background-size: 48px;">This line should have a visible green background.</div>
</div>
<div class="container">
<div class="line" style="background-size: 72px;">This line should have a visible green background.</div>
</div>
<div class="container">
<div class="line" style="background-size: 96px;">This line should have a visible green background.</div>
The layout of SVGImage should force the layout for its clients https://bugs.webkit.org/show_bug.cgi?id=221253 <rdar://problem/74138641> Reviewed by Simon Fraser. Source/WebCore: Unlike the bitmap image, the intrinsic size of SVGImage can only be known after running its layout. Because SVGImage can be used by multiple clients, CachedImage maintains an SVGImageCache which maps a client to an SVGImageForContainer. SVGImageForContainer is just a wrapper of SVGImage with the intrinsic size of the client. Because we may set an entry for the renderer in SVGImageCache early before running a layout for SVGImage and because the renderer intrinsic size depends on the intrinsic size of SVGImage, SVGImageForContainer may have an empty intrinsic size. So basically it is a race condition: knowing the intrinsic size of the SVGImage client depends on the intrinsic size of SVGImage itself. And the intrinsic size of SVGImageForContainer depends on the intrinsic size of the client. This may lead to not rendering the clients because their sizes are empty. To fix this issue we need to force calculateBackgroundImageGeometry() once we finish the layout of the SVGImage which happens after receiving all its data and calling RenderBox::imageChanged(). Test: fast/css/background-svg-image-loading.html * loader/cache/CachedImage.cpp: (WebCore::CachedImage::finishLoading): * rendering/RenderBox.cpp: (WebCore::RenderBox::repaintLayerRectsForImage): LayoutTests: * fast/css/background-svg-image-loading-expected.html: Added. * fast/css/background-svg-image-loading.html: Added. Canonical link: https://commits.webkit.org/234765@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-02 23:22:20 +00:00
</div>
<body>