mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
layout: Make "height" relative to the initial containing block for the root.
Fixes Wikipedia.
This commit is contained in:
parent
30bbaa49b7
commit
225ae67b60
4 changed files with 37 additions and 1 deletions
|
@ -323,6 +323,10 @@ impl BlockFlow {
|
|||
|
||||
|
||||
let mut height = if self.is_root {
|
||||
// FIXME(pcwalton): The max is taken here so that you can scroll the page, but this is
|
||||
// not correct behavior according to CSS 2.1 § 10.5. Instead I think we should treat
|
||||
// the root element as having `overflow: scroll` and use the layers-based scrolling
|
||||
// infrastructure to make it scrollable.
|
||||
Au::max(ctx.screen_size.size.height, cur_y)
|
||||
} else {
|
||||
cur_y - top_offset - collapsing
|
||||
|
@ -330,7 +334,11 @@ impl BlockFlow {
|
|||
|
||||
for &box in self.box.iter() {
|
||||
let style = box.style();
|
||||
height = match MaybeAuto::from_style(style.Box.height, Au::new(0)) {
|
||||
|
||||
// At this point, `height` is the height of the containing block, so passing `height`
|
||||
// as the second argument here effectively makes percentages relative to the containing
|
||||
// block per CSS 2.1 § 10.5.
|
||||
height = match MaybeAuto::from_style(style.Box.height, height) {
|
||||
Auto => height,
|
||||
Specified(value) => value
|
||||
};
|
||||
|
|
|
@ -13,3 +13,4 @@
|
|||
== last_of_type_pseudo_a.html last_of_type_pseudo_b.html
|
||||
== only_of_type_pseudo_a.html only_of_type_pseudo_b.html
|
||||
== visibility_hidden.html visibility_hidden_ref.html
|
||||
== root_height_a.html root_height_b.html
|
||||
|
|
14
src/test/ref/root_height_a.html
Normal file
14
src/test/ref/root_height_a.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Aliens was a really good movie. But Alien 3 sucked.</title>
|
||||
<style>
|
||||
html {
|
||||
height: 100%;
|
||||
background-color: maroon;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
|
13
src/test/ref/root_height_b.html
Normal file
13
src/test/ref/root_height_b.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Aliens was a really good movie. But Alien 3 sucked.</title>
|
||||
<style>
|
||||
html {
|
||||
background-color: maroon;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue