diff --git a/components/layout/block.rs b/components/layout/block.rs index b8d4e5837e6..5ccf0da34bb 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -1336,10 +1336,10 @@ impl BlockFlow { }; let parent_container_size = self.explicit_block_containing_size(shared_context); // https://drafts.csswg.org/css-ui-3/#box-sizing - let explicit_content_size = self + let mut explicit_content_size = self .explicit_block_size(parent_container_size) .map(|x| if x < box_border { Au(0) } else { x - box_border }); - + if self.is_root() { explicit_content_size = max(parent_container_size, explicit_content_size); } // Calculate containing block inline size. let containing_block_size = if flags.contains(IS_ABSOLUTELY_POSITIONED) { self.containing_block_size(&shared_context.viewport_size, opaque_self).inline diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 5dca9c4c09d..6c127d66063 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -71,6 +71,18 @@ "url": "/_mozilla/css/absolute_content_height.html" } ], + "css/absolute_css_width.html": [ + { + "path": "css/absolute_css_width.html", + "references": [ + [ + "/_mozilla/css/absolute_css_width_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/absolute_css_width.html" + } + ], "css/absolute_hypothetical_float.html": [ { "path": "css/absolute_hypothetical_float.html", @@ -9387,6 +9399,18 @@ "url": "/_mozilla/css/absolute_content_height.html" } ], + "css/absolute_css_width.html": [ + { + "path": "css/absolute_css_width.html", + "references": [ + [ + "/_mozilla/css/absolute_css_width_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/absolute_css_width.html" + } + ], "css/absolute_hypothetical_float.html": [ { "path": "css/absolute_hypothetical_float.html", diff --git a/tests/wpt/mozilla/tests/css/absolute_css_width.html b/tests/wpt/mozilla/tests/css/absolute_css_width.html new file mode 100644 index 00000000000..a6ef6f42f2f --- /dev/null +++ b/tests/wpt/mozilla/tests/css/absolute_css_width.html @@ -0,0 +1,13 @@ + + +HTML expands to fit 100% body + + +
X
+ diff --git a/tests/wpt/mozilla/tests/css/absolute_css_width_ref.html b/tests/wpt/mozilla/tests/css/absolute_css_width_ref.html new file mode 100644 index 00000000000..0fd19aeffaf --- /dev/null +++ b/tests/wpt/mozilla/tests/css/absolute_css_width_ref.html @@ -0,0 +1,5 @@ + + +HTML expands to fit 100% body +
X
+