<!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>[185310] 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/185310">185310</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2015-06-07 19:39:15 -0700 (Sun, 07 Jun 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION (<a href="http://trac.webkit.org/projects/webkit/changeset/181720">r181720</a>): Unnecessary layout triggered any time animated GIF advances to a new frame
https://bugs.webkit.org/show_bug.cgi?id=145733

Reviewed by Andreas Kling.

Source/WebCore:

Test: fast/images/animated-gif-no-layout.html

* rendering/RenderImage.cpp:
(WebCore::RenderImage::styleDidChange): Correctly pass ImageSizeChangeNone in cases
where we don't need to report a change in intrinsic size that happened outside the
repaintOrMarkForLayout function.
(WebCore::RenderImage::repaintOrMarkForLayout): Move work that should only be done
when size changed inside the if statement.

* testing/Internals.cpp:
(WebCore::Internals::layoutCount): Added.
* testing/Internals.h: Added layoutCount.
* testing/Internals.idl: Ditto.

LayoutTests:

* TestExpectations: Expect image failures on the animated GIF tests (the one
old one I am fixing and the one new one I am adding) because they don't yet work
under DumpRenderTree.

* fast/images/animated-gif-no-layout-expected.html: Added.
* fast/images/animated-gif-no-layout.html: Added.

* fast/images/gif-loop-count-expected.html: Added. This test was worthless as a render
tree dump test, and only valuable as a pixel test. And that hid the fact that it was
failing under WebKit1. Changing it to a reference test makes it a valuable test again.
* fast/images/gif-loop-count-expected.png: Removed.
* fast/images/gif-loop-count-expected.txt: Removed.

* platform/wk2/TestExpectations: Expect successes on these two tests.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwk2TestExpectations">trunk/LayoutTests/platform/wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderImagecpp">trunk/Source/WebCore/rendering/RenderImage.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsh">trunk/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsidl">trunk/Source/WebCore/testing/Internals.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastimagesanimatedgifnolayoutexpectedhtml">trunk/LayoutTests/fast/images/animated-gif-no-layout-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastimagesanimatedgifnolayouthtml">trunk/LayoutTests/fast/images/animated-gif-no-layout.html</a></li>
<li><a href="#trunkLayoutTestsfastimagesgifloopcountexpectedhtml">trunk/LayoutTests/fast/images/gif-loop-count-expected.html</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastimagesgifloopcountexpectedpng">trunk/LayoutTests/fast/images/gif-loop-count-expected.png</a></li>
<li><a href="#trunkLayoutTestsfastimagesgifloopcountexpectedtxt">trunk/LayoutTests/fast/images/gif-loop-count-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (185309 => 185310)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-06-08 01:39:35 UTC (rev 185309)
+++ trunk/LayoutTests/ChangeLog        2015-06-08 02:39:15 UTC (rev 185310)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2015-06-07  Darin Adler  &lt;darin@apple.com&gt;
+
+        REGRESSION (r181720): Unnecessary layout triggered any time animated GIF advances to a new frame
+        https://bugs.webkit.org/show_bug.cgi?id=145733
+
+        Reviewed by Andreas Kling.
+
+        * TestExpectations: Expect image failures on the animated GIF tests (the one
+        old one I am fixing and the one new one I am adding) because they don't yet work
+        under DumpRenderTree.
+
+        * fast/images/animated-gif-no-layout-expected.html: Added.
+        * fast/images/animated-gif-no-layout.html: Added.
+
+        * fast/images/gif-loop-count-expected.html: Added. This test was worthless as a render
+        tree dump test, and only valuable as a pixel test. And that hid the fact that it was
+        failing under WebKit1. Changing it to a reference test makes it a valuable test again.
+        * fast/images/gif-loop-count-expected.png: Removed.
+        * fast/images/gif-loop-count-expected.txt: Removed.
+
+        * platform/wk2/TestExpectations: Expect successes on these two tests.
+
</ins><span class="cx"> 2015-06-06  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Clean up tests for blocking mixed content
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (185309 => 185310)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2015-06-08 01:39:35 UTC (rev 185309)
+++ trunk/LayoutTests/TestExpectations        2015-06-08 02:39:15 UTC (rev 185310)
</span><span class="lines">@@ -546,3 +546,6 @@
</span><span class="cx"> webkit.org/b/145090 inspector/debugger/break-on-uncaught-exception-throw-in-promise-rethrow-in-catch.html [ Skip ]
</span><span class="cx"> webkit.org/b/145090 inspector/debugger/break-on-uncaught-exception-window-onerror.html [ Skip ]
</span><span class="cx"> 
</span><ins>+# DumpRenderTree does not allow GIFs to animate, thus animated GIF tests don't work in WebKit1.
+fast/images/animated-gif-no-layout.html [ ImageOnlyFailure ]
+fast/images/gif-loop-count.html [ ImageOnlyFailure ]
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesanimatedgifnolayoutexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/animated-gif-no-layout-expected.html (0 => 185310)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/animated-gif-no-layout-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/animated-gif-no-layout-expected.html        2015-06-08 02:39:15 UTC (rev 185310)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+&lt;div style=&quot;position:absolute;left:0;top:0;width:100;height:100;background-color:#21B14D&quot;&gt;&lt;/div&gt;
+&lt;img src=&quot;resources/rgb-jpeg-green.jpg&quot; style=&quot;position:absolute;left:0;top:150&quot;&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesanimatedgifnolayouthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/animated-gif-no-layout.html (0 => 185310)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/animated-gif-no-layout.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/animated-gif-no-layout.html        2015-06-08 02:39:15 UTC (rev 185310)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+&lt;script&gt;
+    // This test waits for a GIF repaint and double checks that there is a repaint only,
+    // no layout. If the test passes, there are two green squares. If it fails, then one
+    // or both of the squares is red instead.
+
+    var layoutCountBeforeTimer;
+
+    function animationComplete()
+    {
+        document.body.offsetWidth; // Explicitly trigger a layout.
+
+        if (window.internals &amp;&amp; window.testRunner) {
+            var count = internals.layoutCount - layoutCountBeforeTimer;
+            if (count == 0) {
+                var indicator = document.getElementById(&quot;indicator&quot;);
+                indicator.addEventListener(&quot;load&quot;, function() { testRunner.notifyDone(); })
+                indicator.src = &quot;resources/rgb-jpeg-green.jpg&quot;;
+                return;
+            }
+            testRunner.notifyDone();
+        }
+    }
+
+    function test()
+    {
+        document.body.offsetWidth; // Explicitly trigger a layout.
+
+        if (window.internals &amp;&amp; window.testRunner) {
+            testRunner.waitUntilDone();
+            layoutCountBeforeTimer = internals.layoutCount;
+        }
+
+        // The 200ms value here is longer than the time it takes for gif-loop-count.gif
+        // to advance from its first frame to its second. There should be no race because
+        // the GIF timer should already be scheduled and this timer should share the
+        // same time base.
+        setTimeout(animationComplete, 200);
+    }
+&lt;/script&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;img src=&quot;resources/gif-loop-count.gif&quot; style=&quot;position:absolute;left:0;top:0&quot;&gt;
+&lt;img id=&quot;indicator&quot; src=&quot;resources/rgb-jpeg-red.jpg&quot; style=&quot;position:absolute;left:0;top:150&quot;&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesgifloopcountexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/images/gif-loop-count-expected.html (0 => 185310)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/gif-loop-count-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/images/gif-loop-count-expected.html        2015-06-08 02:39:15 UTC (rev 185310)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+&lt;div style=&quot;position:absolute;left:0;top:0;width:100;height:100;background-color:#21B14D&quot;&gt;&lt;/div&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastimagesgifloopcountexpectedpng"></a>
<div class="binary"><h4>Deleted: trunk/LayoutTests/fast/images/gif-loop-count-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestsfastimagesgifloopcountexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/images/gif-loop-count-expected.txt (185309 => 185310)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/images/gif-loop-count-expected.txt        2015-06-08 01:39:35 UTC (rev 185309)
+++ trunk/LayoutTests/fast/images/gif-loop-count-expected.txt        2015-06-08 02:39:15 UTC (rev 185310)
</span><span class="lines">@@ -1,9 +0,0 @@
</span><del>-layer at (0,0) size 800x600
-  RenderView at (0,0) size 800x600
-layer at (0,0) size 800x600
-  RenderBlock {HTML} at (0,0) size 800x600
-    RenderBody {BODY} at (8,8) size 784x584
-layer at (0,0) size 100x100
-  RenderImage {IMG} at (0,0) size 100x100
-layer at (0,0) size 100x100
-  RenderImage {IMG} at (0,0) size 100x100
</del></span></pre></div>
<a id="trunkLayoutTestsplatformwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/wk2/TestExpectations (185309 => 185310)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/wk2/TestExpectations        2015-06-08 01:39:35 UTC (rev 185309)
+++ trunk/LayoutTests/platform/wk2/TestExpectations        2015-06-08 02:39:15 UTC (rev 185310)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> ### (2) Classified failures without bug reports (yet)
</span><span class="cx"> ### (3) Unclassified failures
</span><span class="cx"> ### (4) Features that are not supported in WebKit2 and likely never will be
</span><ins>+### (5) Progressions, expected successes that are expected failures in WebKit1.
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> ########################################
</span><span class="lines">@@ -680,7 +681,16 @@
</span><span class="cx"> ### END OF (4) Features that are not supported in WebKit2 and likely never will be
</span><span class="cx"> ########################################
</span><span class="cx"> 
</span><ins>+########################################
+### START OF (5) Progressions, expected successes that are expected failures in WebKit1.
</ins><span class="cx"> 
</span><ins>+# DumpRenderTree does not allow GIFs to animate, thus animated GIF tests don't work in WebKit1.
+fast/images/animated-gif-no-layout.html [ Pass ]
+fast/images/gif-loop-count.html [ Pass ]
+
+### END OF (5) Progressions, expected successes that are expected failures in WebKit1.
+########################################
+
</ins><span class="cx"> ###### This file has four sections. When adding new tests, make sure to
</span><span class="cx"> ###### add to the right section:
</span><span class="cx"> 
</span><span class="lines">@@ -688,3 +698,4 @@
</span><span class="cx"> ### (2) Classified failures without bug reports (yet)
</span><span class="cx"> ### (3) Unclassified failures
</span><span class="cx"> ### (4) Features that are not supported in WebKit2 and likely never will be
</span><ins>+### (5) Progressions, expected successes that are expected failures in WebKit1.
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (185309 => 185310)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-06-08 01:39:35 UTC (rev 185309)
+++ trunk/Source/WebCore/ChangeLog        2015-06-08 02:39:15 UTC (rev 185310)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2015-06-07  Darin Adler  &lt;darin@apple.com&gt;
+
+        REGRESSION (r181720): Unnecessary layout triggered any time animated GIF advances to a new frame
+        https://bugs.webkit.org/show_bug.cgi?id=145733
+
+        Reviewed by Andreas Kling.
+
+        Test: fast/images/animated-gif-no-layout.html
+
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::styleDidChange): Correctly pass ImageSizeChangeNone in cases
+        where we don't need to report a change in intrinsic size that happened outside the
+        repaintOrMarkForLayout function.
+        (WebCore::RenderImage::repaintOrMarkForLayout): Move work that should only be done
+        when size changed inside the if statement.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::layoutCount): Added.
+        * testing/Internals.h: Added layoutCount.
+        * testing/Internals.idl: Ditto.
+
</ins><span class="cx"> 2015-06-07  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix strncpy use in WebCore::Text::formatForDebugger
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (185309 => 185310)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderImage.cpp        2015-06-08 01:39:35 UTC (rev 185309)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp        2015-06-08 02:39:15 UTC (rev 185310)
</span><span class="lines">@@ -214,7 +214,7 @@
</span><span class="cx">     }
</span><span class="cx"> #if ENABLE(CSS_IMAGE_ORIENTATION)
</span><span class="cx">     if (diff == StyleDifferenceLayout &amp;&amp; oldStyle-&gt;imageOrientation() != style().imageOrientation())
</span><del>-        return repaintOrMarkForLayout(ImageSizeChangeForAltText);
</del><ins>+        return repaintOrMarkForLayout(ImageSizeChangeNone);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_IMAGE_RESOLUTION)
</span><span class="lines">@@ -222,7 +222,7 @@
</span><span class="cx">         &amp;&amp; (oldStyle-&gt;imageResolution() != style().imageResolution()
</span><span class="cx">             || oldStyle-&gt;imageResolutionSnap() != style().imageResolutionSnap()
</span><span class="cx">             || oldStyle-&gt;imageResolutionSource() != style().imageResolutionSource()))
</span><del>-        repaintOrMarkForLayout(ImageSizeChangeForAltText);
</del><ins>+        repaintOrMarkForLayout(ImageSizeChangeNone);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -304,26 +304,28 @@
</span><span class="cx"> 
</span><span class="cx">     bool imageSourceHasChangedSize = oldIntrinsicSize != newIntrinsicSize || imageSizeChange != ImageSizeChangeNone;
</span><span class="cx"> 
</span><del>-    if (imageSourceHasChangedSize)
</del><ins>+    if (imageSourceHasChangedSize) {
</ins><span class="cx">         setPreferredLogicalWidthsDirty(true);
</span><span class="cx"> 
</span><del>-    // If the actual area occupied by the image has changed and it is not constrained by style then a layout is required.
-    bool imageSizeIsConstrained = style().logicalWidth().isSpecified() &amp;&amp; style().logicalHeight().isSpecified();
-    bool needsLayout = !imageSizeIsConstrained &amp;&amp; imageSourceHasChangedSize;
</del><ins>+        // If the actual area occupied by the image has changed and it is not constrained by style then a layout is required.
+        bool imageSizeIsConstrained = style().logicalWidth().isSpecified() &amp;&amp; style().logicalHeight().isSpecified();
</ins><span class="cx"> 
</span><del>-    // FIXME: We only need to recompute the containing block's preferred size
-    // if the containing block's size depends on the image's size (i.e., the container uses shrink-to-fit sizing).
-    // There's no easy way to detect that shrink-to-fit is needed, always force a layout.
-    bool containingBlockNeedsToRecomputePreferredSize =
-        style().logicalWidth().isPercentOrCalculated()
-        || style().logicalMaxWidth().isPercentOrCalculated()
-        || style().logicalMinWidth().isPercentOrCalculated();
</del><ins>+        // FIXME: We only need to recompute the containing block's preferred size
+        // if the containing block's size depends on the image's size (i.e., the container uses shrink-to-fit sizing).
+        // There's no easy way to detect that shrink-to-fit is needed, always force a layout.
+        bool containingBlockNeedsToRecomputePreferredSize =
+            style().logicalWidth().isPercentOrCalculated()
+            || style().logicalMaxWidth().isPercentOrCalculated()
+            || style().logicalMinWidth().isPercentOrCalculated();
</ins><span class="cx"> 
</span><del>-    bool layoutSizeDependsOnIntrinsicSize = style().aspectRatioType() == AspectRatioFromIntrinsic;
</del><ins>+        bool layoutSizeDependsOnIntrinsicSize = style().aspectRatioType() == AspectRatioFromIntrinsic;
</ins><span class="cx"> 
</span><del>-    if (needsLayout || containingBlockNeedsToRecomputePreferredSize || layoutSizeDependsOnIntrinsicSize) {
-        setNeedsLayout();
-        return;
</del><ins>+        if (!imageSizeIsConstrained || containingBlockNeedsToRecomputePreferredSize || layoutSizeDependsOnIntrinsicSize) {
+            // FIXME: It's not clear that triggering a layout guarantees a repaint in all cases.
+            // But many callers do depend on this code causing a layout.
+            setNeedsLayout();
+            return;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (everHadLayout() &amp;&amp; !selfNeedsLayout()) {
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (185309 => 185310)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2015-06-08 01:39:35 UTC (rev 185309)
+++ trunk/Source/WebCore/testing/Internals.cpp        2015-06-08 02:39:15 UTC (rev 185310)
</span><span class="lines">@@ -2232,6 +2232,14 @@
</span><span class="cx">     document-&gt;updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks::Synchronously);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+unsigned Internals::layoutCount() const
+{
+    Document* document = contextDocument();
+    if (!document || !document-&gt;view())
+        return 0;
+    return document-&gt;view()-&gt;layoutCount();
+}
+
</ins><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> static const char* cursorTypeToString(Cursor::Type cursorType)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.h (185309 => 185310)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.h        2015-06-08 01:39:35 UTC (rev 185309)
+++ trunk/Source/WebCore/testing/Internals.h        2015-06-08 02:39:15 UTC (rev 185310)
</span><span class="lines">@@ -317,6 +317,7 @@
</span><span class="cx"> 
</span><span class="cx">     void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(ExceptionCode&amp;);
</span><span class="cx">     void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node*, ExceptionCode&amp;);
</span><ins>+    unsigned layoutCount() const;
</ins><span class="cx"> 
</span><span class="cx">     PassRefPtr&lt;ArrayBuffer&gt; serializeObject(PassRefPtr&lt;SerializedScriptValue&gt;) const;
</span><span class="cx">     PassRefPtr&lt;SerializedScriptValue&gt; deserializeBuffer(PassRefPtr&lt;ArrayBuffer&gt;) const;
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.idl (185309 => 185310)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.idl        2015-06-08 01:39:35 UTC (rev 185309)
+++ trunk/Source/WebCore/testing/Internals.idl        2015-06-08 02:39:15 UTC (rev 185310)
</span><span class="lines">@@ -298,6 +298,8 @@
</span><span class="cx">     // specified without security checks. Unspecified means this document.
</span><span class="cx">     [RaisesException] void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(optional Node node);
</span><span class="cx"> 
</span><ins>+    readonly attribute unsigned long layoutCount;
+
</ins><span class="cx">     // Returns a string with information about the mouse cursor used at the specified client location.
</span><span class="cx">     [RaisesException] DOMString getCurrentCursorInfo();
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>