Bug 1409140. Speed up getting the first cellframe in a row and the next cellframe after the given one. r=mats

This commit is contained in:
Boris Zbarsky 2017-10-17 15:38:05 -04:00
Родитель 9dbce0f956
Коммит 32d797b5ff
4 изменённых файлов: 27 добавлений и 28 удалений

Просмотреть файл

@ -60,20 +60,6 @@ nsTableCellFrame::~nsTableCellFrame()
NS_IMPL_FRAMEARENA_HELPERS(nsTableCellFrame)
nsTableCellFrame*
nsTableCellFrame::GetNextCell() const
{
nsIFrame* childFrame = GetNextSibling();
while (childFrame) {
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
if (cellFrame) {
return cellFrame;
}
childFrame = childFrame->GetNextSibling();
}
return nullptr;
}
void
nsTableCellFrame::Init(nsIContent* aContent,
nsContainerFrame* aParent,

Просмотреть файл

@ -202,7 +202,17 @@ public:
bool HasPctOverBSize();
void SetHasPctOverBSize(bool aValue);
nsTableCellFrame* GetNextCell() const;
nsTableCellFrame* GetNextCell() const
{
nsIFrame* sibling = GetNextSibling();
#ifdef DEBUG
if (sibling) {
nsTableCellFrame* cellFrame = do_QueryFrame(sibling);
MOZ_ASSERT(cellFrame, "How do we have a non-cell sibling?");
}
#endif // DEBUG
return static_cast<nsTableCellFrame*>(sibling);
}
virtual LogicalMargin GetBorderWidth(WritingMode aWM) const;
@ -339,4 +349,17 @@ private:
BCPixelSize mIStartBorder;
};
// Implemented here because that's a sane-ish way to make the includes work out.
inline nsTableCellFrame* nsTableRowFrame::GetFirstCell() const
{
nsIFrame* firstChild = mFrames.FirstChild();
#ifdef DEBUG
if (firstChild) {
nsTableCellFrame* cellFrame = do_QueryFrame(firstChild);
MOZ_ASSERT(cellFrame, "How do we have a non-cell sibling?");
}
#endif // DEBUG
return static_cast<nsTableCellFrame*>(firstChild);
}
#endif

Просмотреть файл

@ -329,18 +329,6 @@ GetBSizeOfRowsSpannedBelowFirst(nsTableCellFrame& aTableCellFrame,
return bsize;
}
nsTableCellFrame*
nsTableRowFrame::GetFirstCell()
{
for (nsIFrame* childFrame : mFrames) {
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
if (cellFrame) {
return cellFrame;
}
}
return nullptr;
}
/**
* Post-reflow hook. This is where the table row does its post-processing
*/

Просмотреть файл

@ -80,7 +80,9 @@ public:
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
nsTableCellFrame* GetFirstCell() ;
// Implemented in nsTableCellFrame.h, because it needs to know about the
// nsTableCellFrame class, but we can't include nsTableCellFrame.h here.
inline nsTableCellFrame* GetFirstCell() const;
/** calls Reflow for all of its child cells.
* Cells with rowspan=1 are all set to the same height and stacked horizontally.