<!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>[259903] branches/safari-609-branch</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/259903">259903</a></dd>
<dt>Author</dt> <dd>alancoon@apple.com</dd>
<dt>Date</dt> <dd>2020-04-10 14:23:50 -0700 (Fri, 10 Apr 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>Cherry-pick <a href="http://trac.webkit.org/projects/webkit/changeset/259830">r259830</a>. rdar://problem/61596886

    REGRESSION: CSS animations inside an embedded SVG image do not animate
    https://bugs.webkit.org/show_bug.cgi?id=209370

    Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2020-04-09
    Reviewed by Simon Fraser.

    Source/WebCore:

    If WebAnimation is enabled and the SVGImage includes CSS animations, the
    DocumentTimeline is added to the SVGDocument of the embedded SVGImage.
    Because the SVGImage has its own Page the RenderingUpdate is scheduled
    and the updateRendering steps run in this Page.

    The Page of the SVGImage is inactive such that scheduling RenderingUpdate
    fails; therefore the updateRendering steps never run and the CSS animation
    never advances.

    The fix is:

    1) Scheduling the RenderingUpdate: This has to happen in the Page which
       contains the renderer of the SVGImage. Because DocumentTimeline is
       added to SVGDocument, this scheduling will go through these hubs:
            - DocumentTimeline
            - Page
            - ChromeClient -> SVGImageChromeClient
            - SVGImage
            - ImageObserver -> CachedImageObserver
            - CachedImage
            - CachedImageClient -> RenderElement
            - Page

    2) Running the updateRendering steps: Each document in the Page will
       enumerate its cached SVGImages. The updateRendering of the Page of
       each SVGImage will be called.

    To make enumerating the cached SVGImages of a Document faster, the URL
    of the cached SVGImage will be added to the cachedSVGImagesURLs of
    CachedResourceLoader when notifyFinished() is called for associated
    CachedImage.

    Tests: svg/animations/css-animation-background-svg.html
           svg/animations/css-animation-embedded-svg.html
           svg/animations/css-animation-hover-svg.html

    * animation/DocumentTimeline.cpp:
    (WebCore::DocumentTimeline::scheduleAnimationResolution):
    (WebCore::DocumentTimeline::updateAnimationsAndSendEvents):
    * html/ImageBitmap.cpp:
    * loader/cache/CachedImage.cpp:
    (WebCore::CachedImage::hasSVGImage const):
    (WebCore::CachedImage::CachedImageObserver::scheduleTimedRenderingUpdate):
    (WebCore::CachedImage::scheduleTimedRenderingUpdate):
    * loader/cache/CachedImage.h:
    * loader/cache/CachedImageClient.h:
    (WebCore::CachedImageClient::scheduleTimedRenderingUpdate):
    * loader/cache/CachedResourceLoader.cpp:
    (WebCore::isSVGImageCachedResource):
    (WebCore::cachedResourceSVGImage):
    (WebCore::CachedResourceLoader::notifyFinished):
    (WebCore:: const):
    * loader/cache/CachedResourceLoader.h:
    * page/ChromeClient.h:
    (WebCore::ChromeClient::scheduleTimedRenderingUpdate):
    * page/Page.cpp:
    (WebCore::Page::scheduleTimedRenderingUpdate):
    (WebCore::Page::updateRendering):
    * page/Page.h:
    * platform/graphics/ImageObserver.h:
    * rendering/RenderElement.cpp:
    (WebCore::RenderElement::notifyFinished):
    (WebCore::RenderElement::scheduleTimedRenderingUpdate):
    * rendering/RenderElement.h:
    * rendering/RenderImage.cpp:
    (WebCore::RenderImage::notifyFinished):
    * svg/graphics/SVGImage.h:
    * svg/graphics/SVGImageClients.h:

    LayoutTests:

    * svg/animations/css-animation-background-svg-expected.html: Added.
    * svg/animations/css-animation-background-svg.html: Added.
    * svg/animations/css-animation-embedded-svg-expected.html: Added.
    * svg/animations/css-animation-embedded-svg.html: Added.
    * svg/animations/css-animation-hover-svg-expected.html: Added.
    * svg/animations/css-animation-hover-svg.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259830 268f45cc-cd09-0410-ab3c-d52691b4dbfc</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari609branchLayoutTestsChangeLog">branches/safari-609-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari609branchSourceWebCoreChangeLog">branches/safari-609-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari609branchSourceWebCoreanimationDocumentTimelinecpp">branches/safari-609-branch/Source/WebCore/animation/DocumentTimeline.cpp</a></li>
<li><a href="#branchessafari609branchSourceWebCorehtmlImageBitmapcpp">branches/safari-609-branch/Source/WebCore/html/ImageBitmap.cpp</a></li>
<li><a href="#branchessafari609branchSourceWebCoreloadercacheCachedImagecpp">branches/safari-609-branch/Source/WebCore/loader/cache/CachedImage.cpp</a></li>
<li><a href="#branchessafari609branchSourceWebCoreloadercacheCachedImageh">branches/safari-609-branch/Source/WebCore/loader/cache/CachedImage.h</a></li>
<li><a href="#branchessafari609branchSourceWebCoreloadercacheCachedImageClienth">branches/safari-609-branch/Source/WebCore/loader/cache/CachedImageClient.h</a></li>
<li><a href="#branchessafari609branchSourceWebCoreloadercacheCachedResourceLoadercpp">branches/safari-609-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp</a></li>
<li><a href="#branchessafari609branchSourceWebCoreloadercacheCachedResourceLoaderh">branches/safari-609-branch/Source/WebCore/loader/cache/CachedResourceLoader.h</a></li>
<li><a href="#branchessafari609branchSourceWebCorepageChromeClienth">branches/safari-609-branch/Source/WebCore/page/ChromeClient.h</a></li>
<li><a href="#branchessafari609branchSourceWebCorepagePagecpp">branches/safari-609-branch/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#branchessafari609branchSourceWebCorepagePageh">branches/safari-609-branch/Source/WebCore/page/Page.h</a></li>
<li><a href="#branchessafari609branchSourceWebCoreplatformgraphicsImageObserverh">branches/safari-609-branch/Source/WebCore/platform/graphics/ImageObserver.h</a></li>
<li><a href="#branchessafari609branchSourceWebCorerenderingRenderElementcpp">branches/safari-609-branch/Source/WebCore/rendering/RenderElement.cpp</a></li>
<li><a href="#branchessafari609branchSourceWebCorerenderingRenderElementh">branches/safari-609-branch/Source/WebCore/rendering/RenderElement.h</a></li>
<li><a href="#branchessafari609branchSourceWebCorerenderingRenderImagecpp">branches/safari-609-branch/Source/WebCore/rendering/RenderImage.cpp</a></li>
<li><a href="#branchessafari609branchSourceWebCoresvggraphicsSVGImageh">branches/safari-609-branch/Source/WebCore/svg/graphics/SVGImage.h</a></li>
<li><a href="#branchessafari609branchSourceWebCoresvggraphicsSVGImageClientsh">branches/safari-609-branch/Source/WebCore/svg/graphics/SVGImageClients.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari609branchLayoutTestssvganimationscssanimationbackgroundsvgexpectedhtml">branches/safari-609-branch/LayoutTests/svg/animations/css-animation-background-svg-expected.html</a></li>
<li><a href="#branchessafari609branchLayoutTestssvganimationscssanimationbackgroundsvghtml">branches/safari-609-branch/LayoutTests/svg/animations/css-animation-background-svg.html</a></li>
<li><a href="#branchessafari609branchLayoutTestssvganimationscssanimationembeddedsvgexpectedhtml">branches/safari-609-branch/LayoutTests/svg/animations/css-animation-embedded-svg-expected.html</a></li>
<li><a href="#branchessafari609branchLayoutTestssvganimationscssanimationembeddedsvghtml">branches/safari-609-branch/LayoutTests/svg/animations/css-animation-embedded-svg.html</a></li>
<li><a href="#branchessafari609branchLayoutTestssvganimationscssanimationhoversvgexpectedhtml">branches/safari-609-branch/LayoutTests/svg/animations/css-animation-hover-svg-expected.html</a></li>
<li><a href="#branchessafari609branchLayoutTestssvganimationscssanimationhoversvghtml">branches/safari-609-branch/LayoutTests/svg/animations/css-animation-hover-svg.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari609branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/LayoutTests/ChangeLog (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/LayoutTests/ChangeLog 2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/LayoutTests/ChangeLog    2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -1,5 +1,111 @@
</span><span class="cx"> 2020-04-10  Alan Coon  <alancoon@apple.com>
</span><span class="cx"> 
</span><ins>+        Cherry-pick r259830. rdar://problem/61596886
+
+    REGRESSION: CSS animations inside an embedded SVG image do not animate
+    https://bugs.webkit.org/show_bug.cgi?id=209370
+    
+    Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2020-04-09
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    If WebAnimation is enabled and the SVGImage includes CSS animations, the
+    DocumentTimeline is added to the SVGDocument of the embedded SVGImage.
+    Because the SVGImage has its own Page the RenderingUpdate is scheduled
+    and the updateRendering steps run in this Page.
+    
+    The Page of the SVGImage is inactive such that scheduling RenderingUpdate
+    fails; therefore the updateRendering steps never run and the CSS animation
+    never advances.
+    
+    The fix is:
+    
+    1) Scheduling the RenderingUpdate: This has to happen in the Page which
+       contains the renderer of the SVGImage. Because DocumentTimeline is
+       added to SVGDocument, this scheduling will go through these hubs:
+            - DocumentTimeline
+            - Page
+            - ChromeClient -> SVGImageChromeClient
+            - SVGImage
+            - ImageObserver -> CachedImageObserver
+            - CachedImage
+            - CachedImageClient -> RenderElement
+            - Page
+    
+    2) Running the updateRendering steps: Each document in the Page will
+       enumerate its cached SVGImages. The updateRendering of the Page of
+       each SVGImage will be called.
+    
+    To make enumerating the cached SVGImages of a Document faster, the URL
+    of the cached SVGImage will be added to the cachedSVGImagesURLs of
+    CachedResourceLoader when notifyFinished() is called for associated
+    CachedImage.
+    
+    Tests: svg/animations/css-animation-background-svg.html
+           svg/animations/css-animation-embedded-svg.html
+           svg/animations/css-animation-hover-svg.html
+    
+    * animation/DocumentTimeline.cpp:
+    (WebCore::DocumentTimeline::scheduleAnimationResolution):
+    (WebCore::DocumentTimeline::updateAnimationsAndSendEvents):
+    * html/ImageBitmap.cpp:
+    * loader/cache/CachedImage.cpp:
+    (WebCore::CachedImage::hasSVGImage const):
+    (WebCore::CachedImage::CachedImageObserver::scheduleTimedRenderingUpdate):
+    (WebCore::CachedImage::scheduleTimedRenderingUpdate):
+    * loader/cache/CachedImage.h:
+    * loader/cache/CachedImageClient.h:
+    (WebCore::CachedImageClient::scheduleTimedRenderingUpdate):
+    * loader/cache/CachedResourceLoader.cpp:
+    (WebCore::isSVGImageCachedResource):
+    (WebCore::cachedResourceSVGImage):
+    (WebCore::CachedResourceLoader::notifyFinished):
+    (WebCore:: const):
+    * loader/cache/CachedResourceLoader.h:
+    * page/ChromeClient.h:
+    (WebCore::ChromeClient::scheduleTimedRenderingUpdate):
+    * page/Page.cpp:
+    (WebCore::Page::scheduleTimedRenderingUpdate):
+    (WebCore::Page::updateRendering):
+    * page/Page.h:
+    * platform/graphics/ImageObserver.h:
+    * rendering/RenderElement.cpp:
+    (WebCore::RenderElement::notifyFinished):
+    (WebCore::RenderElement::scheduleTimedRenderingUpdate):
+    * rendering/RenderElement.h:
+    * rendering/RenderImage.cpp:
+    (WebCore::RenderImage::notifyFinished):
+    * svg/graphics/SVGImage.h:
+    * svg/graphics/SVGImageClients.h:
+    
+    LayoutTests:
+    
+    * svg/animations/css-animation-background-svg-expected.html: Added.
+    * svg/animations/css-animation-background-svg.html: Added.
+    * svg/animations/css-animation-embedded-svg-expected.html: Added.
+    * svg/animations/css-animation-embedded-svg.html: Added.
+    * svg/animations/css-animation-hover-svg-expected.html: Added.
+    * svg/animations/css-animation-hover-svg.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-04-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+            REGRESSION: CSS animations inside an embedded SVG image do not animate
+            https://bugs.webkit.org/show_bug.cgi?id=209370
+
+            Reviewed by Simon Fraser.
+
+            * svg/animations/css-animation-background-svg-expected.html: Added.
+            * svg/animations/css-animation-background-svg.html: Added.
+            * svg/animations/css-animation-embedded-svg-expected.html: Added.
+            * svg/animations/css-animation-embedded-svg.html: Added.
+            * svg/animations/css-animation-hover-svg-expected.html: Added.
+            * svg/animations/css-animation-hover-svg.html: Added.
+
+2020-04-10  Alan Coon  <alancoon@apple.com>
+
</ins><span class="cx">         Cherry-pick r259829. rdar://problem/61596883
</span><span class="cx"> 
</span><span class="cx">     Remove legacy X-WebKit-CSP header support
</span></span></pre></div>
<a id="branchessafari609branchLayoutTestssvganimationscssanimationbackgroundsvgexpectedhtml"></a>
<div class="addfile"><h4>Added: branches/safari-609-branch/LayoutTests/svg/animations/css-animation-background-svg-expected.html (0 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/LayoutTests/svg/animations/css-animation-background-svg-expected.html                         (rev 0)
+++ branches/safari-609-branch/LayoutTests/svg/animations/css-animation-background-svg-expected.html    2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<style>
+       div {
+        width: 100px;
+        height: 100px;
+        display: inline-block;
+        background-color: green;
+    }
+</style>
+<body>
+       <div></div>
+</body>
</ins></span></pre></div>
<a id="branchessafari609branchLayoutTestssvganimationscssanimationbackgroundsvghtml"></a>
<div class="addfile"><h4>Added: branches/safari-609-branch/LayoutTests/svg/animations/css-animation-background-svg.html (0 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/LayoutTests/svg/animations/css-animation-background-svg.html                          (rev 0)
+++ branches/safari-609-branch/LayoutTests/svg/animations/css-animation-background-svg.html     2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+<style>
+    .box {
+        width: 100px;
+        height: 100px;
+        background: url("data:image/svg+xml;utf8, \
+            %3Csvg xmlns='http://www.w3.org/2000/svg'%3E \
+                %3Cstyle%3E \
+                    @keyframes fadein { \
+                        from { opacity:0; } \
+                        to { opacity:1; } \
+                    } \
+                    #green { \
+                        animation: fadein 16ms; \
+                    } \
+                %3C/style%3E \
+                %3Crect width='100%' height='100%' fill='red'/%3E \
+                %3Crect id='green' width='100%' height='100%' fill='green'/%3E \
+            %3C/svg%3E");
+    }
+</style>
+<body>
+    <div class="box"></div>
+    <script>
+        window.addEventListener('load', (event) => {
+            if (window.testRunner)
+                testRunner.waitUntilDone();
+
+            var rAFCount = 0;
+            function animate(timestamp) {
+                if (++rAFCount < 10)
+                    window.requestAnimationFrame(animate);
+                else if (window.testRunner)
+                    testRunner.notifyDone();
+            }
+
+            window.requestAnimationFrame(animate);
+        });
+    </script>
+</body>
</ins></span></pre></div>
<a id="branchessafari609branchLayoutTestssvganimationscssanimationembeddedsvgexpectedhtml"></a>
<div class="addfile"><h4>Added: branches/safari-609-branch/LayoutTests/svg/animations/css-animation-embedded-svg-expected.html (0 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/LayoutTests/svg/animations/css-animation-embedded-svg-expected.html                           (rev 0)
+++ branches/safari-609-branch/LayoutTests/svg/animations/css-animation-embedded-svg-expected.html      2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<style>
+       div {
+        width: 100px;
+        height: 100px;
+        display: inline-block;
+        background-color: green;
+    }
+</style>
+<body>
+       <div></div>
+</body>
</ins></span></pre></div>
<a id="branchessafari609branchLayoutTestssvganimationscssanimationembeddedsvghtml"></a>
<div class="addfile"><h4>Added: branches/safari-609-branch/LayoutTests/svg/animations/css-animation-embedded-svg.html (0 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/LayoutTests/svg/animations/css-animation-embedded-svg.html                            (rev 0)
+++ branches/safari-609-branch/LayoutTests/svg/animations/css-animation-embedded-svg.html       2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+<style>
+    img {
+        width: 100px;
+        height: 100px;
+    }
+</style>
+<body>
+    <img src='data:image/svg+xml;utf8,
+        <svg xmlns="http://www.w3.org/2000/svg">
+            <style>
+                @keyframes fadein {
+                    from { opacity:0; }
+                    to { opacity:1; }
+                }
+                #green { 
+                    animation: fadein 16ms;
+                }
+            </style>
+            <rect width="100%" height="100%" fill="red"/>
+            <rect id="green" width="100%" height="100%" fill="green"/>
+        </svg>'>
+    <script>
+        window.addEventListener('load', (event) => {
+            if (window.testRunner)
+                testRunner.waitUntilDone();
+
+            var rAFCount = 0;
+            function animate(timestamp) {
+                if (++rAFCount < 10)
+                    window.requestAnimationFrame(animate);
+                else if (window.testRunner)
+                    testRunner.notifyDone();
+            }
+
+            window.requestAnimationFrame(animate);
+        });
+    </script>
+</body>
</ins></span></pre></div>
<a id="branchessafari609branchLayoutTestssvganimationscssanimationhoversvgexpectedhtml"></a>
<div class="addfile"><h4>Added: branches/safari-609-branch/LayoutTests/svg/animations/css-animation-hover-svg-expected.html (0 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/LayoutTests/svg/animations/css-animation-hover-svg-expected.html                              (rev 0)
+++ branches/safari-609-branch/LayoutTests/svg/animations/css-animation-hover-svg-expected.html 2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<style>
+       div {
+        width: 100px;
+        height: 100px;
+        display: inline-block;
+        background-color: green;
+    }
+</style>
+<body>
+       <div></div>
+</body>
</ins></span></pre></div>
<a id="branchessafari609branchLayoutTestssvganimationscssanimationhoversvghtml"></a>
<div class="addfile"><h4>Added: branches/safari-609-branch/LayoutTests/svg/animations/css-animation-hover-svg.html (0 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/LayoutTests/svg/animations/css-animation-hover-svg.html                               (rev 0)
+++ branches/safari-609-branch/LayoutTests/svg/animations/css-animation-hover-svg.html  2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+<style>
+    .box {
+        width: 100px;
+        height: 100px;
+        background-color: red;
+    }
+    .hover {
+        background: url("data:image/svg+xml;charset=utf8, \
+            %3Csvg xmlns='http://www.w3.org/2000/svg'%3E \
+                %3Cstyle%3E \
+                    @keyframes fadein { \
+                        from { opacity:0; } \
+                        to { opacity:1; } \
+                    } \
+                    #green { \
+                        animation: fadein 16ms; \
+                    } \
+                %3C/style%3E \
+                %3Crect width='100%' height='100%' fill='red'/%3E \
+                %3Crect id='green' width='100%' height='100%' fill='green'/%3E \
+            %3C/svg%3E");
+    }
+</style>
+<body>
+    <div class="box"></div>
+    <script>
+        window.addEventListener('load', (event) => {
+            if (window.testRunner)
+                testRunner.waitUntilDone();
+
+            var rAFCount = 0;
+            function animate(timestamp) {
+                if (++rAFCount < 10)
+                    window.requestAnimationFrame(animate);
+                else if (window.testRunner)
+                    testRunner.notifyDone();
+            }
+
+            var box = document.querySelector(".box");
+            box.classList.add('hover');
+            window.requestAnimationFrame(animate);
+        });
+    </script>
+</body>
</ins></span></pre></div>
<a id="branchessafari609branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/ChangeLog (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/ChangeLog      2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog 2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -1,5 +1,173 @@
</span><span class="cx"> 2020-04-10  Alan Coon  <alancoon@apple.com>
</span><span class="cx"> 
</span><ins>+        Cherry-pick r259830. rdar://problem/61596886
+
+    REGRESSION: CSS animations inside an embedded SVG image do not animate
+    https://bugs.webkit.org/show_bug.cgi?id=209370
+    
+    Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2020-04-09
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    If WebAnimation is enabled and the SVGImage includes CSS animations, the
+    DocumentTimeline is added to the SVGDocument of the embedded SVGImage.
+    Because the SVGImage has its own Page the RenderingUpdate is scheduled
+    and the updateRendering steps run in this Page.
+    
+    The Page of the SVGImage is inactive such that scheduling RenderingUpdate
+    fails; therefore the updateRendering steps never run and the CSS animation
+    never advances.
+    
+    The fix is:
+    
+    1) Scheduling the RenderingUpdate: This has to happen in the Page which
+       contains the renderer of the SVGImage. Because DocumentTimeline is
+       added to SVGDocument, this scheduling will go through these hubs:
+            - DocumentTimeline
+            - Page
+            - ChromeClient -> SVGImageChromeClient
+            - SVGImage
+            - ImageObserver -> CachedImageObserver
+            - CachedImage
+            - CachedImageClient -> RenderElement
+            - Page
+    
+    2) Running the updateRendering steps: Each document in the Page will
+       enumerate its cached SVGImages. The updateRendering of the Page of
+       each SVGImage will be called.
+    
+    To make enumerating the cached SVGImages of a Document faster, the URL
+    of the cached SVGImage will be added to the cachedSVGImagesURLs of
+    CachedResourceLoader when notifyFinished() is called for associated
+    CachedImage.
+    
+    Tests: svg/animations/css-animation-background-svg.html
+           svg/animations/css-animation-embedded-svg.html
+           svg/animations/css-animation-hover-svg.html
+    
+    * animation/DocumentTimeline.cpp:
+    (WebCore::DocumentTimeline::scheduleAnimationResolution):
+    (WebCore::DocumentTimeline::updateAnimationsAndSendEvents):
+    * html/ImageBitmap.cpp:
+    * loader/cache/CachedImage.cpp:
+    (WebCore::CachedImage::hasSVGImage const):
+    (WebCore::CachedImage::CachedImageObserver::scheduleTimedRenderingUpdate):
+    (WebCore::CachedImage::scheduleTimedRenderingUpdate):
+    * loader/cache/CachedImage.h:
+    * loader/cache/CachedImageClient.h:
+    (WebCore::CachedImageClient::scheduleTimedRenderingUpdate):
+    * loader/cache/CachedResourceLoader.cpp:
+    (WebCore::isSVGImageCachedResource):
+    (WebCore::cachedResourceSVGImage):
+    (WebCore::CachedResourceLoader::notifyFinished):
+    (WebCore:: const):
+    * loader/cache/CachedResourceLoader.h:
+    * page/ChromeClient.h:
+    (WebCore::ChromeClient::scheduleTimedRenderingUpdate):
+    * page/Page.cpp:
+    (WebCore::Page::scheduleTimedRenderingUpdate):
+    (WebCore::Page::updateRendering):
+    * page/Page.h:
+    * platform/graphics/ImageObserver.h:
+    * rendering/RenderElement.cpp:
+    (WebCore::RenderElement::notifyFinished):
+    (WebCore::RenderElement::scheduleTimedRenderingUpdate):
+    * rendering/RenderElement.h:
+    * rendering/RenderImage.cpp:
+    (WebCore::RenderImage::notifyFinished):
+    * svg/graphics/SVGImage.h:
+    * svg/graphics/SVGImageClients.h:
+    
+    LayoutTests:
+    
+    * svg/animations/css-animation-background-svg-expected.html: Added.
+    * svg/animations/css-animation-background-svg.html: Added.
+    * svg/animations/css-animation-embedded-svg-expected.html: Added.
+    * svg/animations/css-animation-embedded-svg.html: Added.
+    * svg/animations/css-animation-hover-svg-expected.html: Added.
+    * svg/animations/css-animation-hover-svg.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-04-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
+
+            REGRESSION: CSS animations inside an embedded SVG image do not animate
+            https://bugs.webkit.org/show_bug.cgi?id=209370
+
+            Reviewed by Simon Fraser.
+
+            If WebAnimation is enabled and the SVGImage includes CSS animations, the
+            DocumentTimeline is added to the SVGDocument of the embedded SVGImage.
+            Because the SVGImage has its own Page the RenderingUpdate is scheduled
+            and the updateRendering steps run in this Page.
+
+            The Page of the SVGImage is inactive such that scheduling RenderingUpdate
+            fails; therefore the updateRendering steps never run and the CSS animation
+            never advances.
+
+            The fix is:
+
+            1) Scheduling the RenderingUpdate: This has to happen in the Page which
+               contains the renderer of the SVGImage. Because DocumentTimeline is
+               added to SVGDocument, this scheduling will go through these hubs:
+                    - DocumentTimeline
+                    - Page
+                    - ChromeClient -> SVGImageChromeClient
+                    - SVGImage
+                    - ImageObserver -> CachedImageObserver
+                    - CachedImage
+                    - CachedImageClient -> RenderElement
+                    - Page
+
+            2) Running the updateRendering steps: Each document in the Page will
+               enumerate its cached SVGImages. The updateRendering of the Page of
+               each SVGImage will be called.
+
+            To make enumerating the cached SVGImages of a Document faster, the URL
+            of the cached SVGImage will be added to the cachedSVGImagesURLs of
+            CachedResourceLoader when notifyFinished() is called for associated
+            CachedImage.
+
+            Tests: svg/animations/css-animation-background-svg.html
+                   svg/animations/css-animation-embedded-svg.html
+                   svg/animations/css-animation-hover-svg.html
+
+            * animation/DocumentTimeline.cpp:
+            (WebCore::DocumentTimeline::scheduleAnimationResolution):
+            (WebCore::DocumentTimeline::updateAnimationsAndSendEvents):
+            * html/ImageBitmap.cpp:
+            * loader/cache/CachedImage.cpp:
+            (WebCore::CachedImage::hasSVGImage const):
+            (WebCore::CachedImage::CachedImageObserver::scheduleTimedRenderingUpdate):
+            (WebCore::CachedImage::scheduleTimedRenderingUpdate):
+            * loader/cache/CachedImage.h:
+            * loader/cache/CachedImageClient.h:
+            (WebCore::CachedImageClient::scheduleTimedRenderingUpdate):
+            * loader/cache/CachedResourceLoader.cpp:
+            (WebCore::isSVGImageCachedResource):
+            (WebCore::cachedResourceSVGImage):
+            (WebCore::CachedResourceLoader::notifyFinished):
+            (WebCore:: const):
+            * loader/cache/CachedResourceLoader.h:
+            * page/ChromeClient.h:
+            (WebCore::ChromeClient::scheduleTimedRenderingUpdate):
+            * page/Page.cpp:
+            (WebCore::Page::scheduleTimedRenderingUpdate):
+            (WebCore::Page::updateRendering):
+            * page/Page.h:
+            * platform/graphics/ImageObserver.h:
+            * rendering/RenderElement.cpp:
+            (WebCore::RenderElement::notifyFinished):
+            (WebCore::RenderElement::scheduleTimedRenderingUpdate):
+            * rendering/RenderElement.h:
+            * rendering/RenderImage.cpp:
+            (WebCore::RenderImage::notifyFinished):
+            * svg/graphics/SVGImage.h:
+            * svg/graphics/SVGImageClients.h:
+
+2020-04-10  Alan Coon  <alancoon@apple.com>
+
</ins><span class="cx">         Cherry-pick r259829. rdar://problem/61596883
</span><span class="cx"> 
</span><span class="cx">     Remove legacy X-WebKit-CSP header support
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCoreanimationDocumentTimelinecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/animation/DocumentTimeline.cpp (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/animation/DocumentTimeline.cpp 2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/animation/DocumentTimeline.cpp    2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -332,7 +332,7 @@
</span><span class="cx">     if (!shouldRunUpdateAnimationsAndSendEventsIgnoringSuspensionState())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_document->page()->renderingUpdateScheduler().scheduleTimedRenderingUpdate();
</del><ins>+    m_document->page()->scheduleTimedRenderingUpdate();
</ins><span class="cx">     m_animationResolutionScheduled = true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -357,7 +357,6 @@
</span><span class="cx"> 
</span><span class="cx"> void DocumentTimeline::updateAnimationsAndSendEvents()
</span><span class="cx"> {
</span><del>-
</del><span class="cx">     // Updating animations and sending events may invalidate the timing of some animations, so we must set the m_animationResolutionScheduled
</span><span class="cx">     // flag to false prior to running that procedure to allow animation with timing model updates to schedule updates.
</span><span class="cx">     m_animationResolutionScheduled = false;
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCorehtmlImageBitmapcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/html/ImageBitmap.cpp (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/html/ImageBitmap.cpp   2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/html/ImageBitmap.cpp      2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -528,6 +528,7 @@
</span><span class="cx">     bool canDestroyDecodedData(const Image&) override { return true; }
</span><span class="cx">     void imageFrameAvailable(const Image&, ImageAnimatingState, const IntRect* = nullptr, DecodingStatus = DecodingStatus::Invalid) override { }
</span><span class="cx">     void changedInRect(const Image&, const IntRect* = nullptr) override { }
</span><ins>+    void scheduleTimedRenderingUpdate(const Image&) override { }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     ImageBitmapImageObserver(String mimeType, long long expectedContentLength, const URL& sourceUrl)
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCoreloadercacheCachedImagecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/loader/cache/CachedImage.cpp (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/loader/cache/CachedImage.cpp   2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/loader/cache/CachedImage.cpp      2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -268,6 +268,11 @@
</span><span class="cx">     return m_image.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool CachedImage::hasSVGImage() const
+{
+    return m_image && m_image->isSVGImage();
+}
+
</ins><span class="cx"> void CachedImage::setContainerContextForClient(const CachedImageClient& client, const LayoutSize& containerSize, float containerZoom, const URL& imageURL)
</span><span class="cx"> {
</span><span class="cx">     if (containerSize.isEmpty())
</span><span class="lines">@@ -434,6 +439,12 @@
</span><span class="cx">         cachedImage->changedInRect(image, rect);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void CachedImage::CachedImageObserver::scheduleTimedRenderingUpdate(const Image& image)
+{
+    for (auto cachedImage : m_cachedImages)
+        cachedImage->scheduleTimedRenderingUpdate(image);
+}
+
</ins><span class="cx"> inline void CachedImage::clearImage()
</span><span class="cx"> {
</span><span class="cx">     if (!m_image)
</span><span class="lines">@@ -684,6 +695,16 @@
</span><span class="cx">     notifyObservers(rect);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void CachedImage::scheduleTimedRenderingUpdate(const Image& image)
+{
+    if (&image != m_image)
+        return;
+
+    CachedResourceClientWalker<CachedImageClient> walker(m_clients);
+    while (auto* client = walker.next())
+        client->scheduleTimedRenderingUpdate();
+}
+
</ins><span class="cx"> bool CachedImage::currentFrameKnownToBeOpaque(const RenderElement* renderer)
</span><span class="cx"> {
</span><span class="cx">     Image* image = imageForRenderer(renderer);
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCoreloadercacheCachedImageh"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/loader/cache/CachedImage.h (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/loader/cache/CachedImage.h     2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/loader/cache/CachedImage.h        2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx">     WEBCORE_EXPORT Image* image(); // Returns the nullImage() if the image is not available yet.
</span><span class="cx">     WEBCORE_EXPORT Image* imageForRenderer(const RenderObject*); // Returns the nullImage() if the image is not available yet.
</span><span class="cx">     bool hasImage() const { return m_image.get(); }
</span><ins>+    bool hasSVGImage() const;
</ins><span class="cx">     bool currentFrameKnownToBeOpaque(const RenderElement*);
</span><span class="cx"> 
</span><span class="cx">     std::pair<Image*, float> brokenImage(float deviceScaleFactor) const; // Returns an image and the image's resolution scale factor.
</span><span class="lines">@@ -152,6 +153,7 @@
</span><span class="cx">         bool canDestroyDecodedData(const Image&) final;
</span><span class="cx">         void imageFrameAvailable(const Image&, ImageAnimatingState, const IntRect* changeRect = nullptr, DecodingStatus = DecodingStatus::Invalid) final;
</span><span class="cx">         void changedInRect(const Image&, const IntRect*) final;
</span><ins>+        void scheduleTimedRenderingUpdate(const Image&) final;
</ins><span class="cx"> 
</span><span class="cx">         HashSet<CachedImage*> m_cachedImages;
</span><span class="cx">     };
</span><span class="lines">@@ -162,6 +164,7 @@
</span><span class="cx">     bool canDestroyDecodedData(const Image&);
</span><span class="cx">     void imageFrameAvailable(const Image&, ImageAnimatingState, const IntRect* changeRect = nullptr, DecodingStatus = DecodingStatus::Invalid);
</span><span class="cx">     void changedInRect(const Image&, const IntRect*);
</span><ins>+    void scheduleTimedRenderingUpdate(const Image&);
</ins><span class="cx"> 
</span><span class="cx">     void updateBufferInternal(SharedBuffer&);
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCoreloadercacheCachedImageClienth"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/loader/cache/CachedImageClient.h (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/loader/cache/CachedImageClient.h       2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/loader/cache/CachedImageClient.h  2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -48,6 +48,8 @@
</span><span class="cx">     virtual VisibleInViewportState imageFrameAvailable(CachedImage& image, ImageAnimatingState, const IntRect* changeRect) { imageChanged(&image, changeRect); return VisibleInViewportState::No; }
</span><span class="cx"> 
</span><span class="cx">     virtual void didRemoveCachedImageClient(CachedImage&) { }
</span><ins>+
+    virtual void scheduleTimedRenderingUpdate() { }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCoreloadercacheCachedResourceLoadercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp  2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/loader/cache/CachedResourceLoader.cpp     2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -69,6 +69,7 @@
</span><span class="cx"> #include "ResourceTiming.h"
</span><span class="cx"> #include "RuntimeApplicationChecks.h"
</span><span class="cx"> #include "RuntimeEnabledFeatures.h"
</span><ins>+#include "SVGImage.h"
</ins><span class="cx"> #include "ScriptController.h"
</span><span class="cx"> #include "SecurityOrigin.h"
</span><span class="cx"> #include "SecurityPolicy.h"
</span><span class="lines">@@ -781,6 +782,20 @@
</span><span class="cx">     return FetchOptions::Destination::EmptyString;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline bool isSVGImageCachedResource(const CachedResource* resource)
+{
+    if (!resource || !is<CachedImage>(*resource))
+        return false;
+    return downcast<CachedImage>(*resource).hasSVGImage();
+}
+
+static inline SVGImage* cachedResourceSVGImage(CachedResource* resource)
+{
+    if (!isSVGImageCachedResource(resource))
+        return nullptr;
+    return downcast<SVGImage>(downcast<CachedImage>(*resource).image());
+}
+
</ins><span class="cx"> ResourceErrorOr<CachedResourceHandle<CachedResource>> CachedResourceLoader::requestResource(CachedResource::Type type, CachedResourceRequest&& request, ForPreload forPreload, DeferOption defer)
</span><span class="cx"> {
</span><span class="cx">     if (!frame() || !frame()->page()) {
</span><span class="lines">@@ -1385,6 +1400,25 @@
</span><span class="cx">     ASSERT(m_requestCount > -1);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void CachedResourceLoader::notifyFinished(const CachedResource& resource)
+{
+    if (isSVGImageCachedResource(&resource))
+        m_cachedSVGImagesURLs.add(resource.url());
+}
+
+Vector<Ref<SVGImage>> CachedResourceLoader::allCachedSVGImages() const
+{
+    Vector<Ref<SVGImage>> allCachedSVGImages;
+
+    for (auto& cachedSVGImageURL : m_cachedSVGImagesURLs) {
+        auto* resource = cachedResource(cachedSVGImageURL);
+        if (auto* image = cachedResourceSVGImage(resource))
+            allCachedSVGImages.append(*image);
+    }
+        
+    return allCachedSVGImages;
+}
+
</ins><span class="cx"> ResourceErrorOr<CachedResourceHandle<CachedResource>> CachedResourceLoader::preload(CachedResource::Type type, CachedResourceRequest&& request)
</span><span class="cx"> {
</span><span class="cx">     if (InspectorInstrumentation::willInterceptRequest(frame(), request.resourceRequest()))
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCoreloadercacheCachedResourceLoaderh"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/loader/cache/CachedResourceLoader.h (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/loader/cache/CachedResourceLoader.h    2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/loader/cache/CachedResourceLoader.h       2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -57,6 +57,7 @@
</span><span class="cx"> class Frame;
</span><span class="cx"> class ImageLoader;
</span><span class="cx"> class Page;
</span><ins>+class SVGImage;
</ins><span class="cx"> class Settings;
</span><span class="cx"> 
</span><span class="cx"> template <typename T>
</span><span class="lines">@@ -114,6 +115,9 @@
</span><span class="cx">     typedef HashMap<String, CachedResourceHandle<CachedResource>> DocumentResourceMap;
</span><span class="cx">     const DocumentResourceMap& allCachedResources() const { return m_documentResources; }
</span><span class="cx"> 
</span><ins>+    void notifyFinished(const CachedResource&);
+    Vector<Ref<SVGImage>> allCachedSVGImages() const;
+
</ins><span class="cx">     bool autoLoadImages() const { return m_autoLoadImages; }
</span><span class="cx">     void setAutoLoadImages(bool);
</span><span class="cx"> 
</span><span class="lines">@@ -192,6 +196,7 @@
</span><span class="cx">     bool canRequestInContentDispositionAttachmentSandbox(CachedResource::Type, const URL&) const;
</span><span class="cx"> 
</span><span class="cx">     HashSet<String> m_validatedURLs;
</span><ins>+    HashSet<String> m_cachedSVGImagesURLs;
</ins><span class="cx">     mutable DocumentResourceMap m_documentResources;
</span><span class="cx">     WeakPtr<Document> m_document;
</span><span class="cx">     DocumentLoader* m_documentLoader;
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCorepageChromeClienth"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/page/ChromeClient.h (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/page/ChromeClient.h    2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/page/ChromeClient.h       2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -314,6 +314,7 @@
</span><span class="cx">     // Sets a flag to specify that the view needs to be updated, so we need
</span><span class="cx">     // to do an eager layout before the drawing.
</span><span class="cx">     virtual void scheduleCompositingLayerFlush() = 0;
</span><ins>+    virtual bool scheduleTimedRenderingUpdate() { return false; }
</ins><span class="cx">     virtual bool needsImmediateRenderingUpdate() const { return false; }
</span><span class="cx">     // Returns whether or not the client can render the composited layer,
</span><span class="cx">     // regardless of the settings.
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/page/Page.cpp (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/page/Page.cpp  2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/page/Page.cpp     2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include "BackForwardController.h"
</span><span class="cx"> #include "CSSAnimationController.h"
</span><span class="cx"> #include "CacheStorageProvider.h"
</span><ins>+#include "CachedResourceLoader.h"
</ins><span class="cx"> #include "Chrome.h"
</span><span class="cx"> #include "ChromeClient.h"
</span><span class="cx"> #include "ConstantPropertyMap.h"
</span><span class="lines">@@ -103,6 +104,7 @@
</span><span class="cx"> #include "ResourceUsageOverlay.h"
</span><span class="cx"> #include "RuntimeEnabledFeatures.h"
</span><span class="cx"> #include "SVGDocumentExtensions.h"
</span><ins>+#include "SVGImage.h"
</ins><span class="cx"> #include "ScriptController.h"
</span><span class="cx"> #include "ScriptedAnimationController.h"
</span><span class="cx"> #include "ScrollLatchingState.h"
</span><span class="lines">@@ -1295,6 +1297,13 @@
</span><span class="cx">         view->updateLayoutAndStyleIfNeededRecursive();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Page::scheduleTimedRenderingUpdate()
+{
+    if (chrome().client().scheduleTimedRenderingUpdate())
+        return;
+    renderingUpdateScheduler().scheduleTimedRenderingUpdate();
+}
+
</ins><span class="cx"> // https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering
</span><span class="cx"> void Page::updateRendering()
</span><span class="cx"> {
</span><span class="lines">@@ -1345,6 +1354,13 @@
</span><span class="cx">     });
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    forEachDocument([] (Document& document) {
+        for (auto& image : document.cachedResourceLoader().allCachedSVGImages()) {
+            if (auto* page = image->internalPage())
+                page->updateRendering();
+        }
+    });
+
</ins><span class="cx">     layoutIfNeeded();
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCorepagePageh"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/page/Page.h (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/page/Page.h    2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/page/Page.h       2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -469,6 +469,8 @@
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void layoutIfNeeded();
</span><span class="cx">     WEBCORE_EXPORT void updateRendering();
</span><ins>+    
+    void scheduleTimedRenderingUpdate();
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void suspendScriptedAnimations();
</span><span class="cx">     WEBCORE_EXPORT void resumeScriptedAnimations();
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCoreplatformgraphicsImageObserverh"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/platform/graphics/ImageObserver.h (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/platform/graphics/ImageObserver.h      2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/platform/graphics/ImageObserver.h 2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx">     virtual bool canDestroyDecodedData(const Image&) = 0;
</span><span class="cx">     virtual void imageFrameAvailable(const Image&, ImageAnimatingState, const IntRect* changeRect = nullptr, DecodingStatus = DecodingStatus::Invalid) = 0;
</span><span class="cx">     virtual void changedInRect(const Image&, const IntRect* changeRect = nullptr) = 0;
</span><ins>+    virtual void scheduleTimedRenderingUpdate(const Image&) = 0;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCorerenderingRenderElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/rendering/RenderElement.cpp (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/rendering/RenderElement.cpp    2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/rendering/RenderElement.cpp       2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include "RenderElement.h"
</span><span class="cx"> 
</span><span class="cx"> #include "AXObjectCache.h"
</span><ins>+#include "CachedResourceLoader.h"
</ins><span class="cx"> #if PLATFORM(IOS_FAMILY)
</span><span class="cx"> #include "ContentChangeObserver.h"
</span><span class="cx"> #endif
</span><span class="lines">@@ -1320,6 +1321,11 @@
</span><span class="cx">     return isVisible ? VisibleInViewportState::Yes : VisibleInViewportState::No;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderElement::notifyFinished(CachedResource& resource)
+{
+    document().cachedResourceLoader().notifyFinished(resource);
+}
+
</ins><span class="cx"> void RenderElement::didRemoveCachedImageClient(CachedImage& cachedImage)
</span><span class="cx"> {
</span><span class="cx">     if (hasPausedImageAnimations())
</span><span class="lines">@@ -1326,6 +1332,12 @@
</span><span class="cx">         view().removeRendererWithPausedImageAnimations(*this, cachedImage);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderElement::scheduleTimedRenderingUpdate()
+{
+    if (auto* page = document().page())
+        page->scheduleTimedRenderingUpdate();
+}
+
</ins><span class="cx"> bool RenderElement::repaintForPausedImageAnimationsIfNeeded(const IntRect& visibleRect, CachedImage& cachedImage)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_hasPausedImageAnimations);
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCorerenderingRenderElementh"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/rendering/RenderElement.h (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/rendering/RenderElement.h      2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/rendering/RenderElement.h 2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -262,6 +262,7 @@
</span><span class="cx">     void insertedIntoTree() override;
</span><span class="cx">     void willBeRemovedFromTree() override;
</span><span class="cx">     void willBeDestroyed() override;
</span><ins>+    void notifyFinished(CachedResource&) override;
</ins><span class="cx"> 
</span><span class="cx">     void setRenderInlineAlwaysCreatesLineBoxes(bool b) { m_renderInlineAlwaysCreatesLineBoxes = b; }
</span><span class="cx">     bool renderInlineAlwaysCreatesLineBoxes() const { return m_renderInlineAlwaysCreatesLineBoxes; }
</span><span class="lines">@@ -319,6 +320,7 @@
</span><span class="cx">     bool canDestroyDecodedData() final { return !isVisibleInViewport(); }
</span><span class="cx">     VisibleInViewportState imageFrameAvailable(CachedImage&, ImageAnimatingState, const IntRect* changeRect) final;
</span><span class="cx">     void didRemoveCachedImageClient(CachedImage&) final;
</span><ins>+    void scheduleTimedRenderingUpdate() final;
</ins><span class="cx"> 
</span><span class="cx">     bool getLeadingCorner(FloatPoint& output, bool& insideFixed) const;
</span><span class="cx">     bool getTrailingCorner(FloatPoint& output, bool& insideFixed) const;
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCorerenderingRenderImagecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/rendering/RenderImage.cpp (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/rendering/RenderImage.cpp      2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/rendering/RenderImage.cpp 2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -376,6 +376,8 @@
</span><span class="cx"> 
</span><span class="cx">     if (is<HTMLImageElement>(element()))
</span><span class="cx">         page().didFinishLoadingImageForElement(downcast<HTMLImageElement>(*element()));
</span><ins>+
+    RenderReplaced::notifyFinished(newImage);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderImage::setImageDevicePixelRatio(float factor)
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCoresvggraphicsSVGImageh"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/svg/graphics/SVGImage.h (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/svg/graphics/SVGImage.h        2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/svg/graphics/SVGImage.h   2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -68,6 +68,8 @@
</span><span class="cx"> #if USE(DIRECT2D)
</span><span class="cx">     NativeImagePtr nativeImage(const GraphicsContext* = nullptr) final;
</span><span class="cx"> #endif
</span><ins>+    
+    Page* internalPage() { return m_page.get(); }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     friend class SVGImageChromeClient;
</span></span></pre></div>
<a id="branchessafari609branchSourceWebCoresvggraphicsSVGImageClientsh"></a>
<div class="modfile"><h4>Modified: branches/safari-609-branch/Source/WebCore/svg/graphics/SVGImageClients.h (259902 => 259903)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-609-branch/Source/WebCore/svg/graphics/SVGImageClients.h 2020-04-10 21:23:42 UTC (rev 259902)
+++ branches/safari-609-branch/Source/WebCore/svg/graphics/SVGImageClients.h    2020-04-10 21:23:50 UTC (rev 259903)
</span><span class="lines">@@ -62,7 +62,14 @@
</span><span class="cx"> 
</span><span class="cx">         imageObserver->imageFrameAvailable(*m_image, m_image->isAnimating() ? ImageAnimatingState::Yes : ImageAnimatingState::No, &r);
</span><span class="cx">     }
</span><del>-    
</del><ins>+
+    bool scheduleTimedRenderingUpdate() final
+    {
+        if (m_image && m_image->imageObserver())
+            m_image->imageObserver()->scheduleTimedRenderingUpdate(*m_image);
+        return true;
+    }
+
</ins><span class="cx">     SVGImage* m_image;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>