<!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>[243432] 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/243432">243432</a></dd>
<dt>Author</dt> <dd>rego@igalia.com</dd>
<dt>Date</dt> <dd>2019-03-25 00:46:54 -0700 (Mon, 25 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[css-grid] Fix grid container baseline alignment for orthogonal items
https://bugs.webkit.org/show_bug.cgi?id=196141

Reviewed by Javier Fernandez.

LayoutTests/imported/w3c:

Imported test from WPT. This patch is making some of the test cases pass but not all.
Some are still failing in WebKit as it never uses the central baseline on vertical writing modes (bug #94410),
also "text-orientation" is not supported yet in WebKit (bug #196139),
even the prefixed version "-webkit-text-orientation" doesn't fix anything in this test case.

* web-platform-tests/css/css-grid/alignment/grid-container-baseline-001-expected.txt: Added.
* web-platform-tests/css/css-grid/alignment/grid-container-baseline-001.html: Added.
* web-platform-tests/css/css-grid/alignment/w3c-import.log:

Source/WebCore:

Grid container baseline was wrongly computed when done in reference to an orthogonal item.

Test: imported/w3c/web-platform-tests/css/css-grid/alignment/grid-container-baseline-001.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::firstLineBaseline const): Simple change to use logicalTopForChild()
so it takes into account grid container and item writing modes.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscsscssgridalignmentw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/w3c-import.log</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderGridcpp">trunk/Source/WebCore/rendering/RenderGrid.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscsscssgridalignmentgridcontainerbaseline001expectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-container-baseline-001-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscsscssgridalignmentgridcontainerbaseline001html">trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-container-baseline-001.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (243431 => 243432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog 2019-03-25 06:24:45 UTC (rev 243431)
+++ trunk/LayoutTests/imported/w3c/ChangeLog    2019-03-25 07:46:54 UTC (rev 243432)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2019-03-25  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        [css-grid] Fix grid container baseline alignment for orthogonal items
+        https://bugs.webkit.org/show_bug.cgi?id=196141
+
+        Reviewed by Javier Fernandez.
+
+        Imported test from WPT. This patch is making some of the test cases pass but not all.
+        Some are still failing in WebKit as it never uses the central baseline on vertical writing modes (bug #94410),
+        also "text-orientation" is not supported yet in WebKit (bug #196139),
+        even the prefixed version "-webkit-text-orientation" doesn't fix anything in this test case.
+
+        * web-platform-tests/css/css-grid/alignment/grid-container-baseline-001-expected.txt: Added.
+        * web-platform-tests/css/css-grid/alignment/grid-container-baseline-001.html: Added.
+        * web-platform-tests/css/css-grid/alignment/w3c-import.log:
+
</ins><span class="cx"> 2019-03-22  Alicia Boya García  <aboya@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [MSE][GStreamer] Don't construct segments on PlaybackPipeline::flush
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscsscssgridalignmentgridcontainerbaseline001expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-container-baseline-001-expected.txt (0 => 243432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-container-baseline-001-expected.txt                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-container-baseline-001-expected.txt   2019-03-25 07:46:54 UTC (rev 243432)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+ 





















+
+PASS .wrapper 1 
+PASS .wrapper 2 
+FAIL .wrapper 3 assert_equals: 
+<div class="wrapper" style="writing-mode: vertical-rl;">
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+  <div class="grid">
+    <div class="i1"></div>
+    <div class="i2" style="writing-mode: horizontal-tb;" data-offset-x="75"></div>
+    <div class="i3"></div>
+  </div>
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+</div>
+offsetLeft expected 65 but got 75
+FAIL .wrapper 4 assert_equals: 
+<div class="wrapper" style="writing-mode: vertical-rl;">
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+  <div class="grid">
+    <div class="i1"></div>
+    <div class="i2" data-offset-x="75"></div>
+    <div class="i3"></div>
+  </div>
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+</div>
+offsetLeft expected 65 but got 75
+PASS .wrapper 5 
+PASS .wrapper 6 
+FAIL .wrapper 7 assert_equals: 
+<div class="wrapper" style="writing-mode: vertical-lr;">
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+  <div class="grid">
+    <div class="i1"></div>
+    <div class="i2" style="writing-mode: horizontal-tb;" data-offset-x="0"></div>
+    <div class="i3"></div>
+  </div>
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+</div>
+offsetLeft expected 65 but got 75
+FAIL .wrapper 8 assert_equals: 
+<div class="wrapper" style="writing-mode: vertical-lr;">
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+  <div class="grid">
+    <div class="i1"></div>
+    <div class="i2" data-offset-x="0"></div>
+    <div class="i3"></div>
+  </div>
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+</div>
+offsetLeft expected 65 but got 75
+PASS .wrapper 9 
+PASS .wrapper 10 
+PASS .wrapper 11 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscsscssgridalignmentgridcontainerbaseline001html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-container-baseline-001.html (0 => 243432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-container-baseline-001.html                                (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-container-baseline-001.html   2019-03-25 07:46:54 UTC (rev 243432)
</span><span class="lines">@@ -0,0 +1,153 @@
</span><ins>+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid container baseline</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-baselines">
+<meta name="assert" content="Grid container baseline should match the element with 'align-self: baseline' in the first row, even if it's an orthogonal element.">
+<style>
+.wrapper {
+  position: relative;
+  margin: 10px;
+}
+
+.grid {
+  display: inline-grid;
+  grid-auto-flow: column;
+  background: grey;
+}
+
+.i1 {
+  width: 150px;
+  height: 100px;
+  background: magenta;
+}
+
+.i2 {
+  align-self: baseline;
+  width: 75px;
+  height: 50px;
+  background: cyan;
+}
+
+.i3 {
+  width: 100px;
+  height: 75px;
+  background: yellow;
+}
+</style>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/check-layout-th.js"></script>
+<body onload="checkLayout('.wrapper')">
+
+<div class="wrapper" style="writing-mode: horizontal-tb;">
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-y="40"></div>
+  <div class="grid">
+    <div class="i1"></div>
+    <div class="i2" data-offset-y="0"></div>
+    <div class="i3"></div>
+  </div>
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-y="40"></div>
+</div>
+
+<div class="wrapper" style="writing-mode: horizontal-tb;">
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-y="40"></div>
+  <div class="grid">
+    <div class="i1"></div>
+    <div class="i2" style="writing-mode: vertical-lr;" data-offset-y="0"></div>
+    <div class="i3"></div>
+  </div>
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-y="40"></div>
+</div>
+
+<div class="wrapper" style="writing-mode: horizontal-tb;">
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-y="40"></div>
+  <div class="grid">
+    <div class="i1"></div>
+    <div class="i2" style="writing-mode: vertical-rl;" data-offset-y="0"></div>
+    <div class="i3"></div>
+  </div>
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-y="40"></div>
+</div>
+
+<div class="wrapper" style="writing-mode: vertical-lr;">
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+  <div class="grid">
+    <div class="i1"></div>
+    <div class="i2" data-offset-x="0"></div>
+    <div class="i3"></div>
+  </div>
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+</div>
+
+<div class="wrapper" style="writing-mode: vertical-lr;">
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+  <div class="grid">
+    <div class="i1"></div>
+    <div class="i2" style="writing-mode: horizontal-tb;" data-offset-x="0"></div>
+    <div class="i3"></div>
+  </div>
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+</div>
+
+<div class="wrapper" style="writing-mode: vertical-lr; -webkit-text-orientation: sideways;">
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="75"></div>
+  <div class="grid">
+    <div class="i1"></div>
+    <div class="i2" data-offset-x="0"></div>
+    <div class="i3"></div>
+  </div>
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="75"></div>
+</div>
+
+<div class="wrapper" style="writing-mode: vertical-lr; -webkit-text-orientation: sideways;">
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="75"></div>
+  <div class="grid">
+    <div class="i1"></div>
+    <div class="i2" style="writing-mode: horizontal-tb;" data-offset-x="0"></div>
+    <div class="i3"></div>
+  </div>
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="75"></div>
+</div>
+
+<div class="wrapper" style="writing-mode: vertical-rl;">
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+  <div class="grid">
+    <div class="i1"></div>
+    <div class="i2" data-offset-x="75"></div>
+    <div class="i3"></div>
+  </div>
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+</div>
+
+<div class="wrapper" style="writing-mode: vertical-rl;">
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+  <div class="grid">
+    <div class="i1"></div>
+    <div class="i2" style="writing-mode: horizontal-tb;" data-offset-x="75"></div>
+    <div class="i3"></div>
+  </div>
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="65"></div>
+</div>
+
+<div class="wrapper" style="writing-mode: vertical-rl; -webkit-text-orientation: sideways;">
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="75"></div>
+  <div class="grid">
+    <div class="i1"></div>
+    <div class="i2" data-offset-x="75"></div>
+    <div class="i3"></div>
+  </div>
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="75"></div>
+</div>
+
+<div class="wrapper" style="writing-mode: vertical-rl; -webkit-text-orientation: sideways;">
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="75"></div>
+  <div class="grid">
+    <div class="i1"></div>
+    <div class="i2" style="writing-mode: horizontal-tb;" data-offset-x="75"></div>
+    <div class="i3"></div>
+  </div>
+  <div style="display: inline-block; width: 20px; height: 10px; background: black" data-offset-x="75"></div>
+</div>
+
+</body>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscsscssgridalignmentw3cimportlog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/w3c-import.log (243431 => 243432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/w3c-import.log  2019-03-25 06:24:45 UTC (rev 243431)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/w3c-import.log     2019-03-25 07:46:54 UTC (rev 243432)
</span><span class="lines">@@ -81,6 +81,7 @@
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-column-axis-self-baseline-synthesized-002.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-column-axis-self-baseline-synthesized-003.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-column-axis-self-baseline-synthesized-004.html
</span><ins>+/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-container-baseline-001.html
</ins><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-001.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-002.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-content-distribution-001-expected.html
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (243431 => 243432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-03-25 06:24:45 UTC (rev 243431)
+++ trunk/Source/WebCore/ChangeLog      2019-03-25 07:46:54 UTC (rev 243432)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2019-03-25  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        [css-grid] Fix grid container baseline alignment for orthogonal items
+        https://bugs.webkit.org/show_bug.cgi?id=196141
+
+        Reviewed by Javier Fernandez.
+
+        Grid container baseline was wrongly computed when done in reference to an orthogonal item.
+
+        Test: imported/w3c/web-platform-tests/css/css-grid/alignment/grid-container-baseline-001.html
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::firstLineBaseline const): Simple change to use logicalTopForChild()
+        so it takes into account grid container and item writing modes.
+
</ins><span class="cx"> 2019-03-24  Michael Catanzaro  <mcatanzaro@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, fix -Wpessimizing-move warning
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderGridcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (243431 => 243432)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderGrid.cpp    2019-03-25 06:24:45 UTC (rev 243431)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp       2019-03-25 07:46:54 UTC (rev 243432)
</span><span class="lines">@@ -1260,7 +1260,7 @@
</span><span class="cx">         // FIXME: We should pass |direction| into firstLineBaseline and stop bailing out if we're a writing
</span><span class="cx">         // mode root. This would also fix some cases where the grid is orthogonal to its container.
</span><span class="cx">         LineDirectionMode direction = isHorizontalWritingMode() ? HorizontalLine : VerticalLine;
</span><del>-        return synthesizedBaselineFromBorderBox(*baselineChild, direction) + baselineChild->logicalTop().toInt();
</del><ins>+        return synthesizedBaselineFromBorderBox(*baselineChild, direction) + logicalTopForChild(*baselineChild).toInt();
</ins><span class="cx">     }
</span><span class="cx">     return baseline.value() + baselineChild->logicalTop().toInt();
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>