Auto merge of #7711 - aopicier:root_layout, r=pcwalton

Use computed `display` property for hypothetical box of root element

Closes #7558.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7711)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-09-27 17:03:58 -06:00
commit 45a0c48efd
5 changed files with 45 additions and 3 deletions

View file

@ -556,10 +556,14 @@ pub mod longhands {
}
#[inline]
pub fn derive_from_display(_: super::display::computed_value::T,
pub fn derive_from_display(computed_value: super::display::computed_value::T,
context: &computed::Context)
-> computed_value::T {
context.display
if context.is_root_element {
computed_value
} else {
context.display
}
}
</%self:longhand>
@ -6647,7 +6651,12 @@ pub fn cascade(viewport_size: Size2D<Au>,
// The initial value of display may be changed at computed value time.
if !seen.get_display() {
let box_ = Arc::make_mut(&mut style.box_);
box_.display = box_.display.to_computed_value(&context);
let computed_value = box_.display.to_computed_value(&context);
box_.display = computed_value;
box_._servo_display_for_hypothetical_box =
longhands::_servo_display_for_hypothetical_box::derive_from_display(
computed_value,
&context);
}
// The initial value of outline width may be changed at computed value time.

View file

@ -320,6 +320,8 @@ device-pixel-ratio=2 != pixel_snapping_border_a.html pixel_snapping_border_ref.h
== pseudo_inherit.html pseudo_inherit_ref.html
== quotes_none_a.html quotes_none_ref.html
== quotes_simple_a.html quotes_simple_ref.html
== root_display_inline_a.html root_display_ref.html
== root_display_without_style_a.html root_display_ref.html
== root_height_a.html root_height_b.html
== root_margin_collapse_a.html root_margin_collapse_b.html
== root_pseudo_a.html root_pseudo_b.html

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html style="display:inline">
<head>
</head>
<body>
Hello world!
</body>
</html>

View file

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
Hello world!
</body>
</html>

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<script>
document.removeChild(document.documentElement);
root = document.createElementNS(null, "html");
body = document.createElement("body");
body.appendChild(document.createTextNode("Hello world!"));
root.appendChild(body);
document.appendChild(root);
</script>
</head>
<body>
</body>
</html>