diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp
index 772a88064ea..e139909f167 100644
--- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp
@@ -628,9 +628,7 @@ nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext* aPresContext,
nsTableRowFrame* startRowFrame = aStartRowFrameIn;
if (!startRowFrame || (startRowIndex != startRowIndexSave)) {
PRInt32 rowX = rgStart;
- for (startRowFrame = (nsTableRowFrame*)mFrames.FirstChild();
- startRowFrame;
- startRowFrame->GetNextSibling((nsIFrame**)&startRowFrame)) {
+ for (startRowFrame = GetFirstRow(); startRowFrame; startRowFrame = startRowFrame->GetNextRow()) {
if (rowX >= startRowIndex)
break;
rowX++;
diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp
index 772a88064ea..e139909f167 100644
--- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp
+++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp
@@ -628,9 +628,7 @@ nsTableRowGroupFrame::CalculateRowHeights(nsIPresContext* aPresContext,
nsTableRowFrame* startRowFrame = aStartRowFrameIn;
if (!startRowFrame || (startRowIndex != startRowIndexSave)) {
PRInt32 rowX = rgStart;
- for (startRowFrame = (nsTableRowFrame*)mFrames.FirstChild();
- startRowFrame;
- startRowFrame->GetNextSibling((nsIFrame**)&startRowFrame)) {
+ for (startRowFrame = GetFirstRow(); startRowFrame; startRowFrame = startRowFrame->GetNextRow()) {
if (rowX >= startRowIndex)
break;
rowX++;