Make sure to remove anonymous cols created by a <col span="n"> when that col is removed. Bug 399209, r=bernd, sr+a=roc
authorbzbarsky@mit.edu
Thu, 08 Nov 2007 22:05:19 -0800
changeset 7711 4e1161cfad93242c4fb868e02662e24246fc3fc7
parent 7710 08a9cded150d77b1a2c68e3255ddadd342a57bf8
child 7712 a7ebb78acaf533664faf3a50e58b3450f84aede7
push idunknown
push userunknown
push dateunknown
reviewersbernd, sr
bugs399209
milestone1.9b2pre
Make sure to remove anonymous cols created by a <col span="n"> when that col is removed. Bug 399209, r=bernd, sr+a=roc
layout/tables/nsTableColGroupFrame.cpp
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -311,16 +311,30 @@ nsTableColGroupFrame::RemoveFrame(nsIAto
                                   nsIFrame*       aOldFrame)
 {
   NS_ASSERTION(!aListName, "unexpected child list");
 
   if (!aOldFrame) return NS_OK;
 
   if (nsGkAtoms::tableColFrame == aOldFrame->GetType()) {
     nsTableColFrame* colFrame = (nsTableColFrame*)aOldFrame;
+    if (colFrame->GetColType() == eColContent) {
+      // Remove any anonymous column frames this <col> produced via a colspan
+      nsTableColFrame* col = colFrame->GetNextCol();
+      nsTableColFrame* nextCol;
+      while (col && col->GetColType() == eColAnonymousCol) {
+        NS_ASSERTION(col->GetStyleContext() == colFrame->GetStyleContext() &&
+                     col->GetContent() == colFrame->GetContent(),
+                     "How did that happen??");
+        nextCol = col->GetNextCol();
+        RemoveFrame(nsnull, col);
+        col = nextCol;
+      }
+    }
+    
     PRInt32 colIndex = colFrame->GetColIndex();
     RemoveChild(*colFrame, PR_TRUE);
     
     nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
     if (!tableFrame)
       return NS_ERROR_NULL_POINTER;
 
     tableFrame->RemoveCol(this, colIndex, PR_TRUE, PR_TRUE);