Bug 1463940 - Invalidate display items when we add a caption to a table, since it can change the ordering of the content. r?mstange
MozReview-Commit-ID: HQewY2vNEJm
new file mode 100644
--- /dev/null
+++ b/layout/base/crashtests/1463940.html
@@ -0,0 +1,24 @@
+<style>
+#c {
+clip-path: url(undefined);
+}
+.cl {
+opacity: 0.29556127;
+}
+</style>
+<script>
+function eh1() {
+ a.createCaption();
+ b.vAlign = "top";
+}
+function eh2() {
+ c.deleteCell(0);
+ setTimeout(eh1, 0);
+}
+</script>
+<body onload="eh2()">
+<table id="a">
+<tr id="c">
+<th>
+<th id="b">
+<colgroup class="cl">
--- a/layout/base/crashtests/crashtests.list
+++ b/layout/base/crashtests/crashtests.list
@@ -528,8 +528,9 @@ load 1443027-1.html
load 1448841-1.html
load 1452839.html
load 1453702.html
load 1453342.html
load 1453196.html
pref(dom.webcomponents.shadowdom.enabled,true) load 1414303.html
load 1461812.html
load 1462412.html
+load 1463940.html
--- a/layout/tables/nsTableWrapperFrame.cpp
+++ b/layout/tables/nsTableWrapperFrame.cpp
@@ -118,16 +118,20 @@ nsTableWrapperFrame::AppendFrames(ChildL
aFrameList.FirstChild()->IsTableCaption(),
"appending non-caption frame to captionList");
mCaptionFrames.AppendFrames(this, aFrameList);
// Reflow the new caption frame. It's already marked dirty, so
// just tell the pres shell.
PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
NS_FRAME_HAS_DIRTY_CHILDREN);
+ // The presence of caption frames makes us sort our display
+ // list differently, so mark us as changed for the new
+ // ordering.
+ MarkNeedsDisplayItemRebuild();
}
void
nsTableWrapperFrame::InsertFrames(ChildListID aListID,
nsIFrame* aPrevFrame,
nsFrameList& aFrameList)
{
MOZ_ASSERT(kCaptionList == aListID, "unexpected child list");
@@ -137,16 +141,17 @@ nsTableWrapperFrame::InsertFrames(ChildL
MOZ_ASSERT(!aPrevFrame || aPrevFrame->GetParent() == this,
"inserting after sibling frame with different parent");
mCaptionFrames.InsertFrames(nullptr, aPrevFrame, aFrameList);
// Reflow the new caption frame. It's already marked dirty, so
// just tell the pres shell.
PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
NS_FRAME_HAS_DIRTY_CHILDREN);
+ MarkNeedsDisplayItemRebuild();
}
void
nsTableWrapperFrame::RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame)
{
// We only have two child frames: the inner table and one caption frame.
// The inner frame can't be removed so this should be the caption
@@ -158,16 +163,17 @@ nsTableWrapperFrame::RemoveFrame(ChildLi
InnerTableFrame()->AddStateBits(NS_FRAME_IS_DIRTY);
}
// Remove the frame and destroy it
mCaptionFrames.DestroyFrame(aOldFrame);
PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
NS_FRAME_HAS_DIRTY_CHILDREN);
+ MarkNeedsDisplayItemRebuild();
}
void
nsTableWrapperFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists)
{
// No border, background or outline are painted because they all belong
// to the inner table.