Bug 1500708 - [cssom][css-grid] 'grid-auto-flow: row dense' should serialize to 'dense' since 'row' is implied. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D28058

--HG--
extra : rebase_source : dd8109fa0853bc73e8859198196aa52b5523786a
This commit is contained in:
Mats Palmgren 2019-04-18 01:16:03 +02:00
Родитель 1bbce77110
Коммит fcba4dfac7
6 изменённых файлов: 17 добавлений и 14 удалений

Просмотреть файл

@ -203,7 +203,7 @@ grid_test_cases = grid_template_test_cases.concat([
},
{
specified: "auto-flow dense / 0",
gridAutoFlow: "row dense",
gridAutoFlow: "dense",
gridAutoRows: "auto",
gridTemplateColumns: "0px",
},
@ -238,7 +238,7 @@ grid_test_cases = grid_template_test_cases.concat([
},
{
specified: "dense auto-flow minmax(min-content, 2fr) / 0",
gridAutoFlow: "row dense",
gridAutoFlow: "dense",
gridAutoRows: "minmax(min-content, 2fr)",
gridAutoColumns: "auto",
gridTemplateColumns: "0px",

Просмотреть файл

@ -460,6 +460,11 @@ pub enum AutoFlow {
Column,
}
/// If `dense` is specified, `row` is implied.
fn is_row_dense(autoflow: &AutoFlow, dense: &bool) -> bool {
*autoflow == AutoFlow::Row && *dense
}
#[derive(
Clone,
Copy,
@ -477,6 +482,7 @@ pub enum AutoFlow {
/// specifying exactly how auto-placed items get flowed into the grid
pub struct GridAutoFlow {
/// Specifiy how auto-placement algorithm fills each `row` or `column` in turn
#[css(contextual_skip_if = "is_row_dense")]
pub autoflow: AutoFlow,
/// Specify use `dense` packing algorithm or not
#[css(represents_keyword)]

Просмотреть файл

@ -20,9 +20,6 @@
[grid-template.reset]
expected: FAIL
[grid-auto-flow.dense]
expected: FAIL
[grid-row-start.span <custom-ident>]
expected: FAIL

Просмотреть файл

@ -142,8 +142,8 @@
initial: 'row',
'row': ['row', 'row'],
'column': ['column', 'column'],
'dense': ['dense', 'row dense'],
'row dense': ['row dense', 'row dense'],
'dense': ['dense', 'dense'],
'row dense': ['dense', 'dense'],
'column dense': ['column dense', 'column dense'],
'reset': ['row', 'row'],
},

Просмотреть файл

@ -13,13 +13,13 @@
<script>
test_computed_value("grid-auto-flow", "row");
test_computed_value("grid-auto-flow", "column");
test_computed_value("grid-auto-flow", "row dense");
test_computed_value("grid-auto-flow", "row dense", "dense");
test_computed_value("grid-auto-flow", "column dense");
test_computed_value("grid-auto-flow", "dense row", "row dense");
test_computed_value("grid-auto-flow", "dense row", "dense");
test_computed_value("grid-auto-flow", "dense column", "column dense");
test_computed_value("grid-auto-flow", "dense", "row dense");
test_computed_value("grid-auto-flow", "dense", "dense");
</script>
</body>
</html>

Просмотреть файл

@ -14,11 +14,11 @@
<script>
test_valid_value("grid-auto-flow", "row");
test_valid_value("grid-auto-flow", "column");
test_valid_value("grid-auto-flow", "row dense");
test_valid_value("grid-auto-flow", "row dense", "dense");
test_valid_value("grid-auto-flow", "dense row", "dense");
test_valid_value("grid-auto-flow", "dense");
test_valid_value("grid-auto-flow", "column dense");
test_valid_value("grid-auto-flow", "dense column", "column dense");
// Blink/WebKit "dense", Edge/Firefox "row dense"
test_valid_value("grid-auto-flow", "dense", ["dense", "row dense"]);
</script>
</body>
</html>