Bug 1164918 - Allow multiple '.' per cell in grid-template-areas. r=dholbert

This commit is contained in:
Kyle Zentner 2015-05-21 15:28:00 -04:00
parent 0e88735a95
commit d9185dba03
5 changed files with 166 additions and 1 deletions

View File

@ -0,0 +1,79 @@
<!DOCTYPE HTML>
<html><head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
html,body {
font-size:16px;
font-family:monospace;
}
.grid {
height: 60px;
border: 1px solid green;
position: relative;
}
span {
position: absolute;
background: lime;
border: 1px solid black;
box-sizing: border-box;
}
.test1 span {
top: 0;
left: 40px;
width: 100px;
height: 20px;
}
.test2 .a {
top: 0;
left: 0;
width: 60px;
height: 40px;
}
.test2 .b {
top: 40px;
left: 20px;
width: 60px;
height: 20px;
}
.test2 .c {
top: 0;
left: 60px;
width: 60px;
height: 20px;
}
.test3 span {
top: 0;
left: 40px;
width: 100px;
height: 20px;
}
.test4 span {
top: 0;
left: 40px;
width: 100px;
height: 20px;
}
</style>
</head>
<body>
<div class="grid test1"><span>a</span></div>
<div class="grid test2">
<span class="a">a</span>
<span class="b">b</span>
<span class="c">c</span>
</div>
<div class="grid test3"><span>a</span></div>
<div class="grid test4"><span>a</span></div>
</body>
</html>

View File

@ -0,0 +1,76 @@
<!DOCTYPE HTML>
<html><head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
html,body {
font-size:16px;
font-family:monospace;
}
.grid {
display: grid;
border: 1px solid green;
grid-template-columns: 20px 20px 20px 20px;
grid-template-rows: 20px 20px 20px;
grid-auto-flow: row;
grid-auto-columns: 20px;
grid-auto-rows: 20px;
}
span {
background: lime;
border: 1px solid;
}
.test1 { grid-template-areas:'.. a a-start-.'; }
.test1 span { grid-column: a-start- / 8; }
.test2 {
grid-template-areas:
'a a a ... . .'
'a a a . . ..'
'.-b b . . ...'
;
}
.test2 .a {
grid-area: a;
}
.test2 .b {
grid-column: 2 / span 3;
grid-row: b;
}
.test2 .c {
grid-column: auto / span 3;
}
.test3 {
grid-template-areas:'.a.';
grid-template-columns: [a-start] 20px 20px [a-start-start] 20px [a-start-end];
}
.test3 span { grid-column: a-start / 8; }
.test4 {
grid-template-areas:'. .... .-a';
grid-template-columns: 20px [-a-start] 20px [-a-start] 20px [-a-end] 20px ;
}
.test4 span { grid-column: -a-start 2 / 8; }
</style>
</head>
<body>
<div class="grid test1"><span>a</span></div>
<div class="grid test2">
<span class="a">a</span>
<span class="b">b</span>
<span class="c">c</span>
</div>
<div class="grid test3"><span>a</span></div>
<div class="grid test4"><span>a</span></div>
</body>
</html>

View File

@ -5,6 +5,7 @@ fails == grid-whitespace-handling-1b.xhtml grid-whitespace-handling-1-ref.xhtml
== grid-whitespace-handling-2.xhtml grid-whitespace-handling-2-ref.xhtml
== grid-placement-definite-001.html grid-placement-definite-001-ref.html
== grid-placement-definite-002.html grid-placement-definite-002-ref.html
== grid-placement-definite-003.html grid-placement-definite-003-ref.html
== grid-placement-auto-row-sparse-001.html grid-placement-auto-row-sparse-001-ref.html
== grid-placement-auto-row-dense-001.html grid-placement-auto-row-dense-001-ref.html
== grid-placement-auto-col-sparse-001.html grid-placement-auto-col-sparse-001-ref.html

View File

@ -1362,6 +1362,10 @@ nsCSSGridTemplateAreaScanner::Next(nsCSSGridTemplateAreaToken& aTokenResult)
aTokenResult.isTrash = false;
} else if (ch == '.') {
// Null cell token
// Skip any other '.'
while (mOffset < mCount && mBuffer[mOffset] == '.') {
mOffset++;
}
aTokenResult.mName.Truncate();
aTokenResult.isTrash = false;
} else {

View File

@ -5889,6 +5889,11 @@ if (SpecialPowers.getBoolPref("layout.css.grid.enabled")) {
"'1a-é_ .' \"b .\"",
"' Z\t\\aZ' 'Z Z'",
" '. . a b' '. .a b' ",
"'a.b' '. . .'",
"'.' '..'",
"'...' '.'",
"'...-blah' '. .'",
"'.. ..' '.. ...'",
],
invalid_values: [
"'a b' 'a/b'",