diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp
index df140c11dae..8fbe06bf88c 100644
--- a/mozilla/layout/html/table/src/nsTableFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableFrame.cpp
@@ -2027,6 +2027,9 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
if (cellData) {
cellFrame = cellData->mOrigCell;
if (cellFrame) { // the cell originates at (rowX, colX)
+ // reset the collapse offsets since they may have been collapsed previously
+ cellFrame->SetCollapseOffsetX(aPresContext, 0);
+ cellFrame->SetCollapseOffsetY(aPresContext, 0);
cellFrame->GetRect(cellRect);
if (collapseGroup || collapseCol) {
if (lastCell != cellFrame) { // do it only once if there is a row span
diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp
index df140c11dae..8fbe06bf88c 100644
--- a/mozilla/layout/tables/nsTableFrame.cpp
+++ b/mozilla/layout/tables/nsTableFrame.cpp
@@ -2027,6 +2027,9 @@ NS_METHOD nsTableFrame::AdjustForCollapsingCols(nsIPresContext* aPresContext,
if (cellData) {
cellFrame = cellData->mOrigCell;
if (cellFrame) { // the cell originates at (rowX, colX)
+ // reset the collapse offsets since they may have been collapsed previously
+ cellFrame->SetCollapseOffsetX(aPresContext, 0);
+ cellFrame->SetCollapseOffsetY(aPresContext, 0);
cellFrame->GetRect(cellRect);
if (collapseGroup || collapseCol) {
if (lastCell != cellFrame) { // do it only once if there is a row span