Bug 590468. Part 1: Add support for XUL 'layer' attribute. r=tnikkel sr=vlad

This commit is contained in:
Robert O'Callahan 2010-08-27 18:15:08 -05:00
parent f23546c84d
commit 1986ba6f20

View File

@ -1307,27 +1307,54 @@ nsBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
nsresult rv = DisplayBorderBackgroundOutline(aBuilder, aLists);
// forcelayer is only supported on XUL elements with box layout
PRBool forceLayer =
GetContent()->HasAttr(kNameSpaceID_None, nsGkAtoms::layer) &&
GetContent()->IsXUL();
nsDisplayListCollection tempLists;
const nsDisplayListSet& destination = forceLayer ? tempLists : aLists;
nsresult rv = DisplayBorderBackgroundOutline(aBuilder, destination);
NS_ENSURE_SUCCESS(rv, rv);
#ifdef DEBUG_LAYOUT
// REVIEW: From GetFrameForPoint
if (mState & NS_STATE_CURRENTLY_IN_DEBUG) {
rv = aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
rv = destination.BorderBackground()->AppendNewToTop(new (aBuilder)
nsDisplayGeneric(aBuilder, this, PaintXULDebugBackground,
"XULDebugBackground"));
NS_ENSURE_SUCCESS(rv, rv);
rv = aLists.Outlines()->AppendNewToTop(new (aBuilder)
rv = destination.Outlines()->AppendNewToTop(new (aBuilder)
nsDisplayXULDebug(aBuilder, this));
NS_ENSURE_SUCCESS(rv, rv);
}
#endif
rv = BuildDisplayListForChildren(aBuilder, aDirtyRect, aLists);
rv = BuildDisplayListForChildren(aBuilder, aDirtyRect, destination);
NS_ENSURE_SUCCESS(rv, rv);
// see if we have to draw a selection frame around this container
return DisplaySelectionOverlay(aBuilder, aLists);
rv = DisplaySelectionOverlay(aBuilder, destination);
NS_ENSURE_SUCCESS(rv, rv);
if (forceLayer) {
// This is a bit of a hack. Collect up all descendant display items
// and merge them into a single Content() list. This can cause us
// to violate CSS stacking order, but forceLayer is a magic
// XUL-only extension anyway.
nsDisplayList masterList;
masterList.AppendToTop(tempLists.BorderBackground());
masterList.AppendToTop(tempLists.BlockBorderBackgrounds());
masterList.AppendToTop(tempLists.Floats());
masterList.AppendToTop(tempLists.Content());
masterList.AppendToTop(tempLists.PositionedDescendants());
masterList.AppendToTop(tempLists.Outlines());
// Wrap the list to make it its own layer
rv = aLists.Content()->AppendNewToTop(new (aBuilder)
nsDisplayOwnLayer(aBuilder, this, &masterList));
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}
NS_IMETHODIMP