aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/layout/block.rs2
-rw-r--r--tests/wpt/mozilla/meta/MANIFEST.json25
-rw-r--r--tests/wpt/mozilla/tests/css/min_width_percent_root_a.html16
-rw-r--r--tests/wpt/mozilla/tests/css/min_width_percent_root_b.html14
4 files changed, 56 insertions, 1 deletions
diff --git a/components/layout/block.rs b/components/layout/block.rs
index 5e30c6f08ee..4da24dfebd0 100644
--- a/components/layout/block.rs
+++ b/components/layout/block.rs
@@ -657,7 +657,7 @@ impl BlockFlow {
pub fn containing_block_size(&self, viewport_size: &Size2D<Au>, descendant: OpaqueFlow)
-> LogicalSize<Au> {
debug_assert!(self.base.flags.contains(IS_ABSOLUTELY_POSITIONED));
- if self.is_fixed() {
+ if self.is_fixed() || self.is_root() {
// Initial containing block is the CB for the root
LogicalSize::from_physical(self.base.writing_mode, *viewport_size)
} else {
diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json
index f5cd627bb58..d2638508bf9 100644
--- a/tests/wpt/mozilla/meta/MANIFEST.json
+++ b/tests/wpt/mozilla/meta/MANIFEST.json
@@ -3731,6 +3731,18 @@
{}
]
],
+ "css/min_width_percent_root_a.html": [
+ [
+ "/_mozilla/css/min_width_percent_root_a.html",
+ [
+ [
+ "/_mozilla/css/min_width_percent_root_b.html",
+ "=="
+ ]
+ ],
+ {}
+ ]
+ ],
"css/min_width_simple_a.html": [
[
"/_mozilla/css/min_width_simple_a.html",
@@ -8359,6 +8371,11 @@
{}
]
],
+ "css/min_width_percent_root_b.html": [
+ [
+ {}
+ ]
+ ],
"css/min_width_simple_b.html": [
[
{}
@@ -22622,6 +22639,14 @@
"e8ee634ab6350ad4c870cb1d0ce4f1a88b285581",
"support"
],
+ "css/min_width_percent_root_a.html": [
+ "e8c23bc78daed932d5b513b972582e21711ea06a",
+ "reftest"
+ ],
+ "css/min_width_percent_root_b.html": [
+ "4c5b54f6b4e1bb77a15fdf7d99f9be3a47df7e8b",
+ "support"
+ ],
"css/min_width_simple_a.html": [
"e709d1ab4096401ecb7b848d9297c00ef7786bf9",
"reftest"
diff --git a/tests/wpt/mozilla/tests/css/min_width_percent_root_a.html b/tests/wpt/mozilla/tests/css/min_width_percent_root_a.html
new file mode 100644
index 00000000000..0def43e7e3c
--- /dev/null
+++ b/tests/wpt/mozilla/tests/css/min_width_percent_root_a.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <link rel="match" href="min_width_percent_root_b.html">
+ <title>absolute root element with percentage min-width</title>
+ <style>
+ html {
+ position: absolute;
+ min-width: 100%;
+ border: 2px solid red;
+ }
+ </style>
+ </head>
+ <body></body>
+</html>
diff --git a/tests/wpt/mozilla/tests/css/min_width_percent_root_b.html b/tests/wpt/mozilla/tests/css/min_width_percent_root_b.html
new file mode 100644
index 00000000000..fad1df06f09
--- /dev/null
+++ b/tests/wpt/mozilla/tests/css/min_width_percent_root_b.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <title>absolute root element with percentage min-width reference</title>
+ <style>
+ html {
+ min-width: 100%;
+ border: 2px solid red;
+ }
+ </style>
+ </head>
+ <body></body>
+</html>