Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixed

- Grid: items with an `auto` start line and a definite end line (e.g. `grid-column: auto / 1`) no longer cause a phantom zero-sized positive implicit track to be created. This previously caused `grid_template_columns()`/`grid_template_rows()` to serialize an extra `0px` track (e.g. `10px 0px` instead of `10px`)
- Grid: fixed `DetailedGridTracksInfo::resolve_absolute_grid_area` edge cases: placements are now normalized (lines sorted, named lines resolved) *before* out-of-range lines are treated as `auto`, and axes with no tracks resolve against the axis' single content-aligned grid line instead of falling back to the padding edge
- Block/float: absorb `f32` rounding errors in horizontal fit checks, preventing floats from spuriously wrapping when percentage widths and margins sum to exactly 100% of the container (#1161).
- Flexbox: main-axis margins are no longer dropped from an item's intrinsic main-size contribution when the contribution is floored by the item's flex basis (column containers). This fixes negative margins being ignored on flex items with `flex-grow` (#1162) and on descendants containing an `overflow: hidden` grid item (#1163).
Expand Down
3 changes: 2 additions & 1 deletion src/compute/grid/implicit_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ fn child_min_line_max_line_span<S: CheapCloneStr>(
(Line(track), Span(_)) => track,

// End track specified
(Auto, Line(track)) => track,
// An auto start with a definite end resolves to a span of 1 ending at that line
(Auto, Line(track)) => track - 1,
(Span(span), Line(track)) => track - span,

// Only spans or autos
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script src="../../scripts/gentest/test_helper.js"></script>
<link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
<title>
Test description
</title>
</head>
<body>

<div id="test-root" style="display: grid; width: 10px; height: 10px;">
<div style="grid-column: auto / 1; width: 10px; height: 10px;"></div>
</div>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script src="../../scripts/gentest/test_helper.js"></script>
<link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
<title>
Test description
</title>
</head>
<body>

<div id="test-root" style="display: grid; width: 10px; height: 10px;">
<div style="grid-row: auto / 1; width: 10px; height: 10px;"></div>
</div>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<test name="grid_template_serialization_negative_implicit_column__border_box_ltr" use-rounding="true">
<viewport width="max-content" height="max-content"/>
<input>
<div display="grid" direction="ltr" width="10px" height="10px">
<div direction="ltr" width="10px" height="10px" grid-column-end="1"/>
</div>
</input>
<expectations>
<node x="0" y="0" width="10" height="10" resolved-rows="10px" resolved-columns="10px">
<node x="0" y="0" width="10" height="10"/>
</node>
</expectations>
</test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<test name="grid_template_serialization_negative_implicit_column__border_box_rtl" use-rounding="true">
<viewport width="max-content" height="max-content"/>
<input>
<div display="grid" direction="rtl" width="10px" height="10px">
<div direction="rtl" width="10px" height="10px" grid-column-end="1"/>
</div>
</input>
<expectations>
<node x="0" y="0" width="10" height="10" resolved-rows="10px" resolved-columns="10px">
<node x="0" y="0" width="10" height="10"/>
</node>
</expectations>
</test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<test name="grid_template_serialization_negative_implicit_column__content_box_ltr" use-rounding="true">
<viewport width="max-content" height="max-content"/>
<input>
<div display="grid" box-sizing="content-box" direction="ltr" width="10px" height="10px">
<div box-sizing="content-box" direction="ltr" width="10px" height="10px" grid-column-end="1"/>
</div>
</input>
<expectations>
<node x="0" y="0" width="10" height="10" resolved-rows="10px" resolved-columns="10px">
<node x="0" y="0" width="10" height="10"/>
</node>
</expectations>
</test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<test name="grid_template_serialization_negative_implicit_column__content_box_rtl" use-rounding="true">
<viewport width="max-content" height="max-content"/>
<input>
<div display="grid" box-sizing="content-box" direction="rtl" width="10px" height="10px">
<div box-sizing="content-box" direction="rtl" width="10px" height="10px" grid-column-end="1"/>
</div>
</input>
<expectations>
<node x="0" y="0" width="10" height="10" resolved-rows="10px" resolved-columns="10px">
<node x="0" y="0" width="10" height="10"/>
</node>
</expectations>
</test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<test name="grid_template_serialization_negative_implicit_row__border_box_ltr" use-rounding="true">
<viewport width="max-content" height="max-content"/>
<input>
<div display="grid" direction="ltr" width="10px" height="10px">
<div direction="ltr" width="10px" height="10px" grid-row-end="1"/>
</div>
</input>
<expectations>
<node x="0" y="0" width="10" height="10" resolved-rows="10px" resolved-columns="10px">
<node x="0" y="0" width="10" height="10"/>
</node>
</expectations>
</test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<test name="grid_template_serialization_negative_implicit_row__border_box_rtl" use-rounding="true">
<viewport width="max-content" height="max-content"/>
<input>
<div display="grid" direction="rtl" width="10px" height="10px">
<div direction="rtl" width="10px" height="10px" grid-row-end="1"/>
</div>
</input>
<expectations>
<node x="0" y="0" width="10" height="10" resolved-rows="10px" resolved-columns="10px">
<node x="0" y="0" width="10" height="10"/>
</node>
</expectations>
</test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<test name="grid_template_serialization_negative_implicit_row__content_box_ltr" use-rounding="true">
<viewport width="max-content" height="max-content"/>
<input>
<div display="grid" box-sizing="content-box" direction="ltr" width="10px" height="10px">
<div box-sizing="content-box" direction="ltr" width="10px" height="10px" grid-row-end="1"/>
</div>
</input>
<expectations>
<node x="0" y="0" width="10" height="10" resolved-rows="10px" resolved-columns="10px">
<node x="0" y="0" width="10" height="10"/>
</node>
</expectations>
</test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<test name="grid_template_serialization_negative_implicit_row__content_box_rtl" use-rounding="true">
<viewport width="max-content" height="max-content"/>
<input>
<div display="grid" box-sizing="content-box" direction="rtl" width="10px" height="10px">
<div box-sizing="content-box" direction="rtl" width="10px" height="10px" grid-row-end="1"/>
</div>
</input>
<expectations>
<node x="0" y="0" width="10" height="10" resolved-rows="10px" resolved-columns="10px">
<node x="0" y="0" width="10" height="10"/>
</node>
</expectations>
</test>
48 changes: 48 additions & 0 deletions tests/xml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33515,6 +33515,54 @@ mod grid {
crate::run_xml_test("grid", "grid_template_serialization_named_lines__content_box_rtl");
}

#[cfg(feature = "grid")]
#[test]
fn grid_template_serialization_negative_implicit_column__border_box_ltr() {
crate::run_xml_test("grid", "grid_template_serialization_negative_implicit_column__border_box_ltr");
}

#[cfg(feature = "grid")]
#[test]
fn grid_template_serialization_negative_implicit_column__content_box_ltr() {
crate::run_xml_test("grid", "grid_template_serialization_negative_implicit_column__content_box_ltr");
}

#[cfg(feature = "grid")]
#[test]
fn grid_template_serialization_negative_implicit_column__border_box_rtl() {
crate::run_xml_test("grid", "grid_template_serialization_negative_implicit_column__border_box_rtl");
}

#[cfg(feature = "grid")]
#[test]
fn grid_template_serialization_negative_implicit_column__content_box_rtl() {
crate::run_xml_test("grid", "grid_template_serialization_negative_implicit_column__content_box_rtl");
}

#[cfg(feature = "grid")]
#[test]
fn grid_template_serialization_negative_implicit_row__border_box_ltr() {
crate::run_xml_test("grid", "grid_template_serialization_negative_implicit_row__border_box_ltr");
}

#[cfg(feature = "grid")]
#[test]
fn grid_template_serialization_negative_implicit_row__content_box_ltr() {
crate::run_xml_test("grid", "grid_template_serialization_negative_implicit_row__content_box_ltr");
}

#[cfg(feature = "grid")]
#[test]
fn grid_template_serialization_negative_implicit_row__border_box_rtl() {
crate::run_xml_test("grid", "grid_template_serialization_negative_implicit_row__border_box_rtl");
}

#[cfg(feature = "grid")]
#[test]
fn grid_template_serialization_negative_implicit_row__content_box_rtl() {
crate::run_xml_test("grid", "grid_template_serialization_negative_implicit_row__content_box_rtl");
}

#[cfg(feature = "grid")]
#[test]
fn grid_template_serialization_none__border_box_ltr() {
Expand Down