From ede47309139967c168a384bc43a234aa194ba5a7 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Thu, 25 Aug 2016 23:54:12 -0700 Subject: [PATCH] Fix root flow's size at the browser window's size Fixes #12802 --- components/layout/block.rs | 4 ++-- tests/wpt/mozilla/meta/MANIFEST.json | 24 +++++++++++++++++++ .../mozilla/tests/css/absolute_css_width.html | 13 ++++++++++ .../tests/css/absolute_css_width_ref.html | 5 ++++ 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 tests/wpt/mozilla/tests/css/absolute_css_width.html create mode 100644 tests/wpt/mozilla/tests/css/absolute_css_width_ref.html diff --git a/components/layout/block.rs b/components/layout/block.rs index 178e0294eb0..77212b8d003 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 322e742d7a1..e09580ff4b2 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", @@ -9375,6 +9387,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
+