Title: [279906] trunk/Source/WebCore
- Revision
- 279906
- Author
- [email protected]
- Date
- 2021-07-14 00:13:23 -0700 (Wed, 14 Jul 2021)
Log Message
RenderElement::updateFillImages must fix the clients of the CSS image whose URL is invalid
https://bugs.webkit.org/show_bug.cgi?id=227926
<rdar://80457956>
Reviewed by Simon Fraser.
Per CSS2 specs, if the value of the url() is the empty string, then it
must be resolved to the URL of the style sheet which is an invalid URI
for an image. The issue https://github.com/w3c/csswg-drafts/issues/2211
was filed to change this behavior.
In RenderElement::updateFillImages() we fix the old and new fill images
only if they are different. But we consider them equal if their URIs are
equal and they are not data URIs. If the two URIs are empty strings, the
fill images will be considered equal although their CachedImages might
be different.
We need to fix the clients of the fill images always if their CachedImages
have errorOccured() true or have hasImage() false.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::updateFillImages):
* rendering/style/StyleCachedImage.cpp:
(WebCore::StyleCachedImage::hasImage const):
* rendering/style/StyleCachedImage.h:
* rendering/style/StyleImage.h:
(WebCore::StyleImage::hasImage const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (279905 => 279906)
--- trunk/Source/WebCore/ChangeLog 2021-07-14 05:57:07 UTC (rev 279905)
+++ trunk/Source/WebCore/ChangeLog 2021-07-14 07:13:23 UTC (rev 279906)
@@ -1,3 +1,33 @@
+2021-07-14 Said Abou-Hallawa <[email protected]>
+
+ RenderElement::updateFillImages must fix the clients of the CSS image whose URL is invalid
+ https://bugs.webkit.org/show_bug.cgi?id=227926
+ <rdar://80457956>
+
+ Reviewed by Simon Fraser.
+
+ Per CSS2 specs, if the value of the url() is the empty string, then it
+ must be resolved to the URL of the style sheet which is an invalid URI
+ for an image. The issue https://github.com/w3c/csswg-drafts/issues/2211
+ was filed to change this behavior.
+
+ In RenderElement::updateFillImages() we fix the old and new fill images
+ only if they are different. But we consider them equal if their URIs are
+ equal and they are not data URIs. If the two URIs are empty strings, the
+ fill images will be considered equal although their CachedImages might
+ be different.
+
+ We need to fix the clients of the fill images always if their CachedImages
+ have errorOccured() true or have hasImage() false.
+
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::updateFillImages):
+ * rendering/style/StyleCachedImage.cpp:
+ (WebCore::StyleCachedImage::hasImage const):
+ * rendering/style/StyleCachedImage.h:
+ * rendering/style/StyleImage.h:
+ (WebCore::StyleImage::hasImage const):
+
2021-07-13 Jean-Yves Avenard <[email protected]>
MediaSessionManagerCocoa::ensureCodecsRegistered() isn't thread-safe
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (279905 => 279906)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2021-07-14 05:57:07 UTC (rev 279905)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2021-07-14 07:13:23 UTC (rev 279906)
@@ -363,6 +363,10 @@
return false;
if (layer1->image() && layer1->image()->usesDataProtocol())
return false;
+ if (auto styleImage = layer1->image()) {
+ if (styleImage->errorOccurred() || !styleImage->hasImage() || styleImage->usesDataProtocol())
+ return false;
+ }
}
return !layer1 && !layer2;
Modified: trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp (279905 => 279906)
--- trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp 2021-07-14 05:57:07 UTC (rev 279905)
+++ trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp 2021-07-14 07:13:23 UTC (rev 279906)
@@ -180,6 +180,13 @@
return m_cachedImage->hasClient(renderer);
}
+bool StyleCachedImage::hasImage() const
+{
+ if (!m_cachedImage)
+ return false;
+ return m_cachedImage->hasImage();
+}
+
RefPtr<Image> StyleCachedImage::image(RenderElement* renderer, const FloatSize&) const
{
ASSERT(!m_isPending);
Modified: trunk/Source/WebCore/rendering/style/StyleCachedImage.h (279905 => 279906)
--- trunk/Source/WebCore/rendering/style/StyleCachedImage.h 2021-07-14 05:57:07 UTC (rev 279905)
+++ trunk/Source/WebCore/rendering/style/StyleCachedImage.h 2021-07-14 07:13:23 UTC (rev 279906)
@@ -61,6 +61,7 @@
void addClient(RenderElement&) final;
void removeClient(RenderElement&) final;
bool hasClient(RenderElement&) const final;
+ bool hasImage() const final;
RefPtr<Image> image(RenderElement*, const FloatSize&) const final;
float imageScaleFactor() const final;
bool knownToBeOpaque(const RenderElement&) const final;
Modified: trunk/Source/WebCore/rendering/style/StyleImage.h (279905 => 279906)
--- trunk/Source/WebCore/rendering/style/StyleImage.h 2021-07-14 05:57:07 UTC (rev 279905)
+++ trunk/Source/WebCore/rendering/style/StyleImage.h 2021-07-14 07:13:23 UTC (rev 279906)
@@ -63,6 +63,7 @@
virtual void addClient(RenderElement&) = 0;
virtual void removeClient(RenderElement&) = 0;
virtual bool hasClient(RenderElement&) const = 0;
+ virtual bool hasImage() const { return false; }
virtual RefPtr<Image> image(RenderElement*, const FloatSize&) const = 0;
virtual WrappedImagePtr data() const = 0;
virtual float imageScaleFactor() const { return 1; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes