Bug 813358 part 1: Remove unnecessary nsBoxLayoutState argument from various XUL frame-sorting-related methods. r=dbaron

This commit is contained in:
Daniel Holbert 2012-11-30 15:25:32 -08:00
Родитель c93c8514aa
Коммит 7ccdd360a1
4 изменённых файлов: 18 добавлений и 18 удалений

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

@ -2727,7 +2727,7 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::ParagraphDepthProperty()))
virtual nsSize GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState) = 0;
// Implemented in nsBox, used in nsBoxFrame
uint32_t GetOrdinal(nsBoxLayoutState& aBoxLayoutState);
uint32_t GetOrdinal();
virtual nscoord GetFlex(nsBoxLayoutState& aBoxLayoutState) = 0;
virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState) = 0;

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

@ -463,7 +463,7 @@ nsBox::GetFlex(nsBoxLayoutState& aState)
}
uint32_t
nsIFrame::GetOrdinal(nsBoxLayoutState& aState)
nsIFrame::GetOrdinal()
{
uint32_t ordinal = GetStyleXUL()->mBoxOrdinal;

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

@ -134,7 +134,7 @@ nsBoxFrame::SetInitialChildList(ChildListID aListID,
if (r == NS_OK) {
// initialize our list of infos.
nsBoxLayoutState state(PresContext());
CheckBoxOrder(state);
CheckBoxOrder();
if (mLayoutManager)
mLayoutManager->ChildrenSet(this, state, mFrames.FirstChild());
} else {
@ -1039,7 +1039,7 @@ nsBoxFrame::InsertFrames(ChildListID aListID,
// manager; otherwise the slice we give the layout manager will
// just be bogus. If the layout manager cares about the order, we
// just lose.
CheckBoxOrder(state);
CheckBoxOrder();
#ifdef DEBUG_LAYOUT
// if we are in debug make sure our children are in debug as well.
@ -1072,7 +1072,7 @@ nsBoxFrame::AppendFrames(ChildListID aListID,
// manager; otherwise the slice we give the layout manager will
// just be bogus. If the layout manager cares about the order, we
// just lose.
CheckBoxOrder(state);
CheckBoxOrder();
#ifdef DEBUG_LAYOUT
// if we are in debug make sure our children are in debug as well.
@ -1898,13 +1898,13 @@ nsBoxFrame::SupportsOrdinalsInChildren()
}
static nsIFrame*
SortedMerge(nsBoxLayoutState& aState, nsIFrame *aLeft, nsIFrame *aRight)
SortedMerge(nsIFrame *aLeft, nsIFrame *aRight)
{
NS_PRECONDITION(aLeft && aRight, "SortedMerge must have non-empty lists");
nsIFrame *result;
// Unroll first iteration to avoid null-check 'result' inside the loop.
if (aLeft->GetOrdinal(aState) <= aRight->GetOrdinal(aState)) {
if (aLeft->GetOrdinal() <= aRight->GetOrdinal()) {
result = aLeft;
aLeft = aLeft->GetNextSibling();
if (!aLeft) {
@ -1923,7 +1923,7 @@ SortedMerge(nsBoxLayoutState& aState, nsIFrame *aLeft, nsIFrame *aRight)
nsIFrame *last = result;
for (;;) {
if (aLeft->GetOrdinal(aState) <= aRight->GetOrdinal(aState)) {
if (aLeft->GetOrdinal() <= aRight->GetOrdinal()) {
last->SetNextSibling(aLeft);
last = aLeft;
aLeft = aLeft->GetNextSibling();
@ -1945,7 +1945,7 @@ SortedMerge(nsBoxLayoutState& aState, nsIFrame *aLeft, nsIFrame *aRight)
}
static nsIFrame*
MergeSort(nsBoxLayoutState& aState, nsIFrame *aSource)
MergeSort(nsIFrame *aSource)
{
NS_PRECONDITION(aSource, "MergeSort null arg");
@ -1964,7 +1964,7 @@ MergeSort(nsBoxLayoutState& aState, nsIFrame *aSource)
// sorted[1] is a list of length 2 (or nullptr).
// sorted[2] is a list of length 4 (or nullptr). etc.
for (left = &sorted[0]; left != fill && *left; ++left) {
current = SortedMerge(aState, *left, current);
current = SortedMerge(*left, current);
*left = nullptr;
}
@ -1979,14 +1979,14 @@ MergeSort(nsBoxLayoutState& aState, nsIFrame *aSource)
nsIFrame *result = nullptr;
for (left = &sorted[0]; left != fill; ++left) {
if (*left) {
result = result ? SortedMerge(aState, *left, result) : *left;
result = result ? SortedMerge(*left, result) : *left;
}
}
return result;
}
void
nsBoxFrame::CheckBoxOrder(nsBoxLayoutState& aState)
nsBoxFrame::CheckBoxOrder()
{
nsIFrame *child = mFrames.FirstChild();
if (!child)
@ -1997,10 +1997,10 @@ nsBoxFrame::CheckBoxOrder(nsBoxLayoutState& aState)
// Run through our list of children and check whether we
// need to sort them.
uint32_t maxOrdinal = child->GetOrdinal(aState);
uint32_t maxOrdinal = child->GetOrdinal();
child = child->GetNextSibling();
for ( ; child; child = child->GetNextSibling()) {
uint32_t ordinal = child->GetOrdinal(aState);
uint32_t ordinal = child->GetOrdinal();
if (ordinal < maxOrdinal)
break;
maxOrdinal = ordinal;
@ -2009,7 +2009,7 @@ nsBoxFrame::CheckBoxOrder(nsBoxLayoutState& aState)
if (!child)
return;
nsIFrame* head = MergeSort(aState, mFrames.FirstChild());
nsIFrame* head = MergeSort(mFrames.FirstChild());
mFrames = nsFrameList(head, nsLayoutUtils::GetLastSibling(head));
}
@ -2035,13 +2035,13 @@ nsBoxFrame::RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIFrame* aChild)
if (!SupportsOrdinalsInChildren())
return NS_OK;
uint32_t ord = aChild->GetOrdinal(aState);
uint32_t ord = aChild->GetOrdinal();
nsIFrame* child = mFrames.FirstChild();
nsIFrame* newPrevSib = nullptr;
while (child) {
if (ord < child->GetOrdinal(aState)) {
if (ord < child->GetOrdinal()) {
break;
}

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

@ -220,7 +220,7 @@ protected:
protected:
nsresult RegUnregAccessKey(bool aDoReg);
NS_HIDDEN_(void) CheckBoxOrder(nsBoxLayoutState& aState);
NS_HIDDEN_(void) CheckBoxOrder();
private: