Title: [273764] trunk
- Revision
- 273764
- Author
- [email protected]
- Date
- 2021-03-02 15:22:20 -0800 (Tue, 02 Mar 2021)
Log Message
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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (273763 => 273764)
--- trunk/LayoutTests/ChangeLog 2021-03-02 23:06:14 UTC (rev 273763)
+++ trunk/LayoutTests/ChangeLog 2021-03-02 23:22:20 UTC (rev 273764)
@@ -1,3 +1,14 @@
+2021-03-02 Said Abou-Hallawa <[email protected]>
+
+ 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.
+
+ * fast/css/background-svg-image-loading-expected.html: Added.
+ * fast/css/background-svg-image-loading.html: Added.
+
2021-03-02 Lauro Moura <[email protected]>
[GLIB] Rebaseline and update expectations
Added: trunk/LayoutTests/fast/css/background-svg-image-loading-expected.html (0 => 273764)
--- trunk/LayoutTests/fast/css/background-svg-image-loading-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css/background-svg-image-loading-expected.html 2021-03-02 23:22:20 UTC (rev 273764)
@@ -0,0 +1,18 @@
+<style>
+ .container {
+ width: 900px;
+ }
+ .line {
+ background-color: green;
+ background-size: 24px;
+ }
+</style>
+<body>
+ <p>PASS when all the lines below have visible background images.<p>
+ <div class="container">
+ <div class="line">should have a visible background image</div>
+ <div class="line">should have a visible background image</div>
+ <div class="line">should have a visible background image</div>
+ <div class="line">should have a visible background image</div>
+ </div>
+<body>
Added: trunk/LayoutTests/fast/css/background-svg-image-loading.html (0 => 273764)
--- trunk/LayoutTests/fast/css/background-svg-image-loading.html (rev 0)
+++ trunk/LayoutTests/fast/css/background-svg-image-loading.html 2021-03-02 23:22:20 UTC (rev 273764)
@@ -0,0 +1,21 @@
+<style>
+ .container {
+ width: 900px;
+ }
+ .line {
+ background-image: url('data:image/svg+xml;utf8,\
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" width="24">\
+ <rect width="100%" height="100%" fill="green"/>\
+ </svg>');
+ background-size: 24px;
+ }
+</style>
+<body>
+ <p>PASS when all the lines below have visible background images.<p>
+ <div class="container">
+ <div class="line">should have a visible background image</div>
+ <div class="line">should have a visible background image</div>
+ <div class="line">should have a visible background image</div>
+ <div class="line">should have a visible background image</div>
+ </div>
+<body>
Modified: trunk/Source/WebCore/ChangeLog (273763 => 273764)
--- trunk/Source/WebCore/ChangeLog 2021-03-02 23:06:14 UTC (rev 273763)
+++ trunk/Source/WebCore/ChangeLog 2021-03-02 23:22:20 UTC (rev 273764)
@@ -1,3 +1,35 @@
+2021-03-02 Said Abou-Hallawa <[email protected]>
+
+ 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.
+
+ 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):
+
2021-03-02 Simon Fraser <[email protected]>
Move AnimationFrameRate code into a .cpp file
Modified: trunk/Source/WebCore/loader/cache/CachedImage.cpp (273763 => 273764)
--- trunk/Source/WebCore/loader/cache/CachedImage.cpp 2021-03-02 23:06:14 UTC (rev 273763)
+++ trunk/Source/WebCore/loader/cache/CachedImage.cpp 2021-03-02 23:22:20 UTC (rev 273764)
@@ -584,6 +584,7 @@
return;
}
+ setLoading(false);
notifyObservers();
CachedResource::finishLoading(data, metrics);
}
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (273763 => 273764)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2021-03-02 23:06:14 UTC (rev 273763)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2021-03-02 23:22:20 UTC (rev 273764)
@@ -1850,7 +1850,7 @@
RenderBox* layerRenderer = nullptr;
for (auto* layer = &layers; layer; layer = layer->next()) {
- if (layer->image() && image == layer->image()->data() && layer->image()->canRender(this, style().effectiveZoom())) {
+ if (layer->image() && image == layer->image()->data() && (layer->image()->isLoaded() || layer->image()->canRender(this, style().effectiveZoom()))) {
// Now that we know this image is being used, compute the renderer and the rect if we haven't already.
bool drawingRootBackground = drawingBackground && (isDocumentElementRenderer() || (isBody() && !document().documentElement()->renderer()->hasBackground()));
if (!layerRenderer) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes