Bug 334690. Fix regression in z-ordering of table cell content for event handling. r=bernd

This commit is contained in:
roc+%cs.cmu.edu 2006-05-01 01:18:32 +00:00
parent 9f5eaede3a
commit dd16b28d00

View File

@ -1405,19 +1405,18 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder,
PRBool aIsRoot) PRBool aIsRoot)
{ {
nsDisplayList eventsBorderBackground; nsDisplayList eventsBorderBackground;
// If we need to sort the event backgrounds, then we'll put descendant // If we need to sort the event backgrounds, then we'll put descendants'
// border-backgrounds into their own list so we don't accidentally sort // display items into their own set of lists.
// some ancestor's border-background.
PRBool sortEventBackgrounds = aIsRoot && aBuilder->IsForEventDelivery(); PRBool sortEventBackgrounds = aIsRoot && aBuilder->IsForEventDelivery();
nsDisplayListSet lists(aLists, nsDisplayListCollection separatedCollection;
sortEventBackgrounds ? &eventsBorderBackground : aLists.BorderBackground()); const nsDisplayListSet* lists = sortEventBackgrounds ? &separatedCollection : &aLists;
// Create dedicated background display items per-frame when we're // Create dedicated background display items per-frame when we're
// handling events. // handling events.
// XXX how to handle collapsed borders? // XXX how to handle collapsed borders?
if (aBuilder->IsForEventDelivery() && if (aBuilder->IsForEventDelivery() &&
aFrame->IsVisibleForPainting(aBuilder)) { aFrame->IsVisibleForPainting(aBuilder)) {
nsresult rv = lists.BorderBackground()->AppendNewToTop(new (aBuilder) nsresult rv = lists->BorderBackground()->AppendNewToTop(new (aBuilder)
nsDisplayBackground(aFrame)); nsDisplayBackground(aFrame));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
} }
@ -1432,7 +1431,7 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder,
// lets us get cell borders into the nsTableFrame's BorderBackground list. // lets us get cell borders into the nsTableFrame's BorderBackground list.
nsIFrame* kid = aFrame->GetFirstChild(nsnull); nsIFrame* kid = aFrame->GetFirstChild(nsnull);
while (kid) { while (kid) {
nsresult rv = aFrame->BuildDisplayListForChild(aBuilder, kid, aDirtyRect, lists); nsresult rv = aFrame->BuildDisplayListForChild(aBuilder, kid, aDirtyRect, *lists);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
kid = kid->GetNextSibling(); kid = kid->GetNextSibling();
} }
@ -1441,11 +1440,11 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder,
// Ensure that the table frame event background goes before the // Ensure that the table frame event background goes before the
// table rowgroups event backgrounds, before the table row event backgrounds, // table rowgroups event backgrounds, before the table row event backgrounds,
// before everything else (cells and their blocks) // before everything else (cells and their blocks)
eventsBorderBackground.Sort(aBuilder, CompareByTablePartRank, nsnull); separatedCollection.BorderBackground()->Sort(CompareByTablePartRank, nsnull);
aLists.BorderBackground()->AppendToTop(&eventsBorderBackground); separatedCollection.MoveTo(aLists);
} }
return aFrame->DisplayOutline(aBuilder, lists); return aFrame->DisplayOutline(aBuilder, aLists);
} }
// table paint code is concerned primarily with borders and bg color // table paint code is concerned primarily with borders and bg color