aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/fragment.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-08-24 01:31:34 -0500
committerGitHub <noreply@github.com>2017-08-24 01:31:34 -0500
commit4725a05bfba0b588d19af8bc5cfe960bda1ea880 (patch)
treef8d2e1d1d8915693d8196897de92a135f4a4e11a /components/layout/fragment.rs
parent474369618965569407d127b1e8c481e757cc59d3 (diff)
parentf1b98393cc1fa6bbc52fc50970229681f17e8d41 (diff)
downloadservo-4725a05bfba0b588d19af8bc5cfe960bda1ea880.tar.gz
servo-4725a05bfba0b588d19af8bc5cfe960bda1ea880.zip
Auto merge of #18188 - mrobinson:overflow-stacking-context, r=mbrubeck
Allow overflow:scroll without a stacking context Fix the long-standing bug where items that are positioned and have overflow:scroll or overflow:auto automatically create stacking contexts. In order to do this we need to fix another bug where display list sorting can put a Clip or ScrollFrame definition after the first time it is used in a display list. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18188) <!-- Reviewable:end -->
Diffstat (limited to 'components/layout/fragment.rs')
-rw-r--r--components/layout/fragment.rs30
1 files changed, 10 insertions, 20 deletions
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index 23c8b4fda82..4e0763612ad 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -2526,27 +2526,17 @@ impl Fragment {
return true
}
- match (self.style().get_box().position,
- self.style().get_position().z_index,
- self.style().get_box().overflow_x,
- self.style().get_box().overflow_y) {
- (position::T::absolute,
- Either::Second(Auto),
- overflow_x::T::visible,
- overflow_x::T::visible) |
- (position::T::fixed,
- Either::Second(Auto),
- overflow_x::T::visible,
- overflow_x::T::visible) |
- (position::T::relative,
- Either::Second(Auto),
- overflow_x::T::visible,
- overflow_x::T::visible) => false,
- (position::T::absolute, _, _, _) |
- (position::T::fixed, _, _, _) |
- (position::T::relative, _, _, _) => true,
- (position::T::static_, _, _, _) => false
+ // Statically positioned fragments don't establish stacking contexts if the previous
+ // conditions are not fulfilled. Furthermore, z-index doesn't apply to statically
+ // positioned fragments.
+ if self.style().get_box().position == position::T::static_ {
+ return false;
}
+
+ // For absolutely and relatively positioned fragments we only establish a stacking
+ // context if there is a z-index set.
+ // See https://www.w3.org/TR/CSS2/visuren.html#z-index
+ self.style().get_position().z_index != Either::Second(Auto)
}
// Get the effective z-index of this fragment. Z-indices only apply to positioned element