mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Auto merge of #7277 - pcwalton:position-relative-stacking-context, r=glennw
layout: Make `position: relative` with non-auto `z-index` create a stacking context. Improves imgur.com and Fast Company articles. This change made `min-height-106.htm.ini` fail because the thing it was testing for never worked: we were relying on the incorrect stacking order of `position: relative` to get the green square to show up. r? @glennw <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7277) <!-- Reviewable:end -->
This commit is contained in:
commit
23657484ad
6 changed files with 48 additions and 6 deletions
|
@ -2023,15 +2023,17 @@ impl Fragment {
|
||||||
overflow_x::T::visible,
|
overflow_x::T::visible,
|
||||||
overflow_x::T::visible) |
|
overflow_x::T::visible) |
|
||||||
(position::T::fixed,
|
(position::T::fixed,
|
||||||
|
z_index::T::Auto,
|
||||||
|
overflow_x::T::visible,
|
||||||
|
overflow_x::T::visible) |
|
||||||
|
(position::T::relative,
|
||||||
z_index::T::Auto,
|
z_index::T::Auto,
|
||||||
overflow_x::T::visible,
|
overflow_x::T::visible,
|
||||||
overflow_x::T::visible) => false,
|
overflow_x::T::visible) => false,
|
||||||
(position::T::absolute, _, _, _) |
|
(position::T::absolute, _, _, _) |
|
||||||
(position::T::fixed, _, _, _) => true,
|
(position::T::fixed, _, _, _) |
|
||||||
(position::T::relative, _, _, _) |
|
(position::T::relative, _, _, _) => true,
|
||||||
(position::T::static_, _, _, _) => {
|
(position::T::static_, _, _, _) => {
|
||||||
// FIXME(pcwalton): `position: relative` establishes a new stacking context if
|
|
||||||
// `z-index` is not `auto`. But this matches what we did before.
|
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,6 +291,7 @@ flaky_cpu == linebreak_simple_a.html linebreak_simple_b.html
|
||||||
== position_relative_a.html position_relative_b.html
|
== position_relative_a.html position_relative_b.html
|
||||||
== position_relative_inline_block_a.html position_relative_inline_block_ref.html
|
== position_relative_inline_block_a.html position_relative_inline_block_ref.html
|
||||||
== position_relative_painting_order_a.html position_relative_painting_order_ref.html
|
== position_relative_painting_order_a.html position_relative_painting_order_ref.html
|
||||||
|
== position_relative_stacking_context_a.html position_relative_stacking_context_ref.html
|
||||||
== position_relative_top_percentage_a.html position_relative_top_percentage_b.html
|
== position_relative_top_percentage_a.html position_relative_top_percentage_b.html
|
||||||
== pre_ignorable_whitespace_a.html pre_ignorable_whitespace_ref.html
|
== pre_ignorable_whitespace_a.html pre_ignorable_whitespace_ref.html
|
||||||
== pre_with_tab.html pre_with_tab_ref.html
|
== pre_with_tab.html pre_with_tab_ref.html
|
||||||
|
|
24
tests/ref/position_relative_stacking_context_a.html
Normal file
24
tests/ref/position_relative_stacking_context_a.html
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<style>
|
||||||
|
body, html {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
#a {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
background: green;
|
||||||
|
}
|
||||||
|
#b {
|
||||||
|
position: absolute;
|
||||||
|
background: red;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div id=a></div>
|
||||||
|
<div id=b></div>
|
||||||
|
|
16
tests/ref/position_relative_stacking_context_ref.html
Normal file
16
tests/ref/position_relative_stacking_context_ref.html
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<style>
|
||||||
|
body, html {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
#a {
|
||||||
|
position: absolute;
|
||||||
|
background: green;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div id=a></div>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[floats-041.htm]
|
[min-height-106.htm]
|
||||||
type: reftest
|
type: reftest
|
||||||
expected: FAIL
|
expected: FAIL
|
|
@ -20,7 +20,6 @@
|
||||||
left: 50px;
|
left: 50px;
|
||||||
width: 64px;
|
width: 64px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#destination .img img{
|
#destination .img img{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue