这是indexloc提供的服务,不要输入任何密码
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
10 changes: 10 additions & 0 deletions src/compute/flexbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1396,6 +1396,16 @@ fn calculate_cross_size(flex_lines: &mut [FlexLine], node_size: Size<Option<f32>
})
.fold(0.0, |acc, x| acc.max(x));
}
// If the flex container is single-line, then clamp the line’s cross-size to be within the container’s computed min and max cross sizes.
if !constants.is_wrap {
let cross_axis_padding_border = constants.content_box_inset.cross_axis_sum(constants.dir);
let cross_min_size = constants.min_size.cross(constants.dir);
let cross_max_size = constants.max_size.cross(constants.dir);
flex_lines[0].cross_size = flex_lines[0].cross_size.maybe_clamp(
cross_min_size.maybe_sub(cross_axis_padding_border),
cross_max_size.maybe_sub(cross_axis_padding_border),
);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!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">
<div style="display: flex; width: 100px; height: 100px; align-items: center; align-content: flex-start; flex-wrap: wrap;">
<div style="height: 10px; width: 10px;"></div>
<div style="height: 20px; width: 10px;"></div>
</div>
<div style="display: flex; width: 100px; height: 100px; align-items: center; flex-wrap: wrap;">
<div style="height: 10px; width: 10px;"></div>
<div style="height: 20px; width: 10px;"></div>
</div>
</div>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!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="width: 100px; height: 100px;">
<div style="display: flex; width: 100px; height: 100px; max-height: 50%; align-items: center; align-content: flex-start;">
<div style="height: 10px; width: 10px;"></div>
<div style="height: 20px; width: 10px;"></div>
</div>
</div>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!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="width: 100px; max-height: 100px; align-items: center; align-content: flex-start;">
<div style="height: 50px; width: 10px;"></div>
<div style="height: 150px; width: 10px;"></div>
</div>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!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: block;">
<div style="display: flex; width: 100px; max-height: 100px; align-items: center; align-content: flex-start; padding: 10px; border-width: 10px;">
<div style="height: 10px; width: 10px;"></div>
<div style="height: 150px; width: 10px;"></div>
</div>
<div style="display: flex; width: 100px; max-height: 100px; align-items: center; align-content: flex-start; padding: 10px; border-width: 10px; flex-wrap: wrap;">
<div style="height: 10px; width: 10px;"></div>
<div style="height: 150px; width: 10px;"></div>
</div>
</div>


</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!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="width: 100px; height: 100px;">
<div style="display: flex; width: 100px; min-height: 100%; align-items: center; align-content: flex-start;">
<div style="height: 10px; width: 10px;"></div>
<div style="height: 20px; width: 10px;"></div>
</div>
</div>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!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="width: 100px; min-height: 100px; align-items: center; align-content: flex-start;">
<div style="height: 10px; width: 10px;"></div>
<div style="height: 20px; width: 10px;"></div>
</div>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!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">
<div style="display: flex; width: 100px; min-height: 100px; align-items: center; align-content: flex-start; flex-wrap: wrap;">
<div style="height: 10px; width: 10px;"></div>
<div style="height: 20px; width: 10px;"></div>
</div>
<div style="display: flex; width: 100px; min-height: 100px; align-items: center; flex-wrap: wrap;">
<div style="height: 10px; width: 10px;"></div>
<div style="height: 20px; width: 10px;"></div>
</div>
<div style="display: flex; width: 100px; min-height: 100px; align-items: center; flex-wrap: no-wrap;">
<div style="height: 10px; width: 10px;"></div>
<div style="height: 20px; width: 10px;"></div>
</div>
<div style="display: flex; width: 100px; min-height: 100px; align-items: center; align-content: flex-start; flex-wrap: no-wrap;">
<div style="height: 10px; width: 10px;"></div>
<div style="height: 20px; width: 10px;"></div>
</div>
</div>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!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">
<div style="display: flex; width: 100px; min-height: 100px; align-items: center; align-content: flex-start; padding: 8px; border-width: 7px;">
<div style="height: 10px; width: 10px;"></div>
<div style="height: 20px; width: 10px;"></div>
</div>
<div style="display: flex; width: 100px; min-height: 100px; align-items: center; align-content: flex-start; padding: 8px; border-width: 7px; flex-wrap: wrap;">
<div style="height: 10px; width: 10px;"></div>
<div style="height: 20px; width: 10px;"></div>
</div>
</div>


</body>
</html>
Loading