<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[277112] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/277112">277112</a></dd>
<dt>Author</dt> <dd>graouts@webkit.org</dd>
<dt>Date</dt> <dd>2021-05-06 13:11:19 -0700 (Thu, 06 May 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>CSS custom properties on pseudo elements background gradients causes infinite layout and high CPU load
https://bugs.webkit.org/show_bug.cgi?id=194332
<rdar://problem/47873895>

Reviewed by Simon Fraser.

Source/WebCore:

When a background-image uses a CSS custom property the resulting StyleGeneratedImage may not be the same
object as during prior style updates. This caused transitions to be triggered for all style updates for
such background-image values. To fix this, we modify the == operator for StyleGeneratedImage to use
arePointingToEqualData() with the CSSImageGeneratorValue member and added an == operator for the
CSSImageGeneratorValue class to call into the existing equals() methods. These equals() methods
are now overrides of the virtual CSSImageGeneratorValue method.

This change in behavior required a change in RenderElement::updateFillImages() to not only check whether
the images were identical, but to also check whether the renderer was registered as a client on the new
images. To do this, we add a new virtual hasClient() method on StyleImage.

Test: webanimations/css-transition-element-with-gradient-background-image-and-css-custom-property.html

* css/CSSImageGeneratorValue.cpp:
(WebCore::CSSImageGeneratorValue::operator== const):
* css/CSSImageGeneratorValue.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::updateFillImages):
* rendering/style/FillLayer.cpp:
(WebCore::FillLayer::imagesIdentical): Deleted.
* rendering/style/FillLayer.h:
* rendering/style/StyleCachedImage.cpp:
(WebCore::StyleCachedImage::hasClient const):
* rendering/style/StyleCachedImage.h:
* rendering/style/StyleGeneratedImage.cpp:
(WebCore::StyleGeneratedImage::operator== const):
(WebCore::StyleGeneratedImage::hasClient const):
* rendering/style/StyleGeneratedImage.h:
* rendering/style/StyleImage.h:
* rendering/style/StyleMultiImage.cpp:
(WebCore::StyleMultiImage::hasClient const):
* rendering/style/StyleMultiImage.h:

LayoutTests:

Add a test where an element with a background-image set to a CSS gradient using a custom property as a color
stop changes another property targeted by a transition to check that there is no background-image transition
generated.

* webanimations/css-transition-element-with-gradient-background-image-and-css-custom-property-expected.txt: Added.
* webanimations/css-transition-element-with-gradient-background-image-and-css-custom-property.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSImageGeneratorValuecpp">trunk/Source/WebCore/css/CSSImageGeneratorValue.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSImageGeneratorValueh">trunk/Source/WebCore/css/CSSImageGeneratorValue.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderElementcpp">trunk/Source/WebCore/rendering/RenderElement.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleFillLayercpp">trunk/Source/WebCore/rendering/style/FillLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleFillLayerh">trunk/Source/WebCore/rendering/style/FillLayer.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleCachedImagecpp">trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleCachedImageh">trunk/Source/WebCore/rendering/style/StyleCachedImage.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleGeneratedImagecpp">trunk/Source/WebCore/rendering/style/StyleGeneratedImage.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleGeneratedImageh">trunk/Source/WebCore/rendering/style/StyleGeneratedImage.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleImageh">trunk/Source/WebCore/rendering/style/StyleImage.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleMultiImagecpp">trunk/Source/WebCore/rendering/style/StyleMultiImage.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleStyleMultiImageh">trunk/Source/WebCore/rendering/style/StyleMultiImage.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestswebanimationscsstransitionelementwithgradientbackgroundimageandcsscustompropertyexpectedtxt">trunk/LayoutTests/webanimations/css-transition-element-with-gradient-background-image-and-css-custom-property-expected.txt</a></li>
<li><a href="#trunkLayoutTestswebanimationscsstransitionelementwithgradientbackgroundimageandcsscustompropertyhtml">trunk/LayoutTests/webanimations/css-transition-element-with-gradient-background-image-and-css-custom-property.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (277111 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-05-06 19:41:53 UTC (rev 277111)
+++ trunk/LayoutTests/ChangeLog 2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2021-05-06  Antoine Quint  <graouts@webkit.org>
+
+        CSS custom properties on pseudo elements background gradients causes infinite layout and high CPU load
+        https://bugs.webkit.org/show_bug.cgi?id=194332
+        <rdar://problem/47873895>
+
+        Reviewed by Simon Fraser.
+
+        Add a test where an element with a background-image set to a CSS gradient using a custom property as a color
+        stop changes another property targeted by a transition to check that there is no background-image transition
+        generated. 
+
+        * webanimations/css-transition-element-with-gradient-background-image-and-css-custom-property-expected.txt: Added.
+        * webanimations/css-transition-element-with-gradient-background-image-and-css-custom-property.html: Added.
+
</ins><span class="cx"> 2021-05-06  Diego Pino Garcia  <dpino@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [GLIB] Unreviewed test gardening. Update expectations after WPT re-import in r277073 and r277077.
</span></span></pre></div>
<a id="trunkLayoutTestswebanimationscsstransitionelementwithgradientbackgroundimageandcsscustompropertyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webanimations/css-transition-element-with-gradient-background-image-and-css-custom-property-expected.txt (0 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webanimations/css-transition-element-with-gradient-background-image-and-css-custom-property-expected.txt                               (rev 0)
+++ trunk/LayoutTests/webanimations/css-transition-element-with-gradient-background-image-and-css-custom-property-expected.txt  2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS An element with a background-image set to a CSS gradient with a stop color set by a custom property does not yield a background-image transition when another CSS property changes.
+
</ins></span></pre></div>
<a id="trunkLayoutTestswebanimationscsstransitionelementwithgradientbackgroundimageandcsscustompropertyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webanimations/css-transition-element-with-gradient-background-image-and-css-custom-property.html (0 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webanimations/css-transition-element-with-gradient-background-image-and-css-custom-property.html                               (rev 0)
+++ trunk/LayoutTests/webanimations/css-transition-element-with-gradient-background-image-and-css-custom-property.html  2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+<!DOCTYPE html>
+<meta charset="utf-8">
+<style>
+
+:root {
+    --custom-color: blue;
+}
+
+.target {
+    width: 100px;
+    height: 100px;
+    background: linear-gradient(var(--custom-color), green);
+    transition-duration: 1s;
+}
+
+.target.transition {
+    margin-left: 100px;
+}
+
+</style>
+<body>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script>
+
+'use strict';
+
+promise_test(async test => {
+    const target = document.body.appendChild(document.createElement("div"));
+    target.classList.add("target");
+
+    await new Promise(requestAnimationFrame);
+    target.classList.add("transition");
+
+    const animations = target.getAnimations();
+    assert_equals(animations.length, 1, "There is only one animation applied to the target.");
+    assert_true(animations[0] instanceof CSSTransition, "The single animation applied to the target is a CSS transition.");
+    assert_equals(animations[0].transitionProperty, "margin-left", "The single CSS transition applied to the target is for the margin-left property.");
+}, `An element with a background-image set to a CSS gradient with a stop color set by a custom property does not yield a background-image transition when another CSS property changes.`);
+
+</script>
+</body>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (277111 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-05-06 19:41:53 UTC (rev 277111)
+++ trunk/Source/WebCore/ChangeLog      2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2021-05-06  Antoine Quint  <graouts@webkit.org>
+
+        CSS custom properties on pseudo elements background gradients causes infinite layout and high CPU load
+        https://bugs.webkit.org/show_bug.cgi?id=194332
+        <rdar://problem/47873895>
+
+        Reviewed by Simon Fraser.
+
+        When a background-image uses a CSS custom property the resulting StyleGeneratedImage may not be the same
+        object as during prior style updates. This caused transitions to be triggered for all style updates for
+        such background-image values. To fix this, we modify the == operator for StyleGeneratedImage to use
+        arePointingToEqualData() with the CSSImageGeneratorValue member and added an == operator for the
+        CSSImageGeneratorValue class to call into the existing equals() methods. These equals() methods
+        are now overrides of the virtual CSSImageGeneratorValue method.
+
+        This change in behavior required a change in RenderElement::updateFillImages() to not only check whether
+        the images were identical, but to also check whether the renderer was registered as a client on the new
+        images. To do this, we add a new virtual hasClient() method on StyleImage.
+
+        Test: webanimations/css-transition-element-with-gradient-background-image-and-css-custom-property.html
+
+        * css/CSSImageGeneratorValue.cpp:
+        (WebCore::CSSImageGeneratorValue::operator== const):
+        * css/CSSImageGeneratorValue.h:
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::updateFillImages):
+        * rendering/style/FillLayer.cpp:
+        (WebCore::FillLayer::imagesIdentical): Deleted.
+        * rendering/style/FillLayer.h:
+        * rendering/style/StyleCachedImage.cpp:
+        (WebCore::StyleCachedImage::hasClient const):
+        * rendering/style/StyleCachedImage.h:
+        * rendering/style/StyleGeneratedImage.cpp:
+        (WebCore::StyleGeneratedImage::operator== const):
+        (WebCore::StyleGeneratedImage::hasClient const):
+        * rendering/style/StyleGeneratedImage.h:
+        * rendering/style/StyleImage.h:
+        * rendering/style/StyleMultiImage.cpp:
+        (WebCore::StyleMultiImage::hasClient const):
+        * rendering/style/StyleMultiImage.h:
+
</ins><span class="cx"> 2021-05-06  Philippe Normand  <pnormand@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [WebAudio][GStreamer] socketpair leaks
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSImageGeneratorValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSImageGeneratorValue.cpp (277111 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSImageGeneratorValue.cpp      2021-05-06 19:41:53 UTC (rev 277111)
+++ trunk/Source/WebCore/css/CSSImageGeneratorValue.cpp 2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -298,6 +298,35 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool CSSImageGeneratorValue::operator==(const CSSImageGeneratorValue& other) const
+{
+    if (classType() != other.classType())
+        return false;
+
+    switch (classType()) {
+    case CrossfadeClass:
+        return downcast<CSSCrossfadeValue>(*this).equals(downcast<CSSCrossfadeValue>(other));
+    case CanvasClass:
+        return downcast<CSSCanvasValue>(*this).equals(downcast<CSSCanvasValue>(other));
+    case FilterImageClass:
+        return downcast<CSSFilterImageValue>(*this).equals(downcast<CSSFilterImageValue>(other));
+    case LinearGradientClass:
+        return downcast<CSSLinearGradientValue>(*this).equals(downcast<CSSLinearGradientValue>(other));
+    case RadialGradientClass:
+        return downcast<CSSRadialGradientValue>(*this).equals(downcast<CSSRadialGradientValue>(other));
+    case ConicGradientClass:
+        return downcast<CSSConicGradientValue>(*this).equals(downcast<CSSConicGradientValue>(other));
+#if ENABLE(CSS_PAINTING_API)
+    case PaintImageClass:
+        return downcast<CSSPaintImageValue>(*this).equals(downcast<CSSPaintImageValue>(other));
+#endif
+    default:
+        ASSERT_NOT_REACHED();
+    }
+
+    return false;
+}
+
</ins><span class="cx"> bool CSSImageGeneratorValue::subimageIsPending(const CSSValue& value)
</span><span class="cx"> {
</span><span class="cx">     if (is<CSSImageValue>(value))
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSImageGeneratorValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSImageGeneratorValue.h (277111 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSImageGeneratorValue.h        2021-05-06 19:41:53 UTC (rev 277111)
+++ trunk/Source/WebCore/css/CSSImageGeneratorValue.h   2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -57,6 +57,8 @@
</span><span class="cx"> 
</span><span class="cx">     void loadSubimages(CachedResourceLoader&, const ResourceLoaderOptions&);
</span><span class="cx"> 
</span><ins>+    bool operator==(const CSSImageGeneratorValue& other) const;
+
</ins><span class="cx"> protected:
</span><span class="cx">     CSSImageGeneratorValue(ClassType);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (277111 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderElement.cpp 2021-05-06 19:41:53 UTC (rev 277111)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp    2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -353,10 +353,31 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderElement::updateFillImages(const FillLayer* oldLayers, const FillLayer& newLayers)
</span><span class="cx"> {
</span><del>-    // Optimize the common case.
-    if (FillLayer::imagesIdentical(oldLayers, &newLayers))
</del><ins>+    auto fillImagesAreIdentical = [](const FillLayer* layer1, const FillLayer* layer2) -> bool {
+        if (layer1 == layer2)
+            return true;
+
+        for (; layer1 && layer2; layer1 = layer1->next(), layer2 = layer2->next()) {
+            if (!arePointingToEqualData(layer1->image(), layer2->image()))
+                return false;
+        }
+
+        return !layer1 && !layer2;
+    };
+
+    auto isRegisteredWithNewFillImages = [&]() -> bool {
+        for (auto* layer = &newLayers; layer; layer = layer->next()) {
+            if (layer->image() && !layer->image()->hasClient(*this))
+                return false;
+        }
+        return true;
+    };
+
+    // If images have the same characteristics and this element is already registered as a
+    // client to the new images, there is nothing to do.
+    if (fillImagesAreIdentical(oldLayers, &newLayers) && isRegisteredWithNewFillImages())
</ins><span class="cx">         return;
</span><del>-    
</del><ins>+
</ins><span class="cx">     // Add before removing, to avoid removing all clients of an image that is in both sets.
</span><span class="cx">     for (auto* layer = &newLayers; layer; layer = layer->next()) {
</span><span class="cx">         if (layer->image())
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleFillLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/FillLayer.cpp (277111 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/FillLayer.cpp       2021-05-06 19:41:53 UTC (rev 277111)
+++ trunk/Source/WebCore/rendering/style/FillLayer.cpp  2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -396,19 +396,6 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool FillLayer::imagesIdentical(const FillLayer* layer1, const FillLayer* layer2)
-{
-    if (layer1 == layer2)
-        return true;
-
-    for (; layer1 && layer2; layer1 = layer1->next(), layer2 = layer2->next()) {
-        if (!arePointingToEqualData(layer1->image(), layer2->image()))
-            return false;
-    }
-
-    return !layer1 && !layer2;
-}
-
</del><span class="cx"> TextStream& operator<<(TextStream& ts, FillSize fillSize)
</span><span class="cx"> {
</span><span class="cx">     return ts << fillSize.type << " " << fillSize.size;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleFillLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/FillLayer.h (277111 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/FillLayer.h 2021-05-06 19:41:53 UTC (rev 277111)
+++ trunk/Source/WebCore/rendering/style/FillLayer.h    2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -159,8 +159,6 @@
</span><span class="cx">     void fillUnsetProperties();
</span><span class="cx">     void cullEmptyLayers();
</span><span class="cx"> 
</span><del>-    static bool imagesIdentical(const FillLayer*, const FillLayer*);
-
</del><span class="cx">     static FillAttachment initialFillAttachment(FillLayerType) { return FillAttachment::ScrollBackground; }
</span><span class="cx">     static FillBox initialFillClip(FillLayerType) { return FillBox::Border; }
</span><span class="cx">     static FillBox initialFillOrigin(FillLayerType type) { return type == FillLayerType::Background ? FillBox::Padding : FillBox::Border; }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleCachedImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp (277111 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp        2021-05-06 19:41:53 UTC (rev 277111)
+++ trunk/Source/WebCore/rendering/style/StyleCachedImage.cpp   2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -172,6 +172,14 @@
</span><span class="cx">     m_cachedImage->removeClient(renderer);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool StyleCachedImage::hasClient(RenderElement& renderer) const
+{
+    ASSERT(!m_isPending);
+    if (!m_cachedImage)
+        return false;
+    return m_cachedImage->hasClient(renderer);
+}
+
</ins><span class="cx"> RefPtr<Image> StyleCachedImage::image(RenderElement* renderer, const FloatSize&) const
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_isPending);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleCachedImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleCachedImage.h (277111 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleCachedImage.h  2021-05-06 19:41:53 UTC (rev 277111)
+++ trunk/Source/WebCore/rendering/style/StyleCachedImage.h     2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx">     void setContainerContextForRenderer(const RenderElement&, const FloatSize&, float) final;
</span><span class="cx">     void addClient(RenderElement&) final;
</span><span class="cx">     void removeClient(RenderElement&) final;
</span><ins>+    bool hasClient(RenderElement&) const final;
</ins><span class="cx">     RefPtr<Image> image(RenderElement*, const FloatSize&) const final;
</span><span class="cx">     float imageScaleFactor() const final;
</span><span class="cx">     bool knownToBeOpaque(const RenderElement&) const final;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleGeneratedImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleGeneratedImage.cpp (277111 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleGeneratedImage.cpp     2021-05-06 19:41:53 UTC (rev 277111)
+++ trunk/Source/WebCore/rendering/style/StyleGeneratedImage.cpp        2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -37,6 +37,13 @@
</span><span class="cx">     m_isGeneratedImage = true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool StyleGeneratedImage::operator==(const StyleImage& other) const
+{
+    if (is<StyleGeneratedImage>(other))
+        return arePointingToEqualData(m_imageGeneratorValue.ptr(), downcast<StyleGeneratedImage>(other).m_imageGeneratorValue.ptr());
+    return false;
+}
+
</ins><span class="cx"> Ref<CSSValue> StyleGeneratedImage::cssValue() const
</span><span class="cx"> {
</span><span class="cx">     return m_imageGeneratorValue.copyRef();
</span><span class="lines">@@ -96,6 +103,11 @@
</span><span class="cx">     m_imageGeneratorValue->removeClient(renderer);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool StyleGeneratedImage::hasClient(RenderElement& renderer) const
+{
+    return m_imageGeneratorValue->clients().contains(&renderer);
+}
+
</ins><span class="cx"> RefPtr<Image> StyleGeneratedImage::image(RenderElement* renderer, const FloatSize& size) const
</span><span class="cx"> {
</span><span class="cx">     return renderer ? m_imageGeneratorValue->image(*renderer, size) : &Image::nullImage();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleGeneratedImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleGeneratedImage.h (277111 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleGeneratedImage.h       2021-05-06 19:41:53 UTC (rev 277111)
+++ trunk/Source/WebCore/rendering/style/StyleGeneratedImage.h  2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx">     CSSImageGeneratorValue& imageValue() { return m_imageGeneratorValue; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    bool operator==(const StyleImage& other) const final { return data() == other.data(); }
</del><ins>+    bool operator==(const StyleImage& other) const final;
</ins><span class="cx"> 
</span><span class="cx">     WrappedImagePtr data() const final { return m_imageGeneratorValue.ptr(); }
</span><span class="cx"> 
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx">     void setContainerContextForRenderer(const RenderElement&, const FloatSize& containerSize, float) final { m_containerSize = containerSize; }
</span><span class="cx">     void addClient(RenderElement&) final;
</span><span class="cx">     void removeClient(RenderElement&) final;
</span><ins>+    bool hasClient(RenderElement&) const final;
</ins><span class="cx">     RefPtr<Image> image(RenderElement*, const FloatSize&) const final;
</span><span class="cx">     bool knownToBeOpaque(const RenderElement&) const final;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleImage.h (277111 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleImage.h        2021-05-06 19:41:53 UTC (rev 277111)
+++ trunk/Source/WebCore/rendering/style/StyleImage.h   2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx">     virtual void setContainerContextForRenderer(const RenderElement&, const FloatSize&, float) = 0;
</span><span class="cx">     virtual void addClient(RenderElement&) = 0;
</span><span class="cx">     virtual void removeClient(RenderElement&) = 0;
</span><ins>+    virtual bool hasClient(RenderElement&) const = 0;
</ins><span class="cx">     virtual RefPtr<Image> image(RenderElement*, const FloatSize&) const = 0;
</span><span class="cx">     virtual WrappedImagePtr data() const = 0;
</span><span class="cx">     virtual float imageScaleFactor() const { return 1; }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleMultiImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleMultiImage.cpp (277111 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleMultiImage.cpp 2021-05-06 19:41:53 UTC (rev 277111)
+++ trunk/Source/WebCore/rendering/style/StyleMultiImage.cpp    2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -148,6 +148,13 @@
</span><span class="cx">     m_selectedImage->removeClient(renderer);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool StyleMultiImage::hasClient(RenderElement& renderer) const
+{
+    if (!m_selectedImage)
+        return false;
+    return m_selectedImage->hasClient(renderer);
+}
+
</ins><span class="cx"> RefPtr<Image> StyleMultiImage::image(RenderElement* renderer, const FloatSize& size) const
</span><span class="cx"> {
</span><span class="cx">     if (!m_selectedImage)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleStyleMultiImageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/StyleMultiImage.h (277111 => 277112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/StyleMultiImage.h   2021-05-06 19:41:53 UTC (rev 277111)
+++ trunk/Source/WebCore/rendering/style/StyleMultiImage.h      2021-05-06 20:11:19 UTC (rev 277112)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx">     void setContainerContextForRenderer(const RenderElement&, const FloatSize&, float);
</span><span class="cx">     void addClient(RenderElement&) final;
</span><span class="cx">     void removeClient(RenderElement&) final;
</span><ins>+    bool hasClient(RenderElement&) const final;
</ins><span class="cx">     RefPtr<Image> image(RenderElement*, const FloatSize&) const final;
</span><span class="cx">     float imageScaleFactor() const final;
</span><span class="cx">     bool knownToBeOpaque(const RenderElement&) const final;
</span></span></pre>
</div>
</div>

</body>
</html>