<!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>[177927] 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/177927">177927</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-01-05 13:44:32 -0800 (Mon, 05 Jan 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Regression(<a href="http://trac.webkit.org/projects/webkit/changeset/163928">r163928</a>): Animated images are not resumed on window resizing
https://bugs.webkit.org/show_bug.cgi?id=139714
&lt;rdar://problem/18855285&gt;

Reviewed by Darin Adler.

Source/WebCore:

After <a href="http://trac.webkit.org/projects/webkit/changeset/163928">r163928</a>, animated images were not resumed if they became visible
after resizing the window. This patch calls resumes animated images if
necessary in FrameView::setFrameRect() to handle this case properly.

Tests: fast/images/animated-gif-window-resizing.html
       fast/images/animated-gif-zooming.html

* page/FrameView.cpp:
(WebCore::FrameView::setFrameRect):

LayoutTests:

Add a layout test to make sure animated images are correctly paused /
resumed when resizing the window.

Also add another test to make sure animated images are correctly paused
/ resumed when zooming in and out.

* fast/images/animated-gif-window-resizing-expected.txt: Added.
* fast/images/animated-gif-window-resizing.html: Added.
* fast/images/animated-gif-zooming-expected.txt: Added.
* fast/images/animated-gif-zooming.html: Added.
* fast/images/resources/animated-gif-window-resize.html: Added.
* platform/mac-wk1/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk1TestExpectations">trunk/LayoutTests/platform/mac-wk1/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastimagesanimatedgifwindowresizingexpectedtxt">trunk/LayoutTests/fast/images/animated-gif-window-resizing-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastimagesanimatedgifwindowresizinghtml">trunk/LayoutTests/fast/images/animated-gif-window-resizing.html</a></li>
<li><a href="#trunkLayoutTestsfastimagesanimatedgifzoomingexpectedtxt">trunk/LayoutTests/fast/images/animated-gif-zooming-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastimagesanimatedgifzoominghtml">trunk/LayoutTests/fast/images/animated-gif-zooming.html</a></li>
<li><a href="#trunkLayoutTestsfastimagesresourcesanimatedgifwindowresizehtml">trunk/LayoutTests/fast/images/resources/animated-gif-window-resize.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (177926 => 177927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-01-05 21:32:35 UTC (rev 177926)
+++ trunk/LayoutTests/ChangeLog        2015-01-05 21:44:32 UTC (rev 177927)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2015-01-05  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Regression(r163928): Animated images are not resumed on window resizing
+        https://bugs.webkit.org/show_bug.cgi?id=139714
+        &lt;rdar://problem/18855285&gt;
+
+        Reviewed by Darin Adler.
+
+        Add a layout test to make sure animated images are correctly paused /
+        resumed when resizing the window.
+
+        Also add another test to make sure animated images are correctly paused
+        / resumed when zooming in and out.
+
+        * fast/images/animated-gif-window-resizing-expected.txt: Added.
+        * fast/images/animated-gif-window-resizing.html: Added.
+        * fast/images/animated-gif-zooming-expected.txt: Added.
+        * fast/images/animated-gif-zooming.html: Added.
+        * fast/images/resources/animated-gif-window-resize.html: Added.
+        * platform/mac-wk1/TestExpectations:
+
</ins><span class="cx"> 2015-01-05  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         After updating tests to use kerning, ligatures, and printer fonts, some tests fail
</span></span></pre></div>
<a id="trunkLayoutTestsfastimagesanimatedgifwindowresizingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/animated-gif-window-resizing-expected.txt (0 => 177927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/animated-gif-window-resizing-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/images/animated-gif-window-resizing-expected.txt        2015-01-05 21:44:32 UTC (rev 177927)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+Test that animated images are properly stopped / resumed on window resizing.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+The animated GIF should initially be outside the viewport.
+PASS isImagePaused() became true
+Resize window so that the image is now inside the viewport.
+PASS isImagePaused() became false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesanimatedgifwindowresizinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/animated-gif-window-resizing.html (0 => 177927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/animated-gif-window-resizing.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/animated-gif-window-resizing.html        2015-01-05 21:44:32 UTC (rev 177927)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;script&gt;
+description(&quot;Test that animated images are properly stopped / resumed on window resizing.&quot;);
+jsTestIsAsync = true;
+
+var testWindow;
+
+function isImagePaused()
+{
+  return internals.hasPausedImageAnimations(testWindow.document.getElementById(&quot;testImage&quot;));
+}
+
+function enlargeWindow()
+{
+  debug(&quot;Resize window so that the image is now inside the viewport.&quot;);
+  testWindow.resizeTo(500, 500);
+  shouldBecomeEqual(&quot;isImagePaused()&quot;, &quot;false&quot;, finishJSTest);
+}
+
+function windowLoaded()
+{
+  debug(&quot;The animated GIF should initially be outside the viewport.&quot;);
+  shouldBecomeEqual(&quot;isImagePaused()&quot;, &quot;true&quot;, enlargeWindow);
+}
+
+function runTest()
+{
+  if (window.testRunner)
+    testRunner.setCanOpenWindows();
+
+  testWindow = window.open(&quot;resources/animated-gif-window-resize.html&quot;, &quot;testWindow&quot;, &quot;width=200, height=200&quot;);
+  testWindow.onload = windowLoaded;
+}
+
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesanimatedgifzoomingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/animated-gif-zooming-expected.txt (0 => 177927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/animated-gif-zooming-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/images/animated-gif-zooming-expected.txt        2015-01-05 21:44:32 UTC (rev 177927)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Make sure that animated images are properly stopped / resumed when zooming in or out.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS isImageAnimated() became false
+Zoom out so that the image becomes visible.
+PASS isImageAnimated() became true
+Zoom in so that the image is no longer visible.
+PASS isImageAnimated() became false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesanimatedgifzoominghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/animated-gif-zooming.html (0 => 177927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/animated-gif-zooming.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/animated-gif-zooming.html        2015-01-05 21:44:32 UTC (rev 177927)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;div style=&quot;position: relative; width: 1600px; height: 2400px; background-color: green;&quot;&gt;
+  &lt;div style=&quot;position:absolute; left: 600px; top: 800px;&quot;&gt;&lt;img src=&quot;resources/animated.gif&quot; id=&quot;testImage&quot;/&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;script&gt;
+description(&quot;Make sure that animated images are properly stopped / resumed when zooming in or out.&quot;);
+jsTestIsAsync = true;
+
+function isImageAnimated()
+{
+  return !internals.hasPausedImageAnimations(document.getElementById(&quot;testImage&quot;));
+}
+
+function zoomIn() {
+  debug(&quot;Zoom in so that the image is no longer visible.&quot;);
+  for (var i = 0; i &lt; 5; ++i)
+    window.eventSender.zoomPageIn();
+
+  shouldBecomeEqual(&quot;isImageAnimated()&quot;, &quot;false&quot;, finishJSTest);
+}
+
+function zoomOut() {
+  debug(&quot;Zoom out so that the image becomes visible.&quot;);
+
+  for (var i = 0; i &lt; 5; ++i)
+    window.eventSender.zoomPageOut();
+
+  shouldBecomeEqual(&quot;isImageAnimated()&quot;, &quot;true&quot;, zoomIn);
+}
+
+function imageLoaded() {
+  shouldBecomeEqual(&quot;isImageAnimated()&quot;, &quot;false&quot;, zoomOut);
+}
+
+function runTest() {
+  if (!window.internals)
+    return;
+
+  var img = new Image();
+  // Make sure the image is loaded before we check if it is animated.
+  img.onload = imageLoaded;
+  img.src = &quot;resources/animated.gif&quot;;
+}
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesresourcesanimatedgifwindowresizehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/resources/animated-gif-window-resize.html (0 => 177927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/resources/animated-gif-window-resize.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/resources/animated-gif-window-resize.html        2015-01-05 21:44:32 UTC (rev 177927)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;img src=&quot;animated.gif&quot; id=&quot;testImage&quot; style=&quot;position: absolute; left: 250px; top: 250px;&quot;/&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (177926 => 177927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/TestExpectations        2015-01-05 21:32:35 UTC (rev 177926)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations        2015-01-05 21:44:32 UTC (rev 177927)
</span><span class="lines">@@ -28,8 +28,6 @@
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/112533 media/auto-play-in-sandbox-with-allow-scripts.html [ Pass Timeout ]
</span><span class="cx"> 
</span><del>-webkit.org/b/139599 fast/images/animated-gif-body-outside-viewport.html [ Pass Failure Timeout ]
-
</del><span class="cx"> webkit.org/b/139778 fullscreen/exit-full-screen-iframe.html [ Skip ]
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/139862 editing/spelling/grammar-edit-word.html [ Skip ]
</span><span class="lines">@@ -66,6 +64,11 @@
</span><span class="cx"> # Disable snapshotting tests on WK1 only
</span><span class="cx"> plugins/snapshotting
</span><span class="cx"> 
</span><ins>+# Animated image throttling behaves differently on WK1.
+fast/images/animated-gif-body-outside-viewport.html [ Skip ]
+fast/images/animated-gif-window-resizing.html [ Skip ]
+fast/images/animated-gif-zooming.html [ Skip ]
+
</ins><span class="cx"> # Mavericks and prior do not support contentInset
</span><span class="cx"> [ MountainLion Mavericks ] platform/mac/fast/events/content-inset-hit-testing.html [ Skip ]
</span><span class="cx"> [ MountainLion Mavericks ] platform/mac/fast/events/content-inset-hit-testing-in-frame.html [ Skip ]
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (177926 => 177927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-01-05 21:32:35 UTC (rev 177926)
+++ trunk/Source/WebCore/ChangeLog        2015-01-05 21:44:32 UTC (rev 177927)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-01-05  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Regression(r163928): Animated images are not resumed on window resizing
+        https://bugs.webkit.org/show_bug.cgi?id=139714
+        &lt;rdar://problem/18855285&gt;
+
+        Reviewed by Darin Adler.
+
+        After r163928, animated images were not resumed if they became visible
+        after resizing the window. This patch calls resumes animated images if
+        necessary in FrameView::setFrameRect() to handle this case properly.
+
+        Tests: fast/images/animated-gif-window-resizing.html
+               fast/images/animated-gif-zooming.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::setFrameRect):
+
</ins><span class="cx"> 2015-01-01  Brian J. Burg  &lt;burg@cs.washington.edu&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: pass parameters to inspector instrumentation by reference where possible
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (177926 => 177927)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2015-01-05 21:32:35 UTC (rev 177926)
+++ trunk/Source/WebCore/page/FrameView.cpp        2015-01-05 21:44:32 UTC (rev 177927)
</span><span class="lines">@@ -458,6 +458,9 @@
</span><span class="cx"> 
</span><span class="cx">     if (frame().isMainFrame())
</span><span class="cx">         frame().mainFrame().pageOverlayController().didChangeViewSize();
</span><ins>+
+    // The frame view was resized, check if we should resume animated images.
+    resumeVisibleImageAnimationsIncludingSubframes();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(REQUEST_ANIMATION_FRAME)
</span></span></pre>
</div>
</div>

</body>
</html>