From 0318ce4702d0ed1fbb5b3e36d99f5dff6f33153f Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Mon, 28 Jun 2010 12:28:47 +1200 Subject: [PATCH] Bug 572612. Make scrollbars appear in the background/border layer of the scrollable element. r=mats --- layout/generic/nsGfxScrollFrame.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index b5cbb9465ee..41092aef192 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -1844,16 +1844,21 @@ nsGfxScrollFrameInner::BuildDisplayList(nsDisplayListBuilder* aBuilder, // borders and underneath borders and backgrounds of later elements // in the tree. PRBool hasResizer = HasResizer(); + nsDisplayListCollection scrollParts; for (nsIFrame* kid = mOuter->GetFirstChild(nsnull); kid; kid = kid->GetNextSibling()) { if (kid != mScrolledFrame) { if (kid == mScrollCornerBox && hasResizer) { // skip the resizer as this will be drawn later on top of the scrolled content continue; } - rv = mOuter->BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists); + rv = mOuter->BuildDisplayListForChild(aBuilder, kid, aDirtyRect, scrollParts, + nsIFrame::DISPLAY_CHILD_FORCE_STACKING_CONTEXT); NS_ENSURE_SUCCESS(rv, rv); } } + // DISPLAY_CHILD_FORCE_STACKING_CONTEXT puts everything into the + // PositionedDescendants list. + aLists.BorderBackground()->AppendToTop(scrollParts.PositionedDescendants()); // Overflow clipping can never clip frames outside our subtree, so there // is no need to worry about whether we are a moving frame that might clip @@ -1878,13 +1883,17 @@ nsGfxScrollFrameInner::BuildDisplayList(nsDisplayListBuilder* aBuilder, rv = mOuter->OverflowClip(aBuilder, set, aLists, clip, PR_TRUE, mIsRoot); NS_ENSURE_SUCCESS(rv, rv); - // Place the resizer in the display list above the overflow clip. This - // ensures that the resizer appears above the content and the mouse can + // Place the resizer in the display list in our Content() list above + // scrolled content in the Content() list. + // This ensures that the resizer appears above the content and the mouse can // still target the resizer even when scrollbars are hidden. if (hasResizer && mScrollCornerBox) { - rv = mOuter->BuildDisplayListForChild(aBuilder, mScrollCornerBox, aDirtyRect, aLists, - nsIFrame::DISPLAY_CHILD_FORCE_PSEUDO_STACKING_CONTEXT); + rv = mOuter->BuildDisplayListForChild(aBuilder, mScrollCornerBox, aDirtyRect, scrollParts, + nsIFrame::DISPLAY_CHILD_FORCE_STACKING_CONTEXT); NS_ENSURE_SUCCESS(rv, rv); + // DISPLAY_CHILD_FORCE_STACKING_CONTEXT puts everything into the + // PositionedDescendants list. + aLists.Content()->AppendToTop(scrollParts.PositionedDescendants()); } return NS_OK;