Auto merge of #16881 - mbrubeck:absolute_root, r=stshine

Fix containing block size for absolute root element

The root element doesn't have a containing block, so use the viewport size instead of `self.base.absolute_cb`.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #16248 (github issue number if applicable).
- [x] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16881)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-05-17 19:13:51 -05:00 committed by GitHub
commit 10cc59dd2e
4 changed files with 56 additions and 1 deletions

View file

@ -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 {

View file

@ -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",
@ -8371,6 +8383,11 @@
{}
]
],
"css/min_width_percent_root_b.html": [
[
{}
]
],
"css/min_width_simple_b.html": [
[
{}
@ -22660,6 +22677,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"

View file

@ -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>

View file

@ -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>