Bug 987680. Overlay scrollbars should be placed on top of content. r=roc

Bug 926292 accidentally put them in the background list if there were no positioned descendents they needed to be on top of it (because this was where non-overlay scrollbars went, which never made sense). If there are no positioned descendents overlay scrollbars should go on the top-most non-positioned list, which is outlines.
This commit is contained in:
Timothy Nikkel 2014-04-09 07:12:21 -05:00
parent f9f45af324
commit 3097606571
4 changed files with 48 additions and 4 deletions

View File

@ -2128,13 +2128,17 @@ AppendToTop(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists,
aFlags, aScrollTargetId) :
new (aBuilder) nsDisplayWrapList(aBuilder, aSourceFrame, aSource);
nsDisplayList* positionedDescendants = aLists.PositionedDescendants();
if (aPositioned && !positionedDescendants->IsEmpty()) {
if (aPositioned) {
// We want overlay scrollbars to always be on top of the scrolled content,
// but we don't want them to unnecessarily cover overlapping elements from
// outside our scroll frame.
newItem->SetOverrideZIndex(MaxZIndexInList(positionedDescendants, aBuilder));
positionedDescendants->AppendNewToTop(newItem);
nsDisplayList* positionedDescendants = aLists.PositionedDescendants();
if (!positionedDescendants->IsEmpty()) {
newItem->SetOverrideZIndex(MaxZIndexInList(positionedDescendants, aBuilder));
positionedDescendants->AppendNewToTop(newItem);
} else {
aLists.Outlines()->AppendNewToTop(newItem);
}
} else {
aLists.BorderBackground()->AppendNewToTop(newItem);
}

View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<style>
.container {
width: 200px;
height: 200px;
overflow: scroll;
position: relative;
}
</style>
</head>
<body>
<div class="container">
<div style="width: 10px; height: 10px; left: 0px; top: 60px; background: white; position: absolute; z-index: 1;"></div>
<div style="background: green; height: 40px;"></div>
<div style="height: 300px;"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<style>
.container {
width: 200px;
height: 200px;
overflow: scroll;
position: relative;
}
</style>
</head>
<body>
<div class="container">
<div style="background: green; height: 40px;"></div>
<div style="height: 300px;"></div>
</div>
</body>
</html>

View File

@ -1804,5 +1804,6 @@ skip-if(Android) == 966510-2.html 966510-2-ref.html # same as above
== 983084-2.html 983084-2-ref.html
== 983084-3.html 983084-1-ref.html
== 983691-1.html 983691-ref.html
== 987680-1.html 987680-1-ref.html
fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,24) == 991046-1.html 991046-1-ref.html
pref(layout.css.overflow-clip-box.enabled,true) == 992447.html 992447-ref.html