Skip to content

Commit

Permalink
[Masonry] Introduce parsing for masonry-flow.
Browse files Browse the repository at this point in the history
This CL introduces the parsing for the CSS property masonry-flow, which
is the shorthand for masonry-direction and masonry-fill.

This is part of: https://chromestatus.com/feature/5149560434589696

The properties are behind the CSSMasonryLayout feature flag. The spec
definition for masonry-flow can be found here:
https://tabatkins.github.io/specs/css-masonry/#masonry-flow.

Bug: 343257585
Change-Id: Icaba5964a6b377a13958e404f7f464e933efc209
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6106736
Commit-Queue: Celeste Pan <[email protected]>
Reviewed-by: Kurt Catti-Schmidt <[email protected]>
Reviewed-by: Alison Maher <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1403080}
  • Loading branch information
celestepan authored and chromium-wpt-export-bot committed Jan 7, 2025
1 parent 48f9ec1 commit 22334a6
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
28 changes: 28 additions & 0 deletions css/css-masonry/tentative/parsing/masonry-flow-computed.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<title>CSS Masonry: masonry-flow getComputedStyle()</title>
<link rel="author" title="Celeste Pan" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-grid-3">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<script src="/css/support/inheritance-testcommon.js"></script>
</head>
<body>
<div id="target"></div>
<script>
test_computed_value("masonry-flow", "column normal");
test_computed_value("masonry-flow", "column reverse");

test_computed_value("masonry-flow", "row normal");
test_computed_value("masonry-flow", "row reverse");

test_computed_value("masonry-flow", "column-reverse normal");
test_computed_value("masonry-flow", "column-reverse reverse");

test_computed_value("masonry-flow", "row-reverse normal");
test_computed_value("masonry-flow", "row-reverse reverse");
</script>
</body>
</html>
23 changes: 23 additions & 0 deletions css/css-masonry/tentative/parsing/masonry-flow-invalid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masonry: masonry-flow parsing</title>
<link rel="author" title="Celeste Pan" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-grid-3">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
</head>
<body>
<script>
test_invalid_value("masonry-flow", "nowrap row nowrap");
test_invalid_value("masonry-flow", "column wrap column");
test_invalid_value("masonry-flow", "reverse-column column");
test_invalid_value("masonry-flow", "reverse-row, row");
test_invalid_value("masonry-flow", "normal row-reverse");
test_invalid_value("masonry-flow", "reverse column");
test_invalid_value("masonry-flow", "auto, auto");
</script>
</body>
</html>
60 changes: 60 additions & 0 deletions css/css-masonry/tentative/parsing/masonry-flow-valid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masonry: parsing masonry-flow with valid values</title>
<link rel="author" title="Celeste Pan" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-grid-3">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/parsing-testcommon.js"></script>
<script src="/css/support/shorthand-testcommon.js"></script>
</head>
<body>
<script>
test_valid_value("masonry-flow", "column normal");
test_valid_value("masonry-flow", "column reverse");
test_shorthand_value('masonry-flow', 'column normal', {
'masonry-direction': 'column',
'masonry-fill': 'normal'
});
test_shorthand_value('masonry-flow', 'column reverse', {
'masonry-direction': 'column',
'masonry-fill': 'reverse'
});

test_valid_value("masonry-flow", "row normal");
test_valid_value("masonry-flow", "row reverse");
test_shorthand_value('masonry-flow', 'row normal', {
'masonry-direction': 'row',
'masonry-fill': 'normal'
});
test_shorthand_value('masonry-flow', 'row reverse', {
'masonry-direction': 'row',
'masonry-fill': 'reverse'
});

test_valid_value("masonry-flow", "column-reverse normal");
test_valid_value("masonry-flow", "column-reverse reverse");
test_shorthand_value('masonry-flow', 'column-reverse normal', {
'masonry-direction': 'column-reverse',
'masonry-fill': 'normal'
});
test_shorthand_value('masonry-flow', 'column-reverse reverse', {
'masonry-direction': 'column-reverse',
'masonry-fill': 'reverse'
});

test_valid_value("masonry-flow", "row-reverse normal");
test_valid_value("masonry-flow", "row-reverse reverse");
test_shorthand_value('masonry-flow', 'row-reverse normal', {
'masonry-direction': 'row-reverse',
'masonry-fill': 'normal'
});
test_shorthand_value('masonry-flow', 'row-reverse reverse', {
'masonry-direction': 'row-reverse',
'masonry-fill': 'reverse'
});
</script>
</body>
</html>

0 comments on commit 22334a6

Please sign in to comment.