layout: Make the hypothetical box for display: inline-block with

`position: absolute` inline per CSS 2.1 § 10.3.7.
This commit is contained in:
Patrick Walton 2016-04-27 16:48:07 -07:00
parent b7c9674044
commit 9e1935c2ed
4 changed files with 53 additions and 6 deletions

View file

@ -1519,11 +1519,10 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
}
Some(NodeTypeId::Element(_)) => {
let style = node.style(self.style_context());
let munged_display = if style.get_box()._servo_display_for_hypothetical_box ==
display::T::inline {
display::T::inline
} else {
style.get_box().display
let original_display = style.get_box()._servo_display_for_hypothetical_box;
let munged_display = match original_display {
display::T::inline | display::T::inline_block => original_display,
_ => style.get_box().display,
};
(munged_display, style.get_box().float, style.get_box().position)
}
@ -1577,7 +1576,8 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
// Inline items that are absolutely-positioned contribute inline fragment construction
// results with a hypothetical fragment.
(display::T::inline, _, position::T::absolute) => {
(display::T::inline, _, position::T::absolute) |
(display::T::inline_block, _, position::T::absolute) => {
let construction_result =
self.build_fragment_for_absolutely_positioned_inline(node);
self.set_flow_construction_result(node, construction_result)

View file

@ -2280,6 +2280,18 @@
"url": "/_mozilla/css/inline_background_a.html"
}
],
"css/inline_block_absolute_hypothetical_a.html": [
{
"path": "css/inline_block_absolute_hypothetical_a.html",
"references": [
[
"/_mozilla/css/inline_block_absolute_hypothetical_ref.html",
"=="
]
],
"url": "/_mozilla/css/inline_block_absolute_hypothetical_a.html"
}
],
"css/inline_block_baseline_a.html": [
{
"path": "css/inline_block_baseline_a.html",
@ -9044,6 +9056,18 @@
"url": "/_mozilla/css/inline_background_a.html"
}
],
"css/inline_block_absolute_hypothetical_a.html": [
{
"path": "css/inline_block_absolute_hypothetical_a.html",
"references": [
[
"/_mozilla/css/inline_block_absolute_hypothetical_ref.html",
"=="
]
],
"url": "/_mozilla/css/inline_block_absolute_hypothetical_a.html"
}
],
"css/inline_block_baseline_a.html": [
{
"path": "css/inline_block_baseline_a.html",

View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="match" href="inline_block_absolute_hypothetical_ref.html">
<style>
span {
display: inline-block;
position: absolute;
top: 32px;
}
</style>
Hello <span>world</span>!

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<meta charset="utf-8">
<style>
span {
display: inline;
position: absolute;
top: 32px;
}
</style>
Hello <span>world</span>!