mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
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:
parent
b7c9674044
commit
9e1935c2ed
4 changed files with 53 additions and 6 deletions
|
@ -1519,11 +1519,10 @@ impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadS
|
||||||
}
|
}
|
||||||
Some(NodeTypeId::Element(_)) => {
|
Some(NodeTypeId::Element(_)) => {
|
||||||
let style = node.style(self.style_context());
|
let style = node.style(self.style_context());
|
||||||
let munged_display = if style.get_box()._servo_display_for_hypothetical_box ==
|
let original_display = style.get_box()._servo_display_for_hypothetical_box;
|
||||||
display::T::inline {
|
let munged_display = match original_display {
|
||||||
display::T::inline
|
display::T::inline | display::T::inline_block => original_display,
|
||||||
} else {
|
_ => style.get_box().display,
|
||||||
style.get_box().display
|
|
||||||
};
|
};
|
||||||
(munged_display, style.get_box().float, style.get_box().position)
|
(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
|
// Inline items that are absolutely-positioned contribute inline fragment construction
|
||||||
// results with a hypothetical fragment.
|
// 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 =
|
let construction_result =
|
||||||
self.build_fragment_for_absolutely_positioned_inline(node);
|
self.build_fragment_for_absolutely_positioned_inline(node);
|
||||||
self.set_flow_construction_result(node, construction_result)
|
self.set_flow_construction_result(node, construction_result)
|
||||||
|
|
|
@ -2280,6 +2280,18 @@
|
||||||
"url": "/_mozilla/css/inline_background_a.html"
|
"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": [
|
"css/inline_block_baseline_a.html": [
|
||||||
{
|
{
|
||||||
"path": "css/inline_block_baseline_a.html",
|
"path": "css/inline_block_baseline_a.html",
|
||||||
|
@ -9044,6 +9056,18 @@
|
||||||
"url": "/_mozilla/css/inline_background_a.html"
|
"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": [
|
"css/inline_block_baseline_a.html": [
|
||||||
{
|
{
|
||||||
"path": "css/inline_block_baseline_a.html",
|
"path": "css/inline_block_baseline_a.html",
|
||||||
|
|
|
@ -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>!
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<style>
|
||||||
|
span {
|
||||||
|
display: inline;
|
||||||
|
position: absolute;
|
||||||
|
top: 32px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
Hello <span>world</span>!
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue