Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layout: Fix relative positioned grid item #50117

Merged
merged 6 commits into from
Feb 8, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: Relative Positioned Grid Items as a Containing Block of Absolute Positioned Descendant</title>
<link rel="author" title="Jo Steven Novaryo" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-position-3/#absolute-cb">
<link rel="help" href="https://drafts.csswg.org/css-position-3/#fixed-cb">
<link rel="help" href="https://drafts.csswg.org/css-grid/#grid-items">
<link rel="help" href="https://github.com/servo/servo/issues/34535">
<link rel="match" href="/css/reference/ref-filled-green-100px-square.xht">
<meta name="assert" content="Ensures that relative positioned grid item established as an absolute containing block correctly.">
<link rel="stylesheet" href="support/grid-items-relative-positioned-containing-block.css">

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>

<div class="grid">
<div class="container">
<div class="box-abspos red"></div>
</div>
<div class="box1 green"></div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: Relative Positioned Grid Items as a Containing Block of Absolute Positioned Descendant</title>
<link rel="author" title="Jo Steven Novaryo" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-position-3/#absolute-cb">
<link rel="help" href="https://drafts.csswg.org/css-position-3/#fixed-cb">
<link rel="help" href="https://drafts.csswg.org/css-grid/#grid-items">
<link rel="help" href="https://github.com/servo/servo/issues/34535">
<link rel="match" href="/css/reference/ref-filled-green-100px-square.xht">
<meta name="assert" content="Ensures that relative positioned grid item established as an absolute containing block correctly.">
<link rel="stylesheet" href="support/grid-items-relative-positioned-containing-block.css">

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>

<div class="grid">
<div class="container">
<div>
<span>
<div class="box-abspos red"></div>
</span>
</div>
</div>
<div class="box1 green"></div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: Relative Positioned Grid Items as a Containing Block of Absolute Positioned Descendant</title>
<link rel="author" title="Jo Steven Novaryo" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-position-3/#absolute-cb">
<link rel="help" href="https://drafts.csswg.org/css-position-3/#fixed-cb">
<link rel="help" href="https://drafts.csswg.org/css-grid/#grid-items">
<link rel="help" href="https://github.com/servo/servo/issues/34535">
<link rel="match" href="/css/reference/ref-filled-green-100px-square.xht">
<meta name="assert" content="Ensures that relative positioned grid item established as an absolute containing block correctly.">
<link rel="stylesheet" href="support/grid-items-relative-positioned-containing-block.css">

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>

<div class="grid">
<div class="box1 red"></div>
<div class="container">
<div class="box-abspos green"></div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: Relative Positioned Grid Items as a Containing Block of Fixed Positioned Descendant</title>
<link rel="author" title="Jo Steven Novaryo" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-position-3/#absolute-cb">
<link rel="help" href="https://drafts.csswg.org/css-position-3/#fixed-cb">
<link rel="help" href="https://drafts.csswg.org/css-grid/#grid-items">
<link rel="help" href="https://github.com/servo/servo/issues/34535">
<link rel="match" href="/css/reference/ref-filled-green-100px-square.xht">
<meta name="assert" content="Ensures that relative positioned grid item established as a absolute containing block correctly.">
<link rel="stylesheet" href="support/grid-items-relative-positioned-containing-block.css">

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>

<div class="grid">
<div class="container">
<div class="box-fixpos red"></div>
</div>
<div class="box1 green"></div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: Relative Positioned Grid Items as a Containing Block of Fixed Positioned Descendant</title>
<link rel="author" title="Jo Steven Novaryo" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-position-3/#absolute-cb">
<link rel="help" href="https://drafts.csswg.org/css-position-3/#fixed-cb">
<link rel="help" href="https://drafts.csswg.org/css-grid/#grid-items">
<link rel="help" href="https://github.com/servo/servo/issues/34535">
<link rel="match" href="/css/reference/ref-filled-green-100px-square.xht">
<meta name="assert" content="Ensures that relative positioned grid item established as a absolute containing block correctly.">
<link rel="stylesheet" href="support/grid-items-relative-positioned-containing-block.css">

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>

<div class="grid">
<div class="container">
<div>
<span>
<div class="box-fixpos red"></div>
</span>
</div>
</div>
<div class="box1 green"></div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: Relative Positioned Grid Items as a Containing Block of Absolute and Fixed Positioned Descendant</title>
<link rel="author" title="Jo Steven Novaryo" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-position-3/#absolute-cb">
<link rel="help" href="https://drafts.csswg.org/css-position-3/#fixed-cb">
<link rel="help" href="https://drafts.csswg.org/css-grid/#grid-items">
<link rel="help" href="https://github.com/servo/servo/issues/34535">
<link rel="match" href="/css/reference/ref-filled-green-100px-square.xht">
<meta name="assert" content="Ensures that relative positioned grid item established as a absolute containing block correctly.">
<link rel="stylesheet" href="support/grid-items-relative-positioned-containing-block.css">

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>

<div class="grid">
<div class="container">
<div class="box-fixpos red"></div>
<div class="box-abspos red"></div>
</div>
<div class="box1 green"></div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.grid {
display: grid;
width: 100%;
grid-template-columns: 100px;
grid-template-rows: 100px;
}
.container {
position: relative;
grid-area: 1 / 1;
}
.box1 {
position: absolute;
width: 100px;
height: 100px;
grid-area: 1 / 1;
}
.box-abspos {
position: absolute;
width: 100%;
height: 100%;
}
.box-fixpos {
position: fixed;
width: 100px;
height: 100px;
}
.red {
background: red;
}
.green {
background: green;
}