Bug 1206703 - [css-grid] In an empty grid all lines should be treated as 'auto' for abs.pos. items, i.e. snap to the padding edge. r=dholbert

This commit is contained in:
Mats Palmgren 2015-09-22 23:32:34 +02:00
parent 3b15454d43
commit 733619921a
6 changed files with 130 additions and 13 deletions

View File

@ -232,14 +232,15 @@ protected:
};
/**
* Return aLine if it's inside the aMin..aMax range (inclusive),
* otherwise return kAutoLine.
* Return aLine if it's inside the aMin..aMax range (inclusive), otherwise
* return kAutoLine. If the range is empty (aMin == aMax, i.e. there are
* no tracks in the grid) then aLine is outside.
*/
static int32_t
AutoIfOutside(int32_t aLine, int32_t aMin, int32_t aMax)
{
MOZ_ASSERT(aMin <= aMax);
if (aLine < aMin || aLine > aMax) {
if (aLine < aMin || aLine > aMax || aMin == aMax) {
return kAutoLine;
}
return aLine;

View File

@ -162,17 +162,17 @@ span {
</div>
<div class="grid" style="width:43px; height:53px">
<span class="abs" style="left:1px; top:3px; height:11px; width:5px;">a</span>
<span class="abs" style="right:5px; top:3px; height:11px; width:42px;">b</span>
<span class="abs" style="left:1px; bottom:1px; height:58px; width:5px;">c</span>
<span class="abs" style="right:5px; bottom:1px; height:58px; width:42px;">d</span>
<span class="abs" style="width:auto;height:auto; top:3px; left:1px; bottom:1px; right:5px">a</span>
<span class="abs" style="width:auto;height:auto; top:3px; left:1px; bottom:1px; right:5px">b</span>
<span class="abs" style="width:auto;height:auto; top:3px; left:1px; bottom:1px; right:5px">c</span>
<span class="abs" style="width:auto;height:auto; top:3px; left:1px; bottom:1px; right:5px">d</span>
</div>
<div class="grid" style="width:43px; height:28px; border-width:0;">
<span class="abs" style="right:48px; top:3px; height:11px; width:12px;"></span>
<span class="abs" style="right:48px; top:3px; height:22px; width:12px;"></span>
</div>
<div class="grid" style="width:43px; height:28px; border-width:0;">
<span class="abs" style="left:1px; bottom:57px; height:22px; width:5px;"></span>
<span class="abs" style="left:1px; bottom:57px; height:22px; width:12px;"></span>
</div>
<div class="grid" style="width:43px; height:28px; border-width:0;">
<span class="abs" style="right:48px; bottom:85px; height:22px; width:12px;"></span>

View File

@ -163,10 +163,10 @@ span {
</div>
<div class="grid" style="width:43px; height:53px">
<span class="abs" style="left:1px; top:3px; height:11px; width:5px;">a</span>
<span class="abs" style="right:5px; top:3px; height:11px; width:42px;">b</span>
<span class="abs" style="left:1px; bottom:1px; height:58px; width:5px;">c</span>
<span class="abs" style="right:5px; bottom:1px; height:58px; width:42px;">d</span>
<span class="abs" style="width:auto;height:auto; top:3px; left:1px; bottom:1px; right:5px">a</span>
<span class="abs" style="width:auto;height:auto; top:3px; left:1px; bottom:1px; right:5px">b</span>
<span class="abs" style="width:auto;height:auto; top:3px; left:1px; bottom:1px; right:5px">c</span>
<span class="abs" style="width:auto;height:auto; top:3px; left:1px; bottom:1px; right:5px">d</span>
</div>
</div>

View File

@ -0,0 +1,54 @@
<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<meta charset="utf-8">
<title>CSS Grid Test: abs pos areas in empty grid</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">
<style type="text/css">
div {
display: block;
position: relative;
float: left;
width: 20px;
height: 20px;
background: red;
}
span {
position: absolute;
top:0;left:0;bottom:0;right:0;
background: lime;
}
</style>
</head>
<body>
There should be no red areas.
<br clear="all">
<div><span class="cs"></span></div>
<div><span class="ce"></span></div>
<div><span class="rs"></span></div>
<div><span class="rs"></span></div>
<div><span class="cs ce"></span></div>
<div><span class="cs rs"></span></div>
<div><span class="cs re"></span></div>
<div><span class="ce rs"></span></div>
<div><span class="ce re"></span></div>
<div><span class="rs re"></span></div>
<div><span class="cs ce rs"></span></div>
<div><span class="cs ce re"></span></div>
<div><span class="rs re cs"></span></div>
<div><span class="rs re ce"></span></div>
<div><span class="cs ce rs re"></span></div>
</body>
</html>

View File

@ -0,0 +1,61 @@
<!DOCTYPE HTML>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
<meta charset="utf-8">
<title>CSS Grid Test: abs pos areas in empty grid</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">
<link rel="help" href="http://dev.w3.org/csswg/css-grid/#abspos-items">
<link rel="match" href="grid-abspos-items-011-ref.html">
<style type="text/css">
div {
display: grid;
position: relative;
float: left;
width: 20px;
height: 20px;
background: red;
}
span {
position: absolute;
top:0;left:0;bottom:0;right:0;
background: lime;
}
.cs { grid-column-start: 1; }
.ce { grid-column-end: 1; }
.rs { grid-row-start: 1; }
.re { grid-row-end: 1; }
</style>
</head>
<body>
There should be no red areas.
<br clear="all">
<div><span class="cs"></span></div>
<div><span class="ce"></span></div>
<div><span class="rs"></span></div>
<div><span class="rs"></span></div>
<div><span class="cs ce"></span></div>
<div><span class="cs rs"></span></div>
<div><span class="cs re"></span></div>
<div><span class="ce rs"></span></div>
<div><span class="ce re"></span></div>
<div><span class="rs re"></span></div>
<div><span class="cs ce rs"></span></div>
<div><span class="cs ce re"></span></div>
<div><span class="rs re cs"></span></div>
<div><span class="rs re ce"></span></div>
<div><span class="cs ce rs re"></span></div>
</body>
</html>

View File

@ -21,6 +21,7 @@ fails == grid-whitespace-handling-1b.xhtml grid-whitespace-handling-1-ref.xhtml
== grid-abspos-items-008.html grid-abspos-items-008-ref.html
== grid-abspos-items-009.html grid-abspos-items-009-ref.html
== grid-abspos-items-010.html grid-abspos-items-010-ref.html
== grid-abspos-items-011.html grid-abspos-items-011-ref.html
== grid-order-abspos-items-001.html grid-order-abspos-items-001-ref.html
== grid-order-placement-auto-001.html grid-order-placement-auto-001-ref.html
== grid-order-placement-definite-001.html grid-order-placement-definite-001-ref.html