<!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>[183660] 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/183660">183660</a></dd>
<dt>Author</dt> <dd>jfernandez@igalia.com</dd>
<dt>Date</dt> <dd>2015-04-30 18:14:20 -0700 (Thu, 30 Apr 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[CSS Grid Layout] overflow-position keyword for align and justify properties.
https://bugs.webkit.org/show_bug.cgi?id=144235

Reviewed by Sergio Villar Senin.

Source/WebCore:

When the alignment subject is larger than the alignment container,
it will overflow. Some alignment modes, if honored in this
situation, may cause data loss; an overflow alignment mode can be
explicitly specified to avoid this.

This patch implements overflow-keyword handling for Grid Layout on
align-self and justify-self properties.

Test: fast/css-grid-layout/grid-align-justify-overflow.html

* rendering/RenderGrid.cpp:
(WebCore::computeOverflowAlignmentOffset):
(WebCore::RenderGrid::rowPositionForChild):
(WebCore::RenderGrid::columnPositionForChild):
(WebCore::RenderGrid::rowAxisPositionForChild): Deleted.
* rendering/style/RenderStyle.cpp:
(WebCore::resolveAlignmentData):
(WebCore::resolveJustificationData):
(WebCore::RenderStyle::resolveAlignment):
(WebCore::RenderStyle::resolveAlignmentOverflow):
(WebCore::RenderStyle::resolveJustification):
(WebCore::RenderStyle::resolveJustificationOverflow):
* rendering/style/RenderStyle.h:

LayoutTests:

Implementation of overflow-keyword handling for Grid Layout on
align-self and justify-self properties.

* fast/css-grid-layout/grid-align-justify-overflow-expected.txt: Added.
* fast/css-grid-layout/grid-align-justify-overflow.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderGridcpp">trunk/Source/WebCore/rendering/RenderGrid.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStylecpp">trunk/Source/WebCore/rendering/style/RenderStyle.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStyleh">trunk/Source/WebCore/rendering/style/RenderStyle.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcssgridlayoutgridalignjustifyoverflowexpectedtxt">trunk/LayoutTests/fast/css-grid-layout/grid-align-justify-overflow-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssgridlayoutgridalignjustifyoverflowhtml">trunk/LayoutTests/fast/css-grid-layout/grid-align-justify-overflow.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (183659 => 183660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-05-01 01:10:43 UTC (rev 183659)
+++ trunk/LayoutTests/ChangeLog        2015-05-01 01:14:20 UTC (rev 183660)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-04-30  Javier Fernandez  &lt;jfernandez@igalia.com&gt;
+
+        [CSS Grid Layout] overflow-position keyword for align and justify properties.
+        https://bugs.webkit.org/show_bug.cgi?id=144235
+
+        Reviewed by Sergio Villar Senin.
+
+        Implementation of overflow-keyword handling for Grid Layout on
+        align-self and justify-self properties.
+
+        * fast/css-grid-layout/grid-align-justify-overflow-expected.txt: Added.
+        * fast/css-grid-layout/grid-align-justify-overflow.html: Added.
+
</ins><span class="cx"> 2015-04-30  Jon Davis  &lt;jond@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: console should show an icon for console.info() messages
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutgridalignjustifyoverflowexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css-grid-layout/grid-align-justify-overflow-expected.txt (0 => 183660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/grid-align-justify-overflow-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-align-justify-overflow-expected.txt        2015-05-01 01:14:20 UTC (rev 183660)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+This test checks that the 'overflow' keyword is applied correctly for 'align' and 'justify' properties.
+
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssgridlayoutgridalignjustifyoverflowhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css-grid-layout/grid-align-justify-overflow.html (0 => 183660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css-grid-layout/grid-align-justify-overflow.html                                (rev 0)
+++ trunk/LayoutTests/fast/css-grid-layout/grid-align-justify-overflow.html        2015-05-01 01:14:20 UTC (rev 183660)
</span><span class="lines">@@ -0,0 +1,150 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;link href=&quot;resources/grid.css&quot; rel=&quot;stylesheet&quot;&gt;
+&lt;script src=&quot;../../resources/check-layout.js&quot;&gt;&lt;/script&gt;
+&lt;style&gt;
+body {
+    margin: 0;
+}
+.grid {
+    -webkit-grid-template-columns: 150px 150px;
+    -webkit-grid-template-rows: 120px 120px 120px;
+    width: -webkit-fit-content;
+    margin-bottom: 20px;
+}
+.cellOverflowWidth {
+    width: 180px;
+    height: 40px;
+}
+.cellOverflowHeight {
+    width: 50px;
+    height: 150px;
+}
+.cellWithNoOverflow {
+    width: 50px;
+    height: 40px;
+}
+.alignItemsCenter { align-items: center; }
+.alignItemsCenterSafe { align-items: center safe; }
+.alignItemsCenterTrue { align-items: center true; }
+.alignItemsEnd { align-items: end; }
+.alignItemsEndSafe { align-items: end safe; }
+.alignItemsEndTrue { align-items: end true; }
+.alignSelfCenter { align-self: center; }
+.alignSelfCenterSafe { align-self: center safe; }
+.alignSelfCenterTrue { align-self: center true; }
+.alignSelfEnd { align-self: end; }
+.alignSelfEndSafe { align-self: end safe; }
+.alignSelfEndTrue { align-self: end true; }
+.justifyItemsCenter { justify-items: center; }
+.justifyItemsCenterSafe { justify-items: center safe; }
+.justifyItemsCenterTrue { justify-items: center true; }
+.justifyItemsEnd { justify-items: end; }
+.justifyItemsEndSafe { justify-items: end safe; }
+.justifyItemsEndTrue { justify-items: end true; }
+.justifySelfCenter { justify-self: center; }
+.justifySelfCenterSafe { justify-self: center safe; }
+.justifySelfCenterTrue { justify-self: center true; }
+.justifySelfEnd { justify-self: end; }
+.thirdRowFirstColumn {
+    background-color: green;
+    -webkit-grid-column: 1;
+    -webkit-grid-row: 3;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;checkLayout('.grid')&quot;&gt;
+
+&lt;p&gt;This test checks that the 'overflow' keyword is applied correctly for 'align' and 'justify' properties.&lt;/p&gt;
+
+&lt;div style=&quot;position: relative&quot;&gt;
+    &lt;div class=&quot;grid alignItemsCenter justifyItemsCenter&quot; data-expected-width=&quot;300&quot; data-expected-height=&quot;360&quot;&gt;
+        &lt;div class=&quot;cellOverflowWidth  firstRowFirstColumn&quot; data-offset-x=&quot;-15&quot; data-offset-y=&quot;40&quot; data-expected-width=&quot;180&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow secondRowFirstColumn&quot; data-offset-x=&quot;50&quot; data-offset-y=&quot;160&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowFirstColumn&quot; data-offset-x=&quot;50&quot; data-offset-y=&quot;280&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow firstRowSecondColumn&quot; data-offset-x=&quot;200&quot; data-offset-y=&quot;40&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellOverflowWidth  secondRowSecondColumn&quot; data-offset-x=&quot;135&quot; data-offset-y=&quot;160&quot; data-expected-width=&quot;180&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowSecondColumn&quot; data-offset-x=&quot;200&quot; data-offset-y=&quot;280&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style=&quot;position: relative&quot;&gt;
+    &lt;div class=&quot;grid alignItemsCenterTrue justifyItemsCenterTrue&quot; data-expected-width=&quot;300&quot; data-expected-height=&quot;360&quot;&gt;
+        &lt;div class=&quot;cellOverflowHeight firstRowFirstColumn&quot; data-offset-x=&quot;50&quot; data-offset-y=&quot;-15&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;150&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow secondRowFirstColumn&quot; data-offset-x=&quot;50&quot; data-offset-y=&quot;160&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowFirstColumn&quot; data-offset-x=&quot;50&quot; data-offset-y=&quot;280&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow firstRowSecondColumn&quot; data-offset-x=&quot;200&quot; data-offset-y=&quot;40&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellOverflowHeight secondRowSecondColumn&quot; data-offset-x=&quot;200&quot; data-offset-y=&quot;105&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;150&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowSecondColumn&quot; data-offset-x=&quot;200&quot; data-offset-y=&quot;280&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style=&quot;position: relative&quot;&gt;
+    &lt;div class=&quot;grid alignItemsCenterSafe justifyItemsCenterSafe&quot; data-expected-width=&quot;300&quot; data-expected-height=&quot;360&quot;&gt;
+        &lt;div class=&quot;cellOverflowWidth  firstRowFirstColumn&quot; data-offset-x=&quot;0&quot; data-offset-y=&quot;40&quot; data-expected-width=&quot;180&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow secondRowFirstColumn&quot; data-offset-x=&quot;50&quot; data-offset-y=&quot;160&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowFirstColumn&quot; data-offset-x=&quot;50&quot; data-offset-y=&quot;280&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow firstRowSecondColumn&quot; data-offset-x=&quot;200&quot; data-offset-y=&quot;40&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellOverflowWidth  secondRowSecondColumn&quot; data-offset-x=&quot;150&quot; data-offset-y=&quot;160&quot; data-expected-width=&quot;180&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowSecondColumn&quot; data-offset-x=&quot;200&quot; data-offset-y=&quot;280&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style=&quot;position: relative&quot;&gt;
+    &lt;div class=&quot;grid alignItemsCenterSafe justifyItemsCenterSafe&quot; data-expected-width=&quot;300&quot; data-expected-height=&quot;360&quot;&gt;
+        &lt;div class=&quot;cellOverflowHeight firstRowFirstColumn&quot; data-offset-x=&quot;50&quot; data-offset-y=&quot;0&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;150&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow secondRowFirstColumn&quot; data-offset-x=&quot;50&quot; data-offset-y=&quot;160&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowFirstColumn&quot; data-offset-x=&quot;50&quot; data-offset-y=&quot;280&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow firstRowSecondColumn&quot; data-offset-x=&quot;200&quot; data-offset-y=&quot;40&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellOverflowHeight secondRowSecondColumn alignSelfCenterSafe justifySelfCenterSafe&quot; data-offset-x=&quot;200&quot; data-offset-y=&quot;120&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;150&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowSecondColumn&quot; data-offset-x=&quot;200&quot; data-offset-y=&quot;280&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style=&quot;position: relative&quot;&gt;
+    &lt;div class=&quot;grid alignItemsEnd justifyItemsEnd&quot; data-expected-width=&quot;300&quot; data-expected-height=&quot;360&quot;&gt;
+        &lt;div class=&quot;cellOverflowWidth  firstRowFirstColumn&quot; data-offset-x=&quot;-30&quot; data-offset-y=&quot;80&quot; data-expected-width=&quot;180&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow secondRowFirstColumn justifySelfCenter&quot; data-offset-x=&quot;50&quot; data-offset-y=&quot;200&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowFirstColumn&quot; data-offset-x=&quot;100&quot; data-offset-y=&quot;320&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow firstRowSecondColumn&quot; data-offset-x=&quot;250&quot; data-offset-y=&quot;80&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellOverflowWidth  secondRowSecondColumn&quot; data-offset-x=&quot;120&quot; data-offset-y=&quot;200&quot; data-expected-width=&quot;180&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowSecondColumn&quot; data-offset-x=&quot;250&quot; data-offset-y=&quot;320&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style=&quot;position: relative&quot;&gt;
+    &lt;div class=&quot;grid alignItemsEndTrue justifyItemsEndTrue&quot; data-expected-width=&quot;300&quot; data-expected-height=&quot;360&quot;&gt;
+        &lt;div class=&quot;cellOverflowHeight firstRowFirstColumn&quot; data-offset-x=&quot;100&quot; data-offset-y=&quot;-30&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;150&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow secondRowFirstColumn&quot; data-offset-x=&quot;100&quot; data-offset-y=&quot;200&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowFirstColumn&quot; data-offset-x=&quot;100&quot; data-offset-y=&quot;320&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow firstRowSecondColumn alignSelfCenter&quot; data-offset-x=&quot;250&quot; data-offset-y=&quot;40&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellOverflowHeight secondRowSecondColumn&quot; data-offset-x=&quot;250&quot; data-offset-y=&quot;90&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;150&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowSecondColumn&quot; data-offset-x=&quot;250&quot; data-offset-y=&quot;320&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style=&quot;position: relative&quot;&gt;
+    &lt;div class=&quot;grid alignItemsEndSafe justifyItemsEndSafe&quot; data-expected-width=&quot;300&quot; data-expected-height=&quot;360&quot;&gt;
+        &lt;div class=&quot;cellOverflowWidth  firstRowFirstColumn&quot; data-offset-x=&quot;0&quot; data-offset-y=&quot;80&quot; data-expected-width=&quot;180&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow secondRowFirstColumn justifySelfCenterTrue&quot; data-offset-x=&quot;50&quot; data-offset-y=&quot;200&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowFirstColumn&quot; data-offset-x=&quot;100&quot; data-offset-y=&quot;320&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow firstRowSecondColumn&quot; data-offset-x=&quot;250&quot; data-offset-y=&quot;80&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellOverflowWidth  secondRowSecondColumn&quot; data-offset-x=&quot;150&quot; data-offset-y=&quot;200&quot; data-expected-width=&quot;180&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowSecondColumn&quot; data-offset-x=&quot;250&quot; data-offset-y=&quot;320&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;div style=&quot;position: relative&quot;&gt;
+    &lt;div class=&quot;grid alignItemsEndSafe justifyItemsEndSafe&quot; data-expected-width=&quot;300&quot; data-expected-height=&quot;360&quot;&gt;
+        &lt;div class=&quot;cellOverflowHeight firstRowFirstColumn&quot; data-offset-x=&quot;100&quot; data-offset-y=&quot;0&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;150&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow secondRowFirstColumn&quot; data-offset-x=&quot;100&quot; data-offset-y=&quot;200&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowFirstColumn&quot; data-offset-x=&quot;100&quot; data-offset-y=&quot;320&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow firstRowSecondColumn alignSelfCenterTrue&quot; data-offset-x=&quot;250&quot; data-offset-y=&quot;40&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellOverflowHeight secondRowSecondColumn&quot; data-offset-x=&quot;250&quot; data-offset-y=&quot;120&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;150&quot;&gt;&lt;/div&gt;
+        &lt;div class=&quot;cellWithNoOverflow thirdRowSecondColumn&quot; data-offset-x=&quot;250&quot; data-offset-y=&quot;320&quot; data-expected-width=&quot;50&quot; data-expected-height=&quot;40&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (183659 => 183660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-01 01:10:43 UTC (rev 183659)
+++ trunk/Source/WebCore/ChangeLog        2015-05-01 01:14:20 UTC (rev 183660)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2015-04-30  Javier Fernandez  &lt;jfernandez@igalia.com&gt;
+
+        [CSS Grid Layout] overflow-position keyword for align and justify properties.
+        https://bugs.webkit.org/show_bug.cgi?id=144235
+
+        Reviewed by Sergio Villar Senin.
+
+        When the alignment subject is larger than the alignment container,
+        it will overflow. Some alignment modes, if honored in this
+        situation, may cause data loss; an overflow alignment mode can be
+        explicitly specified to avoid this.
+
+        This patch implements overflow-keyword handling for Grid Layout on
+        align-self and justify-self properties.
+
+        Test: fast/css-grid-layout/grid-align-justify-overflow.html
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::computeOverflowAlignmentOffset):
+        (WebCore::RenderGrid::rowPositionForChild):
+        (WebCore::RenderGrid::columnPositionForChild):
+        (WebCore::RenderGrid::rowAxisPositionForChild): Deleted.
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::resolveAlignmentData):
+        (WebCore::resolveJustificationData):
+        (WebCore::RenderStyle::resolveAlignment):
+        (WebCore::RenderStyle::resolveAlignmentOverflow):
+        (WebCore::RenderStyle::resolveJustification):
+        (WebCore::RenderStyle::resolveJustificationOverflow):
+        * rendering/style/RenderStyle.h:
+
</ins><span class="cx"> 2015-04-30  Jon Honeycutt  &lt;jhoneycutt@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Rebaseline bindings tests results after r183648.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderGridcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (183659 => 183660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderGrid.cpp        2015-05-01 01:10:43 UTC (rev 183659)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp        2015-05-01 01:14:20 UTC (rev 183660)
</span><span class="lines">@@ -1238,6 +1238,26 @@
</span><span class="cx">         m_rowPositions[i + 1] = m_rowPositions[i] + sizingData.rowTracks[i].baseSize();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline LayoutUnit computeOverflowAlignmentOffset(OverflowAlignment overflow, LayoutUnit trackBreadth, LayoutUnit childBreadth)
+{
+    LayoutUnit offset = trackBreadth - childBreadth;
+    switch (overflow) {
+    case OverflowAlignmentSafe:
+        // If overflow is 'safe', we have to make sure we don't overflow the 'start'
+        // edge (potentially cause some data loss as the overflow is unreachable).
+        return std::max&lt;LayoutUnit&gt;(0, offset);
+    case OverflowAlignmentTrue:
+    case OverflowAlignmentDefault:
+        // If we overflow our alignment container and overflow is 'true' (default), we
+        // ignore the overflow and just return the value regardless (which may cause data
+        // loss as we overflow the 'start' edge).
+        return offset;
+    }
+
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
</ins><span class="cx"> bool RenderGrid::allowedToStretchLogicalHeightForChild(const RenderBox&amp; child) const
</span><span class="cx"> {
</span><span class="cx">     return child.style().logicalHeight().isAuto() &amp;&amp; !child.style().marginBeforeUsing(&amp;style()).isAuto() &amp;&amp; !child.style().marginAfterUsing(&amp;style()).isAuto();
</span><span class="lines">@@ -1385,8 +1405,7 @@
</span><span class="cx">     LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPosition.toInt()];
</span><span class="cx">     LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.next().toInt()];
</span><span class="cx">     LayoutUnit startPosition = startOfRow + marginBeforeForChild(child);
</span><del>-    // FIXME: This should account for the grid item's &lt;overflow-position&gt;.
-    LayoutUnit offsetFromStartPosition = endOfRow - startOfRow - child.logicalHeight() - child.marginLogicalHeight();
</del><ins>+    LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(RenderStyle::resolveAlignmentOverflow(style(), child.style()), endOfRow - startOfRow, child.logicalHeight() + child.marginLogicalHeight());
</ins><span class="cx"> 
</span><span class="cx">     switch (columnAxisPositionForChild(child)) {
</span><span class="cx">     case GridAxisStart:
</span><span class="lines">@@ -1408,8 +1427,7 @@
</span><span class="cx">     LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInitialPosition.toInt()];
</span><span class="cx">     LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalPosition.next().toInt()];
</span><span class="cx">     LayoutUnit startPosition = startOfColumn + marginStartForChild(child);
</span><del>-    // FIXME: This should account for the grid item's &lt;overflow-position&gt;.
-    LayoutUnit offsetFromStartPosition = endOfColumn - startOfColumn - child.logicalWidth() - child.marginLogicalWidth();
</del><ins>+    LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(RenderStyle::resolveJustificationOverflow(style(), child.style()), endOfColumn - startOfColumn, child.logicalWidth() + child.marginLogicalWidth());
</ins><span class="cx"> 
</span><span class="cx">     switch (rowAxisPositionForChild(child)) {
</span><span class="cx">     case GridAxisStart:
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (183659 => 183660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2015-05-01 01:10:43 UTC (rev 183659)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2015-05-01 01:14:20 UTC (rev 183660)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #include &quot;StyleInheritedData.h&quot;
</span><span class="cx"> #include &quot;StyleResolver.h&quot;
</span><span class="cx"> #include &quot;StyleScrollSnapPoints.h&quot;
</span><ins>+#include &quot;StyleSelfAlignmentData.h&quot;
</ins><span class="cx"> #include &lt;wtf/MathExtras.h&gt;
</span><span class="cx"> #include &lt;wtf/StdLibExtras.h&gt;
</span><span class="cx"> #include &lt;algorithm&gt;
</span><span class="lines">@@ -171,21 +172,42 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-ItemPosition RenderStyle::resolveAlignment(const RenderStyle&amp; parentStyle, const RenderStyle&amp; childStyle, ItemPosition resolvedAutoPositionForRenderer)
</del><ins>+static inline StyleSelfAlignmentData resolveAlignmentData(const RenderStyle&amp; parentStyle, const RenderStyle&amp; childStyle, ItemPosition resolvedAutoPositionForRenderer)
</ins><span class="cx"> {
</span><span class="cx">     // The auto keyword computes to the parent's align-items computed value, or to &quot;stretch&quot;, if not set or &quot;auto&quot;.
</span><span class="cx">     if (childStyle.alignSelfPosition() == ItemPositionAuto)
</span><del>-        return (parentStyle.alignItemsPosition() == ItemPositionAuto) ? resolvedAutoPositionForRenderer : parentStyle.alignItemsPosition();
-    return childStyle.alignSelfPosition();
</del><ins>+        return (parentStyle.alignItemsPosition() == ItemPositionAuto) ? StyleSelfAlignmentData(resolvedAutoPositionForRenderer, OverflowAlignmentDefault) : parentStyle.alignItems();
+    return childStyle.alignSelf();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-ItemPosition RenderStyle::resolveJustification(const RenderStyle&amp; parentStyle, const RenderStyle&amp; childStyle, ItemPosition resolvedAutoPositionForLayoutObject)
</del><ins>+static inline StyleSelfAlignmentData resolveJustificationData(const RenderStyle&amp; parentStyle, const RenderStyle&amp; childStyle, ItemPosition resolvedAutoPositionForRenderer)
</ins><span class="cx"> {
</span><ins>+    // The auto keyword computes to the parent's justify-items computed value, or to &quot;stretch&quot;, if not set or &quot;auto&quot;.
</ins><span class="cx">     if (childStyle.justifySelfPosition() == ItemPositionAuto)
</span><del>-        return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? resolvedAutoPositionForLayoutObject : parentStyle.justifyItemsPosition();
-    return childStyle.justifySelfPosition();
</del><ins>+        return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? StyleSelfAlignmentData(resolvedAutoPositionForRenderer, OverflowAlignmentDefault) : parentStyle.justifyItems();
+    return childStyle.justifySelf();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ItemPosition RenderStyle::resolveAlignment(const RenderStyle&amp; parentStyle, const RenderStyle&amp; childStyle, ItemPosition resolvedAutoPositionForRenderer)
+{
+    return resolveAlignmentData(parentStyle, childStyle, resolvedAutoPositionForRenderer).position();
+}
+
+OverflowAlignment RenderStyle::resolveAlignmentOverflow(const RenderStyle&amp; parentStyle, const RenderStyle&amp; childStyle)
+{
+    return resolveJustificationData(parentStyle, childStyle, ItemPositionStretch).overflow();
+}
+
+ItemPosition RenderStyle::resolveJustification(const RenderStyle&amp; parentStyle, const RenderStyle&amp; childStyle, ItemPosition resolvedAutoPositionForRenderer)
+{
+    return resolveJustificationData(parentStyle, childStyle, resolvedAutoPositionForRenderer).position();
+}
+
+OverflowAlignment RenderStyle::resolveJustificationOverflow(const RenderStyle&amp; parentStyle, const RenderStyle&amp; childStyle)
+{
+    return resolveJustificationData(parentStyle, childStyle, ItemPositionStretch).overflow();
+}
+
</ins><span class="cx"> void RenderStyle::inheritFrom(const RenderStyle* inheritParent, IsAtShadowBoundary isAtShadowBoundary)
</span><span class="cx"> {
</span><span class="cx">     if (isAtShadowBoundary == AtShadowBoundary) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (183659 => 183660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.h        2015-05-01 01:10:43 UTC (rev 183659)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h        2015-05-01 01:14:20 UTC (rev 183660)
</span><span class="lines">@@ -492,7 +492,9 @@
</span><span class="cx">     static Ref&lt;RenderStyle&gt; createStyleInheritingFromPseudoStyle(const RenderStyle&amp; pseudoStyle);
</span><span class="cx"> 
</span><span class="cx">     static ItemPosition resolveAlignment(const RenderStyle&amp; parentStyle, const RenderStyle&amp; childStyle, ItemPosition resolvedAutoPositionForRenderer);
</span><del>-    static ItemPosition resolveJustification(const RenderStyle&amp; parentStyle, const RenderStyle&amp; childStyle, ItemPosition resolvedAutoPositionForLayoutObject);
</del><ins>+    static OverflowAlignment resolveAlignmentOverflow(const RenderStyle&amp; parentStyle, const RenderStyle&amp; childStyle);
+    static ItemPosition resolveJustification(const RenderStyle&amp; parentStyle, const RenderStyle&amp; childStyle, ItemPosition resolvedAutoPositionForRenderer);
+    static OverflowAlignment resolveJustificationOverflow(const RenderStyle&amp; parentStyle, const RenderStyle&amp; childStyle);
</ins><span class="cx"> 
</span><span class="cx">     enum IsAtShadowBoundary {
</span><span class="cx">         AtShadowBoundary,
</span></span></pre>
</div>
</div>

</body>
</html>