Bug 1394226 - Correct z-ordering for some table parts. r=dbaron
MozReview-Commit-ID: IdLhMGDmQag
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -1603,16 +1603,18 @@ nsTableFrame::DisplayGenericTablePart(ns
// Paint the inset box-shadows for the table frames
if (aFrame->StyleEffects()->mBoxShadow) {
aLists.BorderBackground()->AppendNewToTop(
new (aBuilder) nsDisplayBoxShadowInner(aBuilder, aFrame));
}
}
+ aFrame->DisplayOutline(aBuilder, aLists);
+
aTraversal(aBuilder, aFrame, aLists);
if (isVisible) {
if (isTable) {
nsTableFrame* table = static_cast<nsTableFrame*>(aFrame);
// In the collapsed border model, overlay all collapsed borders.
if (table->IsBorderCollapse()) {
if (table->HasBCBorders()) {
@@ -1623,18 +1625,16 @@ nsTableFrame::DisplayGenericTablePart(ns
const nsStyleBorder* borderStyle = aFrame->StyleBorder();
if (borderStyle->HasBorder()) {
aLists.BorderBackground()->AppendNewToTop(
new (aBuilder) nsDisplayBorder(aBuilder, table));
}
}
}
}
-
- aFrame->DisplayOutline(aBuilder, aLists);
}
// table paint code is concerned primarily with borders and bg color
// SEC: TODO: adjust the rect for captions
void
nsTableFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists)
{
--- a/layout/tables/nsTableWrapperFrame.cpp
+++ b/layout/tables/nsTableWrapperFrame.cpp
@@ -182,18 +182,21 @@ nsTableWrapperFrame::BuildDisplayList(ns
nsDisplayListCollection set;
BuildDisplayListForInnerTable(aBuilder, set);
nsDisplayListSet captionSet(set, set.BlockBorderBackgrounds());
BuildDisplayListForChild(aBuilder, mCaptionFrames.FirstChild(), captionSet);
// Now we have to sort everything by content order, since the caption
- // may be somewhere inside the table
- set.BlockBorderBackgrounds()->SortByContentOrder(GetContent());
+ // may be somewhere inside the table.
+ // We don't sort BlockBorderBackgrounds and BorderBackgrounds because the
+ // display items in those lists should stay out of content order in order to
+ // follow the rules in https://www.w3.org/TR/CSS21/zindex.html#painting-order
+ // and paint the caption background after all of the rest.
set.Floats()->SortByContentOrder(GetContent());
set.Content()->SortByContentOrder(GetContent());
set.PositionedDescendants()->SortByContentOrder(GetContent());
set.Outlines()->SortByContentOrder(GetContent());
set.MoveTo(aLists);
}
void