From fb9059334ef1dcf0bb638a23a3234a8f5f178d0a Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Tue, 17 Jan 2012 00:38:10 +0100 Subject: [PATCH] Bug 716408 - Remove unnecessary nsTableFrame::GetFirstInFlow() calls to get IsBorderCollapse() bit. r=bernd --- layout/tables/nsTableRowFrame.cpp | 15 +++++---------- layout/tables/nsTableRowGroupFrame.cpp | 7 +++---- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index f6301fd564b..1cf9e6abf18 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -191,7 +191,6 @@ nsTableRowFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext) return; nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this); - if (tableFrame->IsBorderCollapse() && tableFrame->BCRecalcNeeded(aOldStyleContext, GetStyleContext())) { nsRect damageArea(0, GetRowIndex(), tableFrame->GetColCount(), 1); @@ -237,8 +236,7 @@ nsTableRowFrame::InsertFrames(ChildListID aListID, // Get the table frame nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this); - - nsIAtom* cellFrameType = (tableFrame->IsBorderCollapse()) ? nsGkAtoms::bcTableCellFrame : nsGkAtoms::tableCellFrame; + nsIAtom* cellFrameType = tableFrame->IsBorderCollapse() ? nsGkAtoms::bcTableCellFrame : nsGkAtoms::tableCellFrame; nsTableCellFrame* prevCellFrame = (nsTableCellFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, cellFrameType); nsTArray cellChildren; for (nsFrameList::Enumerator e(newCells); !e.AtEnd(); e.Next()) { @@ -786,13 +784,10 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext, { aStatus = NS_FRAME_COMPLETE; - bool borderCollapse = (((nsTableFrame*)aTableFrame.GetFirstInFlow())->IsBorderCollapse()); - // XXXldb Should we be checking constrained height instead? - bool isPaginated = aPresContext->IsPaginated(); - + const bool isPaginated = aPresContext->IsPaginated(); + const bool borderCollapse = aTableFrame.IsBorderCollapse(); nsresult rv = NS_OK; - nscoord cellSpacingX = aTableFrame.GetCellSpacingX(); PRInt32 cellColSpan = 1; // must be defined here so it's set properly for non-cell kids @@ -1084,8 +1079,8 @@ nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext, nsRect cellRect = aCellFrame->GetRect(); nsRect cellVisualOverflow = aCellFrame->GetVisualOverflowRect(); - nsSize availSize(cellRect.width, aAvailableHeight); - bool borderCollapse = ((nsTableFrame*)tableFrame->GetFirstInFlow())->IsBorderCollapse(); + nsSize availSize(cellRect.width, aAvailableHeight); + bool borderCollapse = tableFrame->IsBorderCollapse(); nsTableCellReflowState cellReflowState(aPresContext, aReflowState, aCellFrame, availSize, false); InitChildReflowState(*aPresContext, availSize, borderCollapse, cellReflowState); diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 5aa1e7f5844..a5104688575 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -951,8 +951,7 @@ nsTableRowGroupFrame::SplitSpanningCells(nsPresContext& aPresContext, aFirstTruncatedRow = nsnull; aDesiredHeight = 0; - bool borderCollapse = - static_cast(aTable.GetFirstInFlow())->IsBorderCollapse(); + const bool borderCollapse = aTable.IsBorderCollapse(); PRInt32 lastRowIndex = aLastRow.GetRowIndex(); bool wasLast = false; bool haveRowSpan = false; @@ -1086,8 +1085,8 @@ nsTableRowGroupFrame::SplitRowGroup(nsPresContext* aPresContext, nscoord availWidth = aReflowState.availableWidth; nscoord availHeight = aReflowState.availableHeight; - bool borderCollapse = ((nsTableFrame*)aTableFrame->GetFirstInFlow())->IsBorderCollapse(); - nscoord cellSpacingY = aTableFrame->GetCellSpacingY(); + const bool borderCollapse = aTableFrame->IsBorderCollapse(); + nscoord cellSpacingY = aTableFrame->GetCellSpacingY(); // get the page height nscoord pageHeight = aPresContext->GetPageSize().height;