Bug 1460482 - Force root scroll frame overlay scroll bars to be always on top. r?mstange
MozReview-Commit-ID: 3zeykuDgEHc
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -3014,16 +3014,17 @@ AppendInternalItemToTop(const nsDisplayL
aLists.Content()->AppendToTop(aItem);
}
}
static const uint32_t APPEND_OWN_LAYER = 0x1;
static const uint32_t APPEND_POSITIONED = 0x2;
static const uint32_t APPEND_SCROLLBAR_CONTAINER = 0x4;
static const uint32_t APPEND_OVERLAY = 0x8;
+static const uint32_t APPEND_TOP = 0x10;
static void
AppendToTop(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists,
nsDisplayList* aSource, nsIFrame* aSourceFrame, uint32_t aFlags)
{
if (aSource->IsEmpty())
return;
@@ -3051,17 +3052,19 @@ AppendToTop(nsDisplayListBuilder* aBuild
newItem = MakeDisplayItem<nsDisplayWrapList>(aBuilder, aSourceFrame, aSource, asr, false, 1);
}
if (aFlags & APPEND_POSITIONED) {
// 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.
Maybe<int32_t> zIndex = Nothing();
- if (aFlags & APPEND_OVERLAY) {
+ if (aFlags & APPEND_TOP) {
+ zIndex = Some(INT32_MAX);
+ } else if (aFlags & APPEND_OVERLAY) {
zIndex = MaxZIndexInList(aLists.PositionedDescendants(), aBuilder);
} else if (aSourceFrame->StylePosition()->mZIndex.GetUnit() == eStyleUnit_Integer) {
zIndex = Some(aSourceFrame->StylePosition()->mZIndex.GetIntValue());
}
AppendInternalItemToTop(aLists, newItem, zIndex);
} else {
aLists.BorderBackground()->AppendToTop(newItem);
@@ -3182,20 +3185,25 @@ ScrollFrameHelper::AppendScrollPartsTo(n
}
if (createLayer) {
appendToTopFlags |= APPEND_OWN_LAYER;
}
if (aPositioned) {
appendToTopFlags |= APPEND_POSITIONED;
}
- if (overlayScrollbars ||
+
+ if (isOverlayScrollbar ||
scrollParts[i] == mResizerBox) {
- appendToTopFlags |= APPEND_OVERLAY;
- aBuilder->SetDisablePartialUpdates(true);
+ if (isOverlayScrollbar && mIsRoot) {
+ appendToTopFlags |= APPEND_TOP;
+ } else {
+ appendToTopFlags |= APPEND_OVERLAY;
+ aBuilder->SetDisablePartialUpdates(true);
+ }
}
{
nsDisplayListBuilder::AutoBuildingDisplayList
buildingForChild(aBuilder, scrollParts[i],
visible + mOuter->GetOffsetTo(scrollParts[i]),
dirty + mOuter->GetOffsetTo(scrollParts[i]), true);
nsDisplayListBuilder::AutoCurrentScrollbarInfoSetter