<!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>[213480] 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/213480">213480</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2017-03-06 17:29:19 -0800 (Mon, 06 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION: Block no longer shrinks to preferred width in this flex box layout
https://bugs.webkit.org/show_bug.cgi?id=169203
&lt;rdar://problem/30873895&gt;

Reviewed by Simon Fraser.

Source/WebCore:

Added new test in css3/flexbox.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
(WebCore::StyleResolver::adjustStyleForAlignment):
* html/shadow/TextControlInnerElements.cpp:
(WebCore::TextControlInnerElement::resolveCustomStyle):
Resolve auto alignment values by adjusting the render style as needed. Make a helper
function for adjusting only alignment that can be called from the inner text control
custom style creation.

* rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild):
Replaced items in grids should not stretch by default.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::hasStretchedLogicalWidth):
Patched to properly check the default alignment for the child, making sure
that if it's a replacd item inside a grid, that the default is start and not
stretch.

* rendering/RenderBox.h:
(WebCore::RenderBox::selfAlignmentNormalBehavior):
Self-alignment function now takes an optional child argument, since the behavior
varies in grids depending on the child being replaced or not.

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::alignmentForChild):
Fixed to do the right thing when the child is anonymous.

(WebCore::RenderFlexibleBox::styleDidChange): Deleted.
* rendering/RenderFlexibleBox.h:
Deleted, since alignment changes are handled at the style diff level now.

* rendering/RenderFullScreen.h:
Patched the selfAlignmentNormalBehavior method to take an optional child argument.

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::styleDidChange):
(WebCore::RenderGrid::alignSelfForChild):
(WebCore::RenderGrid::justifySelfForChild):
(WebCore::RenderGrid::columnAxisPositionForChild):
(WebCore::RenderGrid::rowAxisPositionForChild):
(WebCore::RenderGrid::columnAxisOffsetForChild):
(WebCore::RenderGrid::rowAxisOffsetForChild):
(WebCore::defaultAlignmentIsStretch): Deleted.
(WebCore::defaultAlignmentChangedToStretchInRowAxis): Deleted.
(WebCore::defaultAlignmentChangedFromStretchInRowAxis): Deleted.
(WebCore::defaultAlignmentChangedFromStretchInColumnAxis): Deleted.
(WebCore::selfAlignmentChangedToStretchInRowAxis): Deleted.
(WebCore::selfAlignmentChangedFromStretchInRowAxis): Deleted.
(WebCore::selfAlignmentChangedFromStretchInColumnAxis): Deleted.
* rendering/RenderGrid.h:
Removed the alignment change logic in styleDidChange for grids, since style diffing handles
it now. Updated all selfAlignmentForNormalBehavior queries to pass in the child so that
replaced elements are handled properly.

* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::overflowInlineDirection):
(WebCore::RenderStyle::overflowBlockDirection):
(WebCore::RenderStyle::setJustifySelfPosition):
New helpers used by grid and by adjustRenderStyle.

* style/StyleChange.cpp:
(WebCore::Style::determineChange):
If alignment or justification changes occur on a parent that could affect the child (e.g., align-items)
return Inherit so the child render styles get adjusted properly.

LayoutTests:

* css3/flexbox/column-inside-normal-block-preferred-width-expected.html: Added.
* css3/flexbox/column-inside-normal-block-preferred-width.html: Added.
* fast/css-grid-layout/grid-align-stretching-replaced-items-expected.txt:
* fast/css-grid-layout/grid-align-stretching-replaced-items.html:
* fast/repaint/align-items-change-expected.txt:
* fast/repaint/align-items-overflow-change-expected.txt:
* fast/repaint/justify-items-change-expected.txt:
* fast/repaint/justify-items-legacy-change-expected.txt:
* fast/repaint/justify-items-overflow-change-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastcssgridlayoutgridalignstretchingreplaceditemsexpectedtxt">trunk/LayoutTests/fast/css-grid-layout/grid-align-stretching-replaced-items-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssgridlayoutgridalignstretchingreplaceditemshtml">trunk/LayoutTests/fast/css-grid-layout/grid-align-stretching-replaced-items.html</a></li>
<li><a href="#trunkLayoutTestsfastrepaintalignitemschangeexpectedtxt">trunk/LayoutTests/fast/repaint/align-items-change-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastrepaintalignitemsoverflowchangeexpectedtxt">trunk/LayoutTests/fast/repaint/align-items-overflow-change-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastrepaintjustifyitemschangeexpectedtxt">trunk/LayoutTests/fast/repaint/justify-items-change-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastrepaintjustifyitemslegacychangeexpectedtxt">trunk/LayoutTests/fast/repaint/justify-items-legacy-change-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastrepaintjustifyitemsoverflowchangeexpectedtxt">trunk/LayoutTests/fast/repaint/justify-items-overflow-change-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolverh">trunk/Source/WebCore/css/StyleResolver.h</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowTextControlInnerElementscpp">trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingGridTrackSizingAlgorithmcpp">trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxh">trunk/Source/WebCore/rendering/RenderBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderFlexibleBoxcpp">trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderFlexibleBoxh">trunk/Source/WebCore/rendering/RenderFlexibleBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderFullScreenh">trunk/Source/WebCore/rendering/RenderFullScreen.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderGridcpp">trunk/Source/WebCore/rendering/RenderGrid.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderGridh">trunk/Source/WebCore/rendering/RenderGrid.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStyleh">trunk/Source/WebCore/rendering/style/RenderStyle.h</a></li>
<li><a href="#trunkSourceWebCorestyleStyleChangecpp">trunk/Source/WebCore/style/StyleChange.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscss3flexboxcolumninsidenormalblockpreferredwidthexpectedhtml">trunk/LayoutTests/css3/flexbox/column-inside-normal-block-preferred-width-expected.html</a></li>
<li><a href="#trunkLayoutTestscss3flexboxcolumninsidenormalblockpreferredwidthhtml">trunk/LayoutTests/css3/flexbox/column-inside-normal-block-preferred-width.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/LayoutTests/ChangeLog        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2017-03-06  Dave Hyatt  &lt;hyatt@apple.com&gt;
+
+        REGRESSION: Block no longer shrinks to preferred width in this flex box layout
+        https://bugs.webkit.org/show_bug.cgi?id=169203
+        &lt;rdar://problem/30873895&gt;
+
+        Reviewed by Simon Fraser.
+
+        * css3/flexbox/column-inside-normal-block-preferred-width-expected.html: Added.
+        * css3/flexbox/column-inside-normal-block-preferred-width.html: Added.
+        * fast/css-grid-layout/grid-align-stretching-replaced-items-expected.txt:
+        * fast/css-grid-layout/grid-align-stretching-replaced-items.html:
+        * fast/repaint/align-items-change-expected.txt:
+        * fast/repaint/align-items-overflow-change-expected.txt:
+        * fast/repaint/justify-items-change-expected.txt:
+        * fast/repaint/justify-items-legacy-change-expected.txt:
+        * fast/repaint/justify-items-overflow-change-expected.txt:
+
</ins><span class="cx"> 2017-03-06  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Mark inspector/worker/console-basic.html as flaky.
</span></span></pre></div>
<a id="trunkLayoutTestscss3flexboxcolumninsidenormalblockpreferredwidthexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/flexbox/column-inside-normal-block-preferred-width-expected.html (0 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/flexbox/column-inside-normal-block-preferred-width-expected.html                                (rev 0)
+++ trunk/LayoutTests/css3/flexbox/column-inside-normal-block-preferred-width-expected.html        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+&lt;!doctype html&gt;
+
+&lt;div style=&quot;display: flex; flex-direction: row: justify-contents: center;border:5px solid lime&quot;&gt;&lt;div style=&quot;border:solid&quot;&gt;test&lt;/div&gt;&lt;/div&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscss3flexboxcolumninsidenormalblockpreferredwidthhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/flexbox/column-inside-normal-block-preferred-width.html (0 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/flexbox/column-inside-normal-block-preferred-width.html                                (rev 0)
+++ trunk/LayoutTests/css3/flexbox/column-inside-normal-block-preferred-width.html        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+&lt;!doctype html&gt;
+
+&lt;div style=&quot;display: flex; flex-direction: row; align-items: center;border:5px solid lime&quot;&gt;&lt;div style=&quot;border:solid&quot;&gt;test&lt;/div&gt;&lt;/div&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutgridalignstretchingreplaceditemsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css-grid-layout/grid-align-stretching-replaced-items-expected.txt (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/grid-align-stretching-replaced-items-expected.txt        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-align-stretching-replaced-items-expected.txt        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -1,9 +1,17 @@
</span><span class="cx"> This test checks that the alignment properties align-self and justify-self apply the 'stretch' value correctly on replaced elements.
</span><span class="cx"> 
</span><del>-The blue image's original size is 100px x 100px, but it should be stretched to fill the 500px x 500px grid area it's placed into
</del><ins>+The blue image's original size is 100px x 100px, default alignment is resolved as 'start' for replaced elements so it prevents stretching to be applied.
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> PASS
</span><ins>+The blue image's original size is 100px x 100px, 'normal' is resolved as 'start' for replaced elements so it prevents stretching to be applied.
+
+
+PASS
+The blue image's original size is 100px x 100px, but it should be stretched to fill the 500px x 500px grid area it's placed into.
+
+
+PASS
</ins><span class="cx"> The blue image's original size is 100px x 100px, non-stretch values prevent stretching to be applied.
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutgridalignstretchingreplaceditemshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css-grid-layout/grid-align-stretching-replaced-items.html (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/grid-align-stretching-replaced-items.html        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-align-stretching-replaced-items.html        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -17,35 +17,48 @@
</span><span class="cx"> &lt;/style&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;body onload=&quot;checkLayout('.grid')&quot;&gt;
</span><del>-
-&lt;p&gt;This test checks that the alignment properties align-self and justify-self apply the 'stretch' value correctly on replaced elements.&lt;/p&gt;
-
-&lt;div style=&quot;position: relative&quot;&gt;
-    &lt;p&gt;The blue image's original size is 100px x 100px, but it should be stretched to fill the 500px x 500px grid area it's placed into&lt;/p&gt;
-    &lt;div class=&quot;grid&quot;&gt;
-        &lt;img src=&quot;../../css3/images/resources/blue-100.png&quot; data-expected-width=&quot;500&quot; data-expected-height=&quot;500&quot;/&gt;
</del><ins>+    
+    &lt;p&gt;This test checks that the alignment properties align-self and justify-self apply the 'stretch' value correctly on replaced elements.&lt;/p&gt;
+    
+    &lt;div style=&quot;position: relative&quot;&gt;
+        &lt;p&gt;The blue image's original size is 100px x 100px, default alignment is resolved as 'start' for replaced elements so it prevents stretching to be applied.&lt;/p&gt;
+        &lt;div class=&quot;grid&quot;&gt;
+            &lt;img src=&quot;../../css3/images/resources/blue-100.png&quot; data-expected-width=&quot;100&quot; data-expected-height=&quot;100&quot;/&gt;
+        &lt;/div&gt;
</ins><span class="cx">     &lt;/div&gt;
</span><del>-&lt;/div&gt;
-
-&lt;div style=&quot;position: relative&quot;&gt;
-    &lt;p&gt;The blue image's original size is 100px x 100px, non-stretch values prevent stretching to be applied.&lt;/p&gt;
-    &lt;div class=&quot;grid itemsCenter&quot;&gt;
-        &lt;img src=&quot;../../css3/images/resources/blue-100.png&quot; data-expected-width=&quot;100&quot; data-expected-height=&quot;100&quot;/&gt;
</del><ins>+    
+    &lt;div style=&quot;position: relative&quot;&gt;
+        &lt;p&gt;The blue image's original size is 100px x 100px, 'normal' is resolved as 'start' for replaced elements so it prevents stretching to be applied.&lt;/p&gt;
+        &lt;div class=&quot;grid itemsNormal&quot;&gt;
+            &lt;img src=&quot;../../css3/images/resources/blue-100.png&quot; data-expected-width=&quot;100&quot; data-expected-height=&quot;100&quot;/&gt;
+        &lt;/div&gt;
</ins><span class="cx">     &lt;/div&gt;
</span><del>-&lt;/div&gt;
-
-&lt;div style=&quot;position: relative&quot;&gt;
-    &lt;p&gt;The blue image's original size is 100px x 100px, non-auto sizes prevent stretching to be applied.&lt;/p&gt;
-    &lt;div class=&quot;grid&quot;&gt;
-        &lt;img class=&quot;fixedSizes&quot; src=&quot;../../css3/images/resources/blue-100.png&quot; data-expected-width=&quot;150&quot; data-expected-height=&quot;150&quot;/&gt;
</del><ins>+    
+    &lt;div style=&quot;position: relative&quot;&gt;
+        &lt;p&gt;The blue image's original size is 100px x 100px, but it should be stretched to fill the 500px x 500px grid area it's placed into.&lt;/p&gt;
+        &lt;div class=&quot;grid alignItemsStretch justifyItemsStretch&quot;&gt;
+            &lt;img src=&quot;../../css3/images/resources/blue-100.png&quot; data-expected-width=&quot;500&quot; data-expected-height=&quot;500&quot;/&gt;
+        &lt;/div&gt;
</ins><span class="cx">     &lt;/div&gt;
</span><del>-&lt;/div&gt;
-
-&lt;div style=&quot;position: relative&quot;&gt;
-    &lt;p&gt;The blue image's original size is 100px x 100px, auto-margins prevent stretching to be applied.&lt;/p&gt;
-    &lt;div class=&quot;grid&quot;&gt;
-        &lt;img class=&quot;autoMargins&quot; src=&quot;../../css3/images/resources/blue-100.png&quot; data-expected-width=&quot;100&quot; data-expected-height=&quot;100&quot;/&gt;
</del><ins>+    
+    &lt;div style=&quot;position: relative&quot;&gt;
+        &lt;p&gt;The blue image's original size is 100px x 100px, non-stretch values prevent stretching to be applied.&lt;/p&gt;
+        &lt;div class=&quot;grid itemsCenter&quot;&gt;
+            &lt;img src=&quot;../../css3/images/resources/blue-100.png&quot; data-expected-width=&quot;100&quot; data-expected-height=&quot;100&quot;/&gt;
+        &lt;/div&gt;
</ins><span class="cx">     &lt;/div&gt;
</span><del>-&lt;/div&gt;
-
</del><ins>+    
+    &lt;div style=&quot;position: relative&quot;&gt;
+        &lt;p&gt;The blue image's original size is 100px x 100px, non-auto sizes prevent stretching to be applied.&lt;/p&gt;
+        &lt;div class=&quot;grid&quot;&gt;
+            &lt;img class=&quot;fixedSizes&quot; src=&quot;../../css3/images/resources/blue-100.png&quot; data-expected-width=&quot;150&quot; data-expected-height=&quot;150&quot;/&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+    
+    &lt;div style=&quot;position: relative&quot;&gt;
+        &lt;p&gt;The blue image's original size is 100px x 100px, auto-margins prevent stretching to be applied.&lt;/p&gt;
+        &lt;div class=&quot;grid&quot;&gt;
+            &lt;img class=&quot;autoMargins&quot; src=&quot;../../css3/images/resources/blue-100.png&quot; data-expected-width=&quot;100&quot; data-expected-height=&quot;100&quot;/&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
</ins><span class="cx"> &lt;/body&gt;
</span></span></pre></div>
<a id="trunkLayoutTestsfastrepaintalignitemschangeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/repaint/align-items-change-expected.txt (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/repaint/align-items-change-expected.txt        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/LayoutTests/fast/repaint/align-items-change-expected.txt        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -1,6 +1,8 @@
</span><span class="cx"> Tests invalidation on align-items style change. Passes if there is no red.
</span><span class="cx"> 
</span><span class="cx"> (repaint rects
</span><ins>+  (rect 0 52 100 102)
+  (rect 100 52 100 152)
</ins><span class="cx">   (rect 0 52 100 300)
</span><span class="cx">   (rect 0 51 100 1)
</span><span class="cx">   (rect 100 52 100 300)
</span></span></pre></div>
<a id="trunkLayoutTestsfastrepaintalignitemsoverflowchangeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/repaint/align-items-overflow-change-expected.txt (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/repaint/align-items-overflow-change-expected.txt        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/LayoutTests/fast/repaint/align-items-overflow-change-expected.txt        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -1,6 +1,8 @@
</span><span class="cx"> Tests invalidation on align-items style change (just overflow). Passes if there is no red.
</span><span class="cx"> 
</span><span class="cx"> (repaint rects
</span><ins>+  (rect 0 2 200 200)
+  (rect 0 252 200 100)
</ins><span class="cx">   (rect 0 2 200 350)
</span><span class="cx">   (rect 0 52 200 300)
</span><span class="cx">   (rect 0 2 800 14)
</span></span></pre></div>
<a id="trunkLayoutTestsfastrepaintjustifyitemschangeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/repaint/justify-items-change-expected.txt (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/repaint/justify-items-change-expected.txt        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/LayoutTests/fast/repaint/justify-items-change-expected.txt        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -1,7 +1,8 @@
</span><span class="cx"> Tests invalidation on justify-items style change. Passes if there is no red.
</span><span class="cx"> 
</span><span class="cx"> (repaint rects
</span><del>-  (rect 200 52 150 300)
</del><ins>+  (rect 150 52 50 300)
+  (rect 150 52 200 300)
</ins><span class="cx">   (rect 0 52 200 300)
</span><span class="cx"> )
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsfastrepaintjustifyitemslegacychangeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/repaint/justify-items-legacy-change-expected.txt (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/repaint/justify-items-legacy-change-expected.txt        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/LayoutTests/fast/repaint/justify-items-legacy-change-expected.txt        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -1,6 +1,12 @@
</span><span class="cx"> Tests invalidation on justify-items style change (legacy value). Passes if green bars are centerd inside their red container.
</span><span class="cx"> 
</span><span class="cx"> (repaint rects
</span><ins>+  (rect 1 53 50 50)
+  (rect 0 52 52 100)
+  (rect 151 53 50 50)
+  (rect 150 52 52 100)
+  (rect 0 52 202 300)
+  (rect 0 52 251 300)
</ins><span class="cx">   (rect 0 52 300 400)
</span><span class="cx"> )
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsfastrepaintjustifyitemsoverflowchangeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/repaint/justify-items-overflow-change-expected.txt (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/repaint/justify-items-overflow-change-expected.txt        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/LayoutTests/fast/repaint/justify-items-overflow-change-expected.txt        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -1,6 +1,8 @@
</span><span class="cx"> Tests invalidation on justify-items style change. Passes if there is no red.
</span><span class="cx"> 
</span><span class="cx"> (repaint rects
</span><ins>+  (rect -60 52 160 300)
+  (rect 150 52 50 300)
</ins><span class="cx">   (rect -60 52 260 300)
</span><span class="cx">   (rect 0 52 200 300)
</span><span class="cx">   (rect -60 16 60 336)
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/Source/WebCore/ChangeLog        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -1,3 +1,79 @@
</span><ins>+2017-03-06  Dave Hyatt  &lt;hyatt@apple.com&gt;
+
+        REGRESSION: Block no longer shrinks to preferred width in this flex box layout
+        https://bugs.webkit.org/show_bug.cgi?id=169203
+        &lt;rdar://problem/30873895&gt;
+
+        Reviewed by Simon Fraser.
+
+        Added new test in css3/flexbox.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::adjustRenderStyle):
+        (WebCore::StyleResolver::adjustStyleForAlignment):
+        * html/shadow/TextControlInnerElements.cpp:
+        (WebCore::TextControlInnerElement::resolveCustomStyle):
+        Resolve auto alignment values by adjusting the render style as needed. Make a helper
+        function for adjusting only alignment that can be called from the inner text control
+        custom style creation.
+
+        * rendering/GridTrackSizingAlgorithm.cpp:
+        (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild):
+        Replaced items in grids should not stretch by default.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::hasStretchedLogicalWidth):
+        Patched to properly check the default alignment for the child, making sure
+        that if it's a replacd item inside a grid, that the default is start and not
+        stretch.
+
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::selfAlignmentNormalBehavior):
+        Self-alignment function now takes an optional child argument, since the behavior
+        varies in grids depending on the child being replaced or not.
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::alignmentForChild):
+        Fixed to do the right thing when the child is anonymous.
+
+        (WebCore::RenderFlexibleBox::styleDidChange): Deleted.
+        * rendering/RenderFlexibleBox.h:
+        Deleted, since alignment changes are handled at the style diff level now.
+
+        * rendering/RenderFullScreen.h:
+        Patched the selfAlignmentNormalBehavior method to take an optional child argument.
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::styleDidChange):
+        (WebCore::RenderGrid::alignSelfForChild):
+        (WebCore::RenderGrid::justifySelfForChild):
+        (WebCore::RenderGrid::columnAxisPositionForChild):
+        (WebCore::RenderGrid::rowAxisPositionForChild):
+        (WebCore::RenderGrid::columnAxisOffsetForChild):
+        (WebCore::RenderGrid::rowAxisOffsetForChild):
+        (WebCore::defaultAlignmentIsStretch): Deleted.
+        (WebCore::defaultAlignmentChangedToStretchInRowAxis): Deleted.
+        (WebCore::defaultAlignmentChangedFromStretchInRowAxis): Deleted.
+        (WebCore::defaultAlignmentChangedFromStretchInColumnAxis): Deleted.
+        (WebCore::selfAlignmentChangedToStretchInRowAxis): Deleted.
+        (WebCore::selfAlignmentChangedFromStretchInRowAxis): Deleted.
+        (WebCore::selfAlignmentChangedFromStretchInColumnAxis): Deleted.
+        * rendering/RenderGrid.h:
+        Removed the alignment change logic in styleDidChange for grids, since style diffing handles
+        it now. Updated all selfAlignmentForNormalBehavior queries to pass in the child so that
+        replaced elements are handled properly.
+
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::overflowInlineDirection):
+        (WebCore::RenderStyle::overflowBlockDirection):
+        (WebCore::RenderStyle::setJustifySelfPosition):
+        New helpers used by grid and by adjustRenderStyle.
+
+        * style/StyleChange.cpp:
+        (WebCore::Style::determineChange):
+        If alignment or justification changes occur on a parent that could affect the child (e.g., align-items)
+        return Inherit so the child render styles get adjusted properly.
+
</ins><span class="cx"> 2017-03-06  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         ASSERTION FAILED: numberOfChannels == 2 in WebCore::RealtimeIncomingAudioSource::OnData
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -1028,7 +1028,38 @@
</span><span class="cx">         if ((element-&gt;hasTagName(SVGNames::foreignObjectTag) || element-&gt;hasTagName(SVGNames::textTag)) &amp;&amp; style.isDisplayInlineType())
</span><span class="cx">             style.setDisplay(BLOCK);
</span><span class="cx">     }
</span><ins>+    
+    adjustStyleForAlignment(style, parentStyle);
</ins><span class="cx"> }
</span><ins>+    
+void StyleResolver::adjustStyleForAlignment(RenderStyle&amp; style, const RenderStyle&amp; parentStyle)
+{
+    // To avoid needing to copy the StyleRareNonInheritedData, we repurpose the 'auto'
+    // flag to not just mean 'auto' prior to running adjustRenderStyle but also
+    // mean 'normal' after running it.
+    
+    // If the inherited value of justify-items includes the 'legacy' keyword,
+    // 'auto' computes to the the inherited value. Otherwise, 'auto' computes to
+    // 'normal'.
+    if (style.justifyItems().position() == ItemPositionAuto) {
+        if (parentStyle.justifyItems().positionType() == LegacyPosition)
+            style.setJustifyItems(parentStyle.justifyItems());
+    }
+    
+    // The 'auto' keyword computes the computed value of justify-items on the
+    // parent (minus any legacy keywords), or 'normal' if the box has no parent.
+    if (style.justifySelf().position() == ItemPositionAuto) {
+        if (parentStyle.justifyItems().positionType() == LegacyPosition)
+            style.setJustifySelfPosition(parentStyle.justifyItems().position());
+        else if (parentStyle.justifyItems().position() != ItemPositionAuto)
+            style.setJustifySelf(parentStyle.justifyItems());
+    }
+    
+    // The 'auto' keyword computes the computed value of align-items on the parent
+    // or 'normal' if the box has no parent.
+    if (style.alignSelf().position() == ItemPositionAuto &amp;&amp; parentStyle.alignItems().position() != RenderStyle::initialDefaultAlignment().position())
+        style.setAlignSelf(parentStyle.alignItems());
+}
</ins><span class="cx"> 
</span><span class="cx"> bool StyleResolver::checkRegionStyle(const Element* regionElement)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.h (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.h        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/Source/WebCore/css/StyleResolver.h        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -308,6 +308,10 @@
</span><span class="cx">         WritingMode m_writingMode;
</span><span class="cx">     };
</span><span class="cx"> 
</span><ins>+    // FIXME: Should make a StyleAdjuster class (like Blink has) that handles all RenderStyle
+    // adjustments. For now put this function on StyleResolver, since adjustRenderStyle is here.
+    static void adjustStyleForAlignment(RenderStyle&amp;, const RenderStyle&amp; parentStyle);
+    
</ins><span class="cx"> private:
</span><span class="cx">     // This function fixes up the default font size if it detects that the current generic font family has changed. -dwh
</span><span class="cx">     void checkForGenericFamilyChange(RenderStyle*, const RenderStyle* parentStyle);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowTextControlInnerElementscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx">     return adoptRef(*new TextControlInnerElement(document));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::optional&lt;ElementStyle&gt; TextControlInnerElement::resolveCustomStyle(const RenderStyle&amp;, const RenderStyle* shadowHostStyle)
</del><ins>+std::optional&lt;ElementStyle&gt; TextControlInnerElement::resolveCustomStyle(const RenderStyle&amp; parentStyle, const RenderStyle* shadowHostStyle)
</ins><span class="cx"> {
</span><span class="cx">     auto innerContainerStyle = RenderStyle::createPtr();
</span><span class="cx">     innerContainerStyle-&gt;inheritFrom(*shadowHostStyle);
</span><span class="lines">@@ -89,6 +89,8 @@
</span><span class="cx">     // We don't want the shadow dom to be editable, so we set this block to read-only in case the input itself is editable.
</span><span class="cx">     innerContainerStyle-&gt;setUserModify(READ_ONLY);
</span><span class="cx"> 
</span><ins>+    StyleResolver::adjustStyleForAlignment(*innerContainerStyle, parentStyle);
+
</ins><span class="cx">     return ElementStyle(WTFMove(innerContainerStyle));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingGridTrackSizingAlgorithmcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -793,8 +793,17 @@
</span><span class="cx">     bool isRowAxis = direction() == childInlineDirection;
</span><span class="cx">     const Length&amp; childMinSize = isRowAxis ? child.style().logicalMinWidth() : child.style().logicalMinHeight();
</span><span class="cx">     const Length&amp; childSize = isRowAxis ? child.style().logicalWidth() : child.style().logicalHeight();
</span><del>-    if (!childSize.isAuto() || childMinSize.isAuto())
</del><ins>+
+    bool overflowIsVisible = isRowAxis ? child.style().overflowInlineDirection() == OVISIBLE : child.style().overflowBlockDirection() == OVISIBLE;
+    if (!childSize.isAuto() || (childMinSize.isAuto() &amp;&amp; overflowIsVisible)) {
+        if (child.isRenderReplaced() &amp;&amp; childSize.isAuto()) {
+            // If the box has an aspect ratio and no specified size, its automatic
+            // minimum size is the smaller of its content size and its transferred
+            // size.
+            return isRowAxis ? std::min(child.intrinsicLogicalWidth(), minContentForChild(child)) : std::min(child.intrinsicLogicalHeight(), minContentForChild(child));
+        }
</ins><span class="cx">         return minContentForChild(child);
</span><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     bool overrideSizeHasChanged = updateOverrideContainingBlockContentSizeForChild(child, childInlineDirection);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -2565,9 +2565,10 @@
</span><span class="cx">         // The 'normal' value behaves like 'start' except for Flexbox Items, which obviously should have a container.
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><ins>+    const auto* parentStyle = isAnonymous() ? &amp;containingBlock-&gt;style() : nullptr;
</ins><span class="cx">     if (containingBlock-&gt;isHorizontalWritingMode() != isHorizontalWritingMode())
</span><del>-        return style.resolvedAlignSelf(&amp;containingBlock-&gt;style(), ItemPositionStretch).position() == ItemPositionStretch;
-    return style.resolvedJustifySelf(&amp;containingBlock-&gt;style(), ItemPositionStretch).position() == ItemPositionStretch;
</del><ins>+        return style.resolvedAlignSelf(parentStyle, containingBlock-&gt;selfAlignmentNormalBehavior(this)).position() == ItemPositionStretch;
+    return style.resolvedJustifySelf(parentStyle, containingBlock-&gt;selfAlignmentNormalBehavior(this)).position() == ItemPositionStretch;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RenderBox::sizesLogicalWidthToFitContent(SizeType widthType) const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.h (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.h        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/Source/WebCore/rendering/RenderBox.h        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -637,7 +637,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool createsNewFormattingContext() const;
</span><span class="cx"> 
</span><del>-    virtual ItemPosition selfAlignmentNormalBehavior() const { return ItemPositionStretch; }
</del><ins>+    virtual ItemPosition selfAlignmentNormalBehavior(const RenderBox* = nullptr) const { return ItemPositionStretch; }
</ins><span class="cx"> 
</span><span class="cx">     // Returns false if it could not cheaply compute the extent (e.g. fixed background), in which case the returned rect may be incorrect.
</span><span class="cx">     bool getBackgroundPaintedExtent(const LayoutPoint&amp; paintOffset, LayoutRect&amp;) const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFlexibleBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -235,23 +235,6 @@
</span><span class="cx">     return normalBehavior;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderFlexibleBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
-{
-    RenderBlock::styleDidChange(diff, oldStyle);
-
-    if (oldStyle &amp;&amp; oldStyle-&gt;resolvedAlignItems(selfAlignmentNormalBehavior()).position() == ItemPositionStretch &amp;&amp; diff == StyleDifferenceLayout) {
-        // Flex items that were previously stretching need to be relayed out so we can compute new available cross axis space.
-        // This is only necessary for stretching since other alignment values don't change the size of the box.
-        auto&amp; newStyle = style();
-        for (RenderBox* child = firstChildBox(); child; child = child-&gt;nextSiblingBox()) {
-            auto&amp; childStyle = child-&gt;style();
-            auto previousAlignment = childStyle.resolvedAlignSelf(oldStyle, selfAlignmentNormalBehavior()).position();
-            if (previousAlignment == ItemPositionStretch &amp;&amp; previousAlignment != childStyle.resolvedAlignSelf(&amp;newStyle, selfAlignmentNormalBehavior()).position())
-                child-&gt;setChildNeedsLayout(MarkOnlyThis);
-        }
-    }
-}
-
</del><span class="cx"> void RenderFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(needsLayout());
</span><span class="lines">@@ -1448,7 +1431,7 @@
</span><span class="cx"> 
</span><span class="cx"> ItemPosition RenderFlexibleBox::alignmentForChild(const RenderBox&amp; child) const
</span><span class="cx"> {
</span><del>-    ItemPosition align = child.style().resolvedAlignSelf(&amp;style(), selfAlignmentNormalBehavior()).position();
</del><ins>+    ItemPosition align = child.style().resolvedAlignSelf(child.isAnonymous() ? &amp;style() : nullptr, selfAlignmentNormalBehavior()).position();
</ins><span class="cx">     ASSERT(align != ItemPositionAuto &amp;&amp; align != ItemPositionNormal);
</span><span class="cx"> 
</span><span class="cx">     if (align == ItemPositionBaseline &amp;&amp; hasOrthogonalFlow(child))
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFlexibleBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.h (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFlexibleBox.h        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.h        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -90,8 +90,6 @@
</span><span class="cx">     void computeIntrinsicLogicalWidths(LayoutUnit&amp; minLogicalWidth, LayoutUnit&amp; maxLogicalWidth) const override;
</span><span class="cx">     void computePreferredLogicalWidths() override;
</span><span class="cx"> 
</span><del>-    void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
-
</del><span class="cx"> private:
</span><span class="cx">     enum FlexSign {
</span><span class="cx">         PositiveFlexibility,
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderFullScreenh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderFullScreen.h (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderFullScreen.h        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/Source/WebCore/rendering/RenderFullScreen.h        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx">     static RenderFullScreen* wrapRenderer(RenderObject*, RenderElement*, Document&amp;);
</span><span class="cx">     void unwrapRenderer(bool&amp; requiresRenderTreeRebuild);
</span><span class="cx"> 
</span><del>-    ItemPosition selfAlignmentNormalBehavior() const override { return ItemPositionCenter; }
</del><ins>+    ItemPosition selfAlignmentNormalBehavior(const RenderBox* = nullptr) const override { return ItemPositionCenter; }
</ins><span class="cx">     
</span><span class="cx"> private:
</span><span class="cx">     bool isRenderFullScreen() const override { return true; }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderGridcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderGrid.cpp        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -65,41 +65,6 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool defaultAlignmentIsStretch(ItemPosition position)
-{
-    return position == ItemPositionStretch || position == ItemPositionAuto;
-}
-
-static inline bool defaultAlignmentChangedToStretchInRowAxis(const RenderStyle&amp; oldStyle, const RenderStyle&amp; newStyle)
-{
-    return !defaultAlignmentIsStretch(oldStyle.justifyItems().position()) &amp;&amp; defaultAlignmentIsStretch(newStyle.justifyItems().position());
-}
-
-static inline bool defaultAlignmentChangedFromStretchInRowAxis(const RenderStyle&amp; oldStyle, const RenderStyle&amp; newStyle)
-{
-    return defaultAlignmentIsStretch(oldStyle.justifyItems().position()) &amp;&amp; !defaultAlignmentIsStretch(newStyle.justifyItems().position());
-}
-
-static inline bool defaultAlignmentChangedFromStretchInColumnAxis(const RenderStyle&amp; oldStyle, const RenderStyle&amp; newStyle)
-{
-    return defaultAlignmentIsStretch(oldStyle.alignItems().position()) &amp;&amp; !defaultAlignmentIsStretch(newStyle.alignItems().position());
-}
-
-static inline bool selfAlignmentChangedToStretchInRowAxis(const RenderStyle&amp; oldStyle, const RenderStyle&amp; newStyle, const RenderStyle&amp; childStyle, ItemPosition selfAlignNormalBehavior)
-{
-    return childStyle.resolvedJustifySelf(&amp;oldStyle, selfAlignNormalBehavior).position() != ItemPositionStretch &amp;&amp; childStyle.resolvedJustifySelf(&amp;newStyle, selfAlignNormalBehavior).position() == ItemPositionStretch;
-}
-
-static inline bool selfAlignmentChangedFromStretchInRowAxis(const RenderStyle&amp; oldStyle, const RenderStyle&amp; newStyle, const RenderStyle&amp; childStyle, ItemPosition selfAlignNormalBehavior)
-{
-    return childStyle.resolvedJustifySelf(&amp;oldStyle, selfAlignNormalBehavior).position() == ItemPositionStretch &amp;&amp; childStyle.resolvedJustifySelf(&amp;newStyle, selfAlignNormalBehavior).position() != ItemPositionStretch;
-}
-
-static inline bool selfAlignmentChangedFromStretchInColumnAxis(const RenderStyle&amp; oldStyle, const RenderStyle&amp; newStyle, const RenderStyle&amp; childStyle, ItemPosition selfAlignNormalBehavior)
-{
-    return childStyle.resolvedAlignSelf(&amp;oldStyle, selfAlignNormalBehavior).position() == ItemPositionStretch &amp;&amp; childStyle.resolvedAlignSelf(&amp;newStyle, selfAlignNormalBehavior).position() != ItemPositionStretch;
-}
-
</del><span class="cx"> void RenderGrid::addChild(RenderObject* newChild, RenderObject* beforeChild)
</span><span class="cx"> {
</span><span class="cx">     RenderBlock::addChild(newChild, beforeChild);
</span><span class="lines">@@ -124,22 +89,6 @@
</span><span class="cx">     if (!oldStyle || diff != StyleDifferenceLayout)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    const RenderStyle&amp; newStyle = style();
-    if (defaultAlignmentChangedToStretchInRowAxis(*oldStyle, newStyle) || defaultAlignmentChangedFromStretchInRowAxis(*oldStyle, newStyle)
-        || defaultAlignmentChangedFromStretchInColumnAxis(*oldStyle, newStyle)) {
-        // Grid items that were not previously stretched in row-axis need to be relayed out so we can compute new available space.
-        // Grid items that were previously stretching in column-axis need to be relayed out so we can compute new available space.
-        // This is only necessary for stretching since other alignment values don't change the size of the box.
-        for (RenderBox* child = firstChildBox(); child; child = child-&gt;nextSiblingBox()) {
-            if (child-&gt;isOutOfFlowPositioned())
-                continue;
-            if (selfAlignmentChangedToStretchInRowAxis(*oldStyle, newStyle, child-&gt;style(), selfAlignmentNormalBehavior()) || selfAlignmentChangedFromStretchInRowAxis(*oldStyle, newStyle, child-&gt;style(), selfAlignmentNormalBehavior())
-                || selfAlignmentChangedFromStretchInColumnAxis(*oldStyle, newStyle, child-&gt;style(), selfAlignmentNormalBehavior())) {
-                child-&gt;setChildNeedsLayout(MarkOnlyThis);
-            }
-        }
-    }
-
</del><span class="cx">     if (explicitGridDidResize(*oldStyle) || namedGridLinesDefinitionDidChange(*oldStyle) || oldStyle-&gt;gridAutoFlow() != style().gridAutoFlow()
</span><span class="cx">         || (style().gridAutoRepeatColumns().size() || style().gridAutoRepeatRows().size()))
</span><span class="cx">         dirtyGrid();
</span><span class="lines">@@ -1179,12 +1128,24 @@
</span><span class="cx"> 
</span><span class="cx"> StyleSelfAlignmentData RenderGrid::alignSelfForChild(const RenderBox&amp; child) const
</span><span class="cx"> {
</span><del>-    return child.style().resolvedAlignSelf(&amp;style(), selfAlignmentNormalBehavior());
</del><ins>+    if (!child.isAnonymous())
+        return child.style().resolvedAlignSelf(nullptr, selfAlignmentNormalBehavior(&amp;child));
+
+    // All the 'auto' values have been resolved by the StyleAdjuster, but it's
+    // possible that some grid items generate Anonymous boxes, which need to be
+    // solved during layout.
+    return child.style().resolvedAlignSelf(&amp;style(), selfAlignmentNormalBehavior(&amp;child));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> StyleSelfAlignmentData RenderGrid::justifySelfForChild(const RenderBox&amp; child) const
</span><span class="cx"> {
</span><del>-    return child.style().resolvedJustifySelf(&amp;style(), selfAlignmentNormalBehavior());
</del><ins>+    if (!child.isAnonymous())
+        return child.style().resolvedJustifySelf(nullptr, selfAlignmentNormalBehavior(&amp;child));
+    
+    // All the 'auto' values have been resolved by the StyleAdjuster, but it's
+    // possible that some grid items generate Anonymous boxes, which need to be
+    // solved during layout.
+    return child.style().resolvedJustifySelf(&amp;style(), selfAlignmentNormalBehavior(&amp;child));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // FIXME: This logic is shared by RenderFlexibleBox, so it should be moved to RenderBox.
</span><span class="lines">@@ -1345,7 +1306,7 @@
</span><span class="cx">     bool hasSameWritingMode = child.style().writingMode() == style().writingMode();
</span><span class="cx">     bool childIsLTR = child.style().isLeftToRightDirection();
</span><span class="cx"> 
</span><del>-    switch (child.style().resolvedAlignSelf(&amp;style(), selfAlignmentNormalBehavior()).position()) {
</del><ins>+    switch (alignSelfForChild(child).position()) {
</ins><span class="cx">     case ItemPositionSelfStart:
</span><span class="cx">         // FIXME: Should we implement this logic in a generic utility function ?
</span><span class="cx">         // Aligns the alignment subject to be flush with the edge of the alignment container
</span><span class="lines">@@ -1410,7 +1371,7 @@
</span><span class="cx">     bool hasSameDirection = child.style().direction() == style().direction();
</span><span class="cx">     bool gridIsLTR = style().isLeftToRightDirection();
</span><span class="cx"> 
</span><del>-    switch (child.style().resolvedJustifySelf(&amp;style(), selfAlignmentNormalBehavior()).position()) {
</del><ins>+    switch (justifySelfForChild(child).position()) {
</ins><span class="cx">     case ItemPositionSelfStart:
</span><span class="cx">         // FIXME: Should we implement this logic in a generic utility function ?
</span><span class="cx">         // Aligns the alignment subject to be flush with the edge of the alignment container
</span><span class="lines">@@ -1492,7 +1453,7 @@
</span><span class="cx">         if (childEndLine &lt; m_rowPositions.size() - 1)
</span><span class="cx">             endOfRow -= gridGapForDirection(ForRows, TrackSizing) + m_offsetBetweenRows;
</span><span class="cx">         LayoutUnit columnAxisChildSize = isOrthogonalChild(child) ? child.logicalWidth() + child.marginLogicalWidth() : child.logicalHeight() + child.marginLogicalHeight();
</span><del>-        auto overflow = child.style().resolvedAlignSelf(&amp;style(), selfAlignmentNormalBehavior()).overflow();
</del><ins>+        auto overflow = alignSelfForChild(child).overflow();
</ins><span class="cx">         LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(overflow, endOfRow - startOfRow, columnAxisChildSize);
</span><span class="cx">         return startPosition + (axisPosition == GridAxisEnd ? offsetFromStartPosition : offsetFromStartPosition / 2);
</span><span class="cx">     }
</span><span class="lines">@@ -1524,7 +1485,7 @@
</span><span class="cx">         if (childEndLine &lt; m_columnPositions.size() - 1)
</span><span class="cx">             endOfColumn -= gridGapForDirection(ForColumns, TrackSizing) + m_offsetBetweenColumns;
</span><span class="cx">         LayoutUnit rowAxisChildSize = isOrthogonalChild(child) ? child.logicalHeight() + child.marginLogicalHeight() : child.logicalWidth() + child.marginLogicalWidth();
</span><del>-        auto overflow = child.style().resolvedJustifySelf(&amp;style(), selfAlignmentNormalBehavior()).overflow();
</del><ins>+        auto overflow = justifySelfForChild(child).overflow();
</ins><span class="cx">         LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(overflow, endOfColumn - startOfColumn, rowAxisChildSize);
</span><span class="cx">         return startPosition + (axisPosition == GridAxisEnd ? offsetFromStartPosition : offsetFromStartPosition / 2);
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderGridh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderGrid.h (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderGrid.h        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/Source/WebCore/rendering/RenderGrid.h        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -63,6 +63,14 @@
</span><span class="cx">     // Required by GridTrackSizingAlgorithm. Keep them under control.
</span><span class="cx">     bool isOrthogonalChild(const RenderBox&amp;) const;
</span><span class="cx">     LayoutUnit guttersSize(const Grid&amp;, GridTrackSizingDirection, unsigned startLine, unsigned span, SizingOperation) const;
</span><ins>+    
+protected:
+    ItemPosition selfAlignmentNormalBehavior(const RenderBox* child = nullptr) const override
+    {
+        ASSERT(child);
+        return child-&gt;isRenderReplaced() ? ItemPositionStart : ItemPositionStretch;
+    }
+
</ins><span class="cx"> private:
</span><span class="cx">     const char* renderName() const override;
</span><span class="cx">     bool isRenderGrid() const override { return true; }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.h        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -323,7 +323,9 @@
</span><span class="cx">     
</span><span class="cx">     EOverflow overflowX() const { return m_nonInheritedFlags.overflowX(); }
</span><span class="cx">     EOverflow overflowY() const { return m_nonInheritedFlags.overflowY(); }
</span><del>-
</del><ins>+    EOverflow overflowInlineDirection() const { return isHorizontalWritingMode() ? overflowX() : overflowY(); }
+    EOverflow overflowBlockDirection() const { return isHorizontalWritingMode() ? overflowY() : overflowX(); }
+    
</ins><span class="cx">     EVisibility visibility() const { return static_cast&lt;EVisibility&gt;(m_inheritedFlags.visibility); }
</span><span class="cx">     EVerticalAlign verticalAlign() const { return m_nonInheritedFlags.verticalAlign(); }
</span><span class="cx">     const Length&amp; verticalAlignLength() const { return m_boxData-&gt;verticalAlign(); }
</span><span class="lines">@@ -1055,6 +1057,7 @@
</span><span class="cx">     void setJustifyContentPosition(ContentPosition position) { m_rareNonInheritedData.access().justifyContent.setPosition(position); }
</span><span class="cx">     void setJustifyItems(const StyleSelfAlignmentData&amp; data) { SET_VAR(m_rareNonInheritedData, justifyItems, data); }
</span><span class="cx">     void setJustifySelf(const StyleSelfAlignmentData&amp; data) { SET_VAR(m_rareNonInheritedData, justifySelf, data); }
</span><ins>+    void setJustifySelfPosition(ItemPosition position) { m_rareNonInheritedData.access().justifySelf.setPosition(position); }
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_BOX_DECORATION_BREAK)
</span><span class="cx">     void setBoxDecorationBreak(EBoxDecorationBreak b) { SET_VAR(m_boxData, m_boxDecorationBreak, b); }
</span></span></pre></div>
<a id="trunkSourceWebCorestyleStyleChangecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/StyleChange.cpp (213479 => 213480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/StyleChange.cpp        2017-03-07 00:20:30 UTC (rev 213479)
+++ trunk/Source/WebCore/style/StyleChange.cpp        2017-03-07 01:29:19 UTC (rev 213480)
</span><span class="lines">@@ -64,8 +64,12 @@
</span><span class="cx">         if (s1.inheritedNotEqual(&amp;s2))
</span><span class="cx">             return Inherit;
</span><span class="cx"> 
</span><ins>+        if (s1.alignItems() != s2.alignItems() || s1.justifyItems() != s2.justifyItems())
+            return Inherit;
+
</ins><span class="cx">         return NoInherit;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     // If the pseudoStyles have changed, we want any StyleChange that is not NoChange
</span><span class="cx">     // because setStyle will do the right thing with anything else.
</span><span class="cx">     if (s1.hasAnyPublicPseudoStyles()) {
</span></span></pre>
</div>
</div>

</body>
</html>