Title: [273831] branches/safari-611.1.21.1-branch
- Revision
- 273831
- Author
- rubent...@apple.com
- Date
- 2021-03-03 12:19:00 -0800 (Wed, 03 Mar 2021)
Log Message
Cherry-pick r273764. rdar://problem/74992878
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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Added Paths
Diff
Modified: branches/safari-611.1.21.1-branch/LayoutTests/ChangeLog (273830 => 273831)
--- branches/safari-611.1.21.1-branch/LayoutTests/ChangeLog 2021-03-03 20:18:56 UTC (rev 273830)
+++ branches/safari-611.1.21.1-branch/LayoutTests/ChangeLog 2021-03-03 20:19:00 UTC (rev 273831)
@@ -1,3 +1,58 @@
+2021-03-03 Ruben Turcios <rubent...@apple.com>
+
+ Cherry-pick r273764. rdar://problem/74992878
+
+ 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.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-03-02 Said Abou-Hallawa <s...@apple.com>
+
+ 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-01 Alan Coon <alanc...@apple.com>
Cherry-pick r273656. rdar://problem/74883377
Added: branches/safari-611.1.21.1-branch/LayoutTests/fast/css/background-svg-image-loading-expected.html (0 => 273831)
--- branches/safari-611.1.21.1-branch/LayoutTests/fast/css/background-svg-image-loading-expected.html (rev 0)
+++ branches/safari-611.1.21.1-branch/LayoutTests/fast/css/background-svg-image-loading-expected.html 2021-03-03 20:19:00 UTC (rev 273831)
@@ -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: branches/safari-611.1.21.1-branch/LayoutTests/fast/css/background-svg-image-loading.html (0 => 273831)
--- branches/safari-611.1.21.1-branch/LayoutTests/fast/css/background-svg-image-loading.html (rev 0)
+++ branches/safari-611.1.21.1-branch/LayoutTests/fast/css/background-svg-image-loading.html 2021-03-03 20:19:00 UTC (rev 273831)
@@ -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: branches/safari-611.1.21.1-branch/Source/WebCore/ChangeLog (273830 => 273831)
--- branches/safari-611.1.21.1-branch/Source/WebCore/ChangeLog 2021-03-03 20:18:56 UTC (rev 273830)
+++ branches/safari-611.1.21.1-branch/Source/WebCore/ChangeLog 2021-03-03 20:19:00 UTC (rev 273831)
@@ -1,3 +1,79 @@
+2021-03-03 Ruben Turcios <rubent...@apple.com>
+
+ Cherry-pick r273764. rdar://problem/74992878
+
+ 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.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-03-02 Said Abou-Hallawa <s...@apple.com>
+
+ 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 Alan Coon <alanc...@apple.com>
Apply patch. rdar://problem/74944301
Modified: branches/safari-611.1.21.1-branch/Source/WebCore/loader/cache/CachedImage.cpp (273830 => 273831)
--- branches/safari-611.1.21.1-branch/Source/WebCore/loader/cache/CachedImage.cpp 2021-03-03 20:18:56 UTC (rev 273830)
+++ branches/safari-611.1.21.1-branch/Source/WebCore/loader/cache/CachedImage.cpp 2021-03-03 20:19:00 UTC (rev 273831)
@@ -584,6 +584,7 @@
return;
}
+ setLoading(false);
notifyObservers();
CachedResource::finishLoading(data, metrics);
}
Modified: branches/safari-611.1.21.1-branch/Source/WebCore/rendering/RenderBox.cpp (273830 => 273831)
--- branches/safari-611.1.21.1-branch/Source/WebCore/rendering/RenderBox.cpp 2021-03-03 20:18:56 UTC (rev 273830)
+++ branches/safari-611.1.21.1-branch/Source/WebCore/rendering/RenderBox.cpp 2021-03-03 20:19:00 UTC (rev 273831)
@@ -1799,7 +1799,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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes