mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-09 05:14:24 +00:00
A little renaming. NOT IN BUILD
This commit is contained in:
parent
924a429ebe
commit
309b361933
@ -114,7 +114,7 @@ and one from the row list. When a cell is asked for its size it returns that sma
|
||||
be to accommodate the 2 cells. Row lists and Column lists use the same data structure: nsGridRow.
|
||||
Essentially a row and column are the same except a row goes alone the x axis and a column the y.
|
||||
To make things easier and save code everything is written in terms of the x dimension. A flag is
|
||||
passed in called "isRow" that can flip the calculations to the y axis.
|
||||
passed in called "isHorizontal" that can flip the calculations to the y axis.
|
||||
|
||||
Usually the number of cells in a row match the number of columns, but not always.
|
||||
It is possible to define 5 columns for a grid but have 10 cells in one of the rows.
|
||||
@ -303,8 +303,8 @@ nsGrid::FindRowsAndColumns(nsIBox** aRows, nsIBox** aColumns)
|
||||
nsGridRowGroupLayout* rowGroup = nsnull;
|
||||
monument->CastToRowGroupLayout(&rowGroup);
|
||||
if (rowGroup) {
|
||||
PRBool isRow = !nsSprocketLayout::IsHorizontal(child);
|
||||
if (isRow)
|
||||
PRBool isHorizontal = !nsSprocketLayout::IsHorizontal(child);
|
||||
if (isHorizontal)
|
||||
*aRows = child;
|
||||
else
|
||||
*aColumns = child;
|
||||
@ -347,7 +347,7 @@ nsGrid::CountRowsColumns(nsIBox* aRowBox, PRInt32& aRowCount, PRInt32& aComputed
|
||||
* Given the number of rows create nsGridRow objects for them and full them out.
|
||||
*/
|
||||
void
|
||||
nsGrid::BuildRows(nsIBox* aBox, PRBool aRowCount, nsGridRow** aRows, PRBool aIsRow)
|
||||
nsGrid::BuildRows(nsIBox* aBox, PRBool aRowCount, nsGridRow** aRows, PRBool aIsHorizontal)
|
||||
{
|
||||
// if not rows then return null
|
||||
if (aRowCount == 0) {
|
||||
@ -360,7 +360,7 @@ nsGrid::BuildRows(nsIBox* aBox, PRBool aRowCount, nsGridRow** aRows, PRBool aIsR
|
||||
nsGridRow* row;
|
||||
|
||||
// only create new rows if we have to. Reuse old rows.
|
||||
if (aIsRow)
|
||||
if (aIsHorizontal)
|
||||
{
|
||||
if (aRowCount > mRowCount) {
|
||||
delete[] mRows;
|
||||
@ -433,7 +433,7 @@ nsGrid::BuildCellMap(PRInt32 aRows, PRInt32 aColumns, nsGridCell** aCells)
|
||||
* from the column
|
||||
*/
|
||||
void
|
||||
nsGrid::PopulateCellMap(nsGridRow* aRows, nsGridRow* aColumns, PRInt32 aRowCount, PRInt32 aColumnCount, PRBool aIsRow)
|
||||
nsGrid::PopulateCellMap(nsGridRow* aRows, nsGridRow* aColumns, PRInt32 aRowCount, PRInt32 aColumnCount, PRBool aIsHorizontal)
|
||||
{
|
||||
if (!aRows)
|
||||
return;
|
||||
@ -466,7 +466,7 @@ nsGrid::PopulateCellMap(nsGridRow* aRows, nsGridRow* aColumns, PRInt32 aRowCount
|
||||
continue;
|
||||
}
|
||||
|
||||
if (aIsRow)
|
||||
if (aIsHorizontal)
|
||||
GetCellAt(j,i)->SetBoxInRow(child);
|
||||
else
|
||||
GetCellAt(i,j)->SetBoxInColumn(child);
|
||||
@ -518,17 +518,17 @@ nsGridRow* nsGrid::GetRows()
|
||||
}
|
||||
|
||||
nsGridRow*
|
||||
nsGrid::GetColumnAt(PRInt32 aIndex, PRBool aIsRow)
|
||||
nsGrid::GetColumnAt(PRInt32 aIndex, PRBool aIsHorizontal)
|
||||
{
|
||||
return GetRowAt(aIndex, !aIsRow);
|
||||
return GetRowAt(aIndex, !aIsHorizontal);
|
||||
}
|
||||
|
||||
nsGridRow*
|
||||
nsGrid::GetRowAt(PRInt32 aIndex, PRBool aIsRow)
|
||||
nsGrid::GetRowAt(PRInt32 aIndex, PRBool aIsHorizontal)
|
||||
{
|
||||
RebuildIfNeeded();
|
||||
|
||||
if (aIsRow) {
|
||||
if (aIsHorizontal) {
|
||||
NS_ASSERTION(aIndex < mRowCount || aIndex >= 0, "Index out of range");
|
||||
return &mRows[aIndex];
|
||||
} else {
|
||||
@ -548,17 +548,17 @@ nsGrid::GetCellAt(PRInt32 aX, PRInt32 aY)
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsGrid::GetExtraColumnCount(PRBool aIsRow)
|
||||
nsGrid::GetExtraColumnCount(PRBool aIsHorizontal)
|
||||
{
|
||||
return GetExtraRowCount(!aIsRow);
|
||||
return GetExtraRowCount(!aIsHorizontal);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsGrid::GetExtraRowCount(PRBool aIsRow)
|
||||
nsGrid::GetExtraRowCount(PRBool aIsHorizontal)
|
||||
{
|
||||
RebuildIfNeeded();
|
||||
|
||||
if (aIsRow)
|
||||
if (aIsHorizontal)
|
||||
return mExtraRowCount;
|
||||
else
|
||||
return mExtraColumnCount;
|
||||
@ -567,49 +567,49 @@ nsGrid::GetExtraRowCount(PRBool aIsRow)
|
||||
|
||||
/**
|
||||
* These methods return the preferred, min, max sizes for a given row index.
|
||||
* aIsRow if aIsRow is PR_TRUE. If you pass PR_FALSE you will get the inverse.
|
||||
* aIsHorizontal if aIsHorizontal is PR_TRUE. If you pass PR_FALSE you will get the inverse.
|
||||
* As if you called GetPrefColumnSize(aState, index, aPref)
|
||||
*/
|
||||
nsresult
|
||||
nsGrid::GetPrefRowSize(nsBoxLayoutState& aState, PRInt32 aRowIndex, nsSize& aSize, PRBool aIsRow)
|
||||
nsGrid::GetPrefRowSize(nsBoxLayoutState& aState, PRInt32 aRowIndex, nsSize& aSize, PRBool aIsHorizontal)
|
||||
{
|
||||
NS_ASSERTION(aRowIndex >=0 && aRowIndex < GetRowCount(aIsRow), "Row index out of range!");
|
||||
//if (!(aRowIndex >=0 && aRowIndex < GetRowCount(aIsRow)))
|
||||
NS_ASSERTION(aRowIndex >=0 && aRowIndex < GetRowCount(aIsHorizontal), "Row index out of range!");
|
||||
//if (!(aRowIndex >=0 && aRowIndex < GetRowCount(aIsHorizontal)))
|
||||
// return NS_OK;
|
||||
|
||||
nscoord height = 0;
|
||||
GetPrefRowHeight(aState, aRowIndex, height, aIsRow);
|
||||
SetLargestSize(aSize, height, aIsRow);
|
||||
GetPrefRowHeight(aState, aRowIndex, height, aIsHorizontal);
|
||||
SetLargestSize(aSize, height, aIsHorizontal);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGrid::GetMinRowSize(nsBoxLayoutState& aState, PRInt32 aRowIndex, nsSize& aSize, PRBool aIsRow)
|
||||
nsGrid::GetMinRowSize(nsBoxLayoutState& aState, PRInt32 aRowIndex, nsSize& aSize, PRBool aIsHorizontal)
|
||||
{
|
||||
NS_ASSERTION(aRowIndex >=0 && aRowIndex < GetRowCount(aIsRow), "Row index out of range!");
|
||||
NS_ASSERTION(aRowIndex >=0 && aRowIndex < GetRowCount(aIsHorizontal), "Row index out of range!");
|
||||
|
||||
// if (!(aRowIndex >=0 && aRowIndex < GetRowCount(aIsRow)))
|
||||
// if (!(aRowIndex >=0 && aRowIndex < GetRowCount(aIsHorizontal)))
|
||||
// return NS_OK;
|
||||
|
||||
nscoord height = 0;
|
||||
GetMinRowHeight(aState, aRowIndex, height, aIsRow);
|
||||
SetLargestSize(aSize, height, aIsRow);
|
||||
GetMinRowHeight(aState, aRowIndex, height, aIsHorizontal);
|
||||
SetLargestSize(aSize, height, aIsHorizontal);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGrid::GetMaxRowSize(nsBoxLayoutState& aState, PRInt32 aRowIndex, nsSize& aSize, PRBool aIsRow)
|
||||
nsGrid::GetMaxRowSize(nsBoxLayoutState& aState, PRInt32 aRowIndex, nsSize& aSize, PRBool aIsHorizontal)
|
||||
{
|
||||
NS_ASSERTION(aRowIndex >=0 && aRowIndex < GetRowCount(aIsRow), "Row index out of range!");
|
||||
NS_ASSERTION(aRowIndex >=0 && aRowIndex < GetRowCount(aIsHorizontal), "Row index out of range!");
|
||||
|
||||
// if (!(aRowIndex >=0 && aRowIndex < GetRowCount(aIsRow)))
|
||||
// if (!(aRowIndex >=0 && aRowIndex < GetRowCount(aIsHorizontal)))
|
||||
// return NS_OK;
|
||||
|
||||
nscoord height = 0;
|
||||
GetMaxRowHeight(aState, aRowIndex, height, aIsRow);
|
||||
SetSmallestSize(aSize, height, aIsRow);
|
||||
GetMaxRowHeight(aState, aRowIndex, height, aIsHorizontal);
|
||||
SetSmallestSize(aSize, height, aIsHorizontal);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -633,7 +633,7 @@ nsGrid::GetPartFromBox(nsIBox* aBox, nsIGridPart** aPart)
|
||||
}
|
||||
|
||||
void
|
||||
nsGrid::GetBoxTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsRow)
|
||||
nsGrid::GetBoxTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal)
|
||||
{
|
||||
// walk the boxes parent chain getting the border/padding/margin of our parent rows
|
||||
|
||||
@ -642,7 +642,7 @@ nsGrid::GetBoxTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsRow)
|
||||
nsCOMPtr<nsIGridPart> parent;
|
||||
GetPartFromBox(aBox, getter_AddRefs(part));
|
||||
if (part)
|
||||
part->GetTotalMargin(aBox, aMargin, aIsRow);
|
||||
part->GetTotalMargin(aBox, aMargin, aIsHorizontal);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -651,12 +651,12 @@ nsGrid::GetBoxTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsRow)
|
||||
* have a top or bottom margin.
|
||||
*/
|
||||
void
|
||||
nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, nscoord& aBottom, PRBool aIsRow)
|
||||
nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, nscoord& aBottom, PRBool aIsHorizontal)
|
||||
{
|
||||
|
||||
RebuildIfNeeded();
|
||||
|
||||
nsGridRow* row = GetRowAt(aIndex, aIsRow);
|
||||
nsGridRow* row = GetRowAt(aIndex, aIsHorizontal);
|
||||
|
||||
if (row->IsOffsetSet())
|
||||
{
|
||||
@ -664,7 +664,7 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n
|
||||
aBottom = row->mBottom;
|
||||
return;
|
||||
}
|
||||
PRInt32 lastRow = GetRowCount(aIsRow)-1;
|
||||
PRInt32 lastRow = GetRowCount(aIsHorizontal)-1;
|
||||
|
||||
// first get the rows top and bottom border and padding
|
||||
nsIBox* box = row->GetBox();
|
||||
@ -701,12 +701,12 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n
|
||||
// fortunately they only affect the first
|
||||
// and last row inside the <rows> tag
|
||||
|
||||
GetBoxTotalMargin(box, margin, aIsRow);
|
||||
GetBoxTotalMargin(box, margin, aIsHorizontal);
|
||||
|
||||
totalMargin = margin;
|
||||
}
|
||||
|
||||
if (aIsRow) {
|
||||
if (aIsHorizontal) {
|
||||
row->mTop = totalBorderPadding.top;
|
||||
row->mBottom = totalBorderPadding.bottom;
|
||||
row->mTopMargin = totalMargin.top;
|
||||
@ -732,7 +732,7 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n
|
||||
|
||||
// run through the columns. Look at each column
|
||||
// pick the largest top border or bottom border
|
||||
PRInt32 count = GetColumnCount(aIsRow);
|
||||
PRInt32 count = GetColumnCount(aIsHorizontal);
|
||||
|
||||
PRBool isCollapsed = PR_FALSE;
|
||||
|
||||
@ -740,7 +740,7 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n
|
||||
{
|
||||
nsMargin totalChildBorderPadding(0,0,0,0);
|
||||
|
||||
nsGridRow* column = GetColumnAt(i,aIsRow);
|
||||
nsGridRow* column = GetColumnAt(i,aIsHorizontal);
|
||||
nsIBox* box = column->GetBox();
|
||||
|
||||
if (box)
|
||||
@ -753,7 +753,7 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n
|
||||
// include the margin of the columns. To the row
|
||||
// at this point border/padding and margins all added
|
||||
// up to more needed space.
|
||||
GetBoxTotalMargin(box, margin, !aIsRow);
|
||||
GetBoxTotalMargin(box, margin, !aIsHorizontal);
|
||||
box->GetInset(inset);
|
||||
// get real border and padding. GetBorderAndPadding
|
||||
// is redefined on nsGridRowLeafFrame. If we called it here
|
||||
@ -771,7 +771,7 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n
|
||||
|
||||
// pick the largest top margin
|
||||
if (aIndex == 0) {
|
||||
if (aIsRow) {
|
||||
if (aIsHorizontal) {
|
||||
top = totalChildBorderPadding.top;
|
||||
} else {
|
||||
top = totalChildBorderPadding.left;
|
||||
@ -782,7 +782,7 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n
|
||||
|
||||
// pick the largest bottom margin
|
||||
if (aIndex == lastRow) {
|
||||
if (aIsRow) {
|
||||
if (aIsHorizontal) {
|
||||
bottom = totalChildBorderPadding.bottom;
|
||||
} else {
|
||||
bottom = totalChildBorderPadding.right;
|
||||
@ -815,15 +815,15 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n
|
||||
|
||||
/**
|
||||
* These methods return the preferred, min, max coord for a given row index if
|
||||
* aIsRow is PR_TRUE. If you pass PR_FALSE you will get the inverse.
|
||||
* aIsHorizontal is PR_TRUE. If you pass PR_FALSE you will get the inverse.
|
||||
* As if you called GetPrefColumnHeight(aState, index, aPref).
|
||||
*/
|
||||
nsresult
|
||||
nsGrid::GetPrefRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize, PRBool aIsRow)
|
||||
nsGrid::GetPrefRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize, PRBool aIsHorizontal)
|
||||
{
|
||||
RebuildIfNeeded();
|
||||
|
||||
nsGridRow* row = GetRowAt(aIndex, aIsRow);
|
||||
nsGridRow* row = GetRowAt(aIndex, aIsHorizontal);
|
||||
|
||||
if (row->IsPrefSet())
|
||||
{
|
||||
@ -840,7 +840,7 @@ nsGrid::GetPrefRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSiz
|
||||
cssSize.height = -1;
|
||||
nsIBox::AddCSSPrefSize(aState, box, cssSize);
|
||||
|
||||
row->mPref = GET_HEIGHT(cssSize, aIsRow);
|
||||
row->mPref = GET_HEIGHT(cssSize, aIsHorizontal);
|
||||
|
||||
// yep do nothing.
|
||||
if (row->mPref != -1)
|
||||
@ -853,7 +853,7 @@ nsGrid::GetPrefRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSiz
|
||||
// get the offsets so they are cached.
|
||||
nscoord top;
|
||||
nscoord bottom;
|
||||
GetRowOffsets(aState, aIndex, top, bottom, aIsRow);
|
||||
GetRowOffsets(aState, aIndex, top, bottom, aIsHorizontal);
|
||||
|
||||
|
||||
// is the row bogus? If so then just ask it for its size
|
||||
@ -868,7 +868,7 @@ nsGrid::GetPrefRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSiz
|
||||
nsStackLayout::AddOffset(aState, box, size);
|
||||
}
|
||||
|
||||
row->mPref = GET_HEIGHT(size, aIsRow);
|
||||
row->mPref = GET_HEIGHT(size, aIsHorizontal);
|
||||
aSize = row->mPref;
|
||||
|
||||
return NS_OK;
|
||||
@ -878,13 +878,13 @@ nsGrid::GetPrefRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSiz
|
||||
|
||||
nsGridCell* child;
|
||||
|
||||
PRInt32 count = GetColumnCount(aIsRow);
|
||||
PRInt32 count = GetColumnCount(aIsHorizontal);
|
||||
|
||||
PRBool isCollapsed = PR_FALSE;
|
||||
|
||||
for (PRInt32 i=0; i < count; i++)
|
||||
{
|
||||
if (aIsRow)
|
||||
if (aIsHorizontal)
|
||||
child = GetCellAt(i,aIndex);
|
||||
else
|
||||
child = GetCellAt(aIndex,i);
|
||||
@ -898,11 +898,11 @@ nsGrid::GetPrefRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSiz
|
||||
|
||||
child->GetPrefSize(aState, childSize);
|
||||
|
||||
nsSprocketLayout::AddLargestSize(size, childSize, aIsRow);
|
||||
nsSprocketLayout::AddLargestSize(size, childSize, aIsHorizontal);
|
||||
}
|
||||
}
|
||||
|
||||
row->mPref = GET_HEIGHT(size, aIsRow) + top + bottom;
|
||||
row->mPref = GET_HEIGHT(size, aIsHorizontal) + top + bottom;
|
||||
|
||||
|
||||
aSize = row->mPref;
|
||||
@ -911,11 +911,11 @@ nsGrid::GetPrefRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSiz
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGrid::GetMinRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize, PRBool aIsRow)
|
||||
nsGrid::GetMinRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize, PRBool aIsHorizontal)
|
||||
{
|
||||
RebuildIfNeeded();
|
||||
|
||||
nsGridRow* row = GetRowAt(aIndex, aIsRow);
|
||||
nsGridRow* row = GetRowAt(aIndex, aIsHorizontal);
|
||||
|
||||
if (row->IsMinSet())
|
||||
{
|
||||
@ -932,7 +932,7 @@ nsGrid::GetMinRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize
|
||||
cssSize.height = -1;
|
||||
nsIBox::AddCSSMinSize(aState, box, cssSize);
|
||||
|
||||
row->mMin = GET_HEIGHT(cssSize, aIsRow);
|
||||
row->mMin = GET_HEIGHT(cssSize, aIsHorizontal);
|
||||
|
||||
// yep do nothing.
|
||||
if (row->mMin != -1)
|
||||
@ -945,7 +945,7 @@ nsGrid::GetMinRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize
|
||||
// get the offsets so they are cached.
|
||||
nscoord top;
|
||||
nscoord bottom;
|
||||
GetRowOffsets(aState, aIndex, top, bottom, aIsRow);
|
||||
GetRowOffsets(aState, aIndex, top, bottom, aIsHorizontal);
|
||||
|
||||
// is the row bogus? If so then just ask it for its size
|
||||
// it should not be affected by cells in the grid.
|
||||
@ -959,7 +959,7 @@ nsGrid::GetMinRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize
|
||||
nsStackLayout::AddOffset(aState, box, size);
|
||||
}
|
||||
|
||||
row->mMin = GET_HEIGHT(size, aIsRow) + top + bottom;
|
||||
row->mMin = GET_HEIGHT(size, aIsHorizontal) + top + bottom;
|
||||
aSize = row->mMin;
|
||||
|
||||
return NS_OK;
|
||||
@ -969,13 +969,13 @@ nsGrid::GetMinRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize
|
||||
|
||||
nsGridCell* child;
|
||||
|
||||
PRInt32 count = GetColumnCount(aIsRow);
|
||||
PRInt32 count = GetColumnCount(aIsHorizontal);
|
||||
|
||||
PRBool isCollapsed = PR_FALSE;
|
||||
|
||||
for (PRInt32 i=0; i < count; i++)
|
||||
{
|
||||
if (aIsRow)
|
||||
if (aIsHorizontal)
|
||||
child = GetCellAt(i,aIndex);
|
||||
else
|
||||
child = GetCellAt(aIndex,i);
|
||||
@ -989,11 +989,11 @@ nsGrid::GetMinRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize
|
||||
|
||||
child->GetMinSize(aState, childSize);
|
||||
|
||||
nsSprocketLayout::AddLargestSize(size, childSize, aIsRow);
|
||||
nsSprocketLayout::AddLargestSize(size, childSize, aIsHorizontal);
|
||||
}
|
||||
}
|
||||
|
||||
row->mMin = GET_HEIGHT(size, aIsRow);
|
||||
row->mMin = GET_HEIGHT(size, aIsHorizontal);
|
||||
|
||||
aSize = row->mMin;
|
||||
|
||||
@ -1001,11 +1001,11 @@ nsGrid::GetMinRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGrid::GetMaxRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize, PRBool aIsRow)
|
||||
nsGrid::GetMaxRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize, PRBool aIsHorizontal)
|
||||
{
|
||||
RebuildIfNeeded();
|
||||
|
||||
nsGridRow* row = GetRowAt(aIndex, aIsRow);
|
||||
nsGridRow* row = GetRowAt(aIndex, aIsHorizontal);
|
||||
|
||||
if (row->IsMaxSet())
|
||||
{
|
||||
@ -1022,7 +1022,7 @@ nsGrid::GetMaxRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize
|
||||
cssSize.height = -1;
|
||||
nsIBox::AddCSSMaxSize(aState, box, cssSize);
|
||||
|
||||
row->mMax = GET_HEIGHT(cssSize, aIsRow);
|
||||
row->mMax = GET_HEIGHT(cssSize, aIsHorizontal);
|
||||
|
||||
// yep do nothing.
|
||||
if (row->mMax != -1)
|
||||
@ -1035,7 +1035,7 @@ nsGrid::GetMaxRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize
|
||||
// get the offsets so they are cached.
|
||||
nscoord top;
|
||||
nscoord bottom;
|
||||
GetRowOffsets(aState, aIndex, top, bottom, aIsRow);
|
||||
GetRowOffsets(aState, aIndex, top, bottom, aIsHorizontal);
|
||||
|
||||
// is the row bogus? If so then just ask it for its size
|
||||
// it should not be affected by cells in the grid.
|
||||
@ -1049,7 +1049,7 @@ nsGrid::GetMaxRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize
|
||||
nsStackLayout::AddOffset(aState, box, size);
|
||||
}
|
||||
|
||||
row->mMax = GET_HEIGHT(size, aIsRow);
|
||||
row->mMax = GET_HEIGHT(size, aIsHorizontal);
|
||||
aSize = row->mMax;
|
||||
|
||||
return NS_OK;
|
||||
@ -1059,13 +1059,13 @@ nsGrid::GetMaxRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize
|
||||
|
||||
nsGridCell* child;
|
||||
|
||||
PRInt32 count = GetColumnCount(aIsRow);
|
||||
PRInt32 count = GetColumnCount(aIsHorizontal);
|
||||
|
||||
PRBool isCollapsed = PR_FALSE;
|
||||
|
||||
for (PRInt32 i=0; i < count; i++)
|
||||
{
|
||||
if (aIsRow)
|
||||
if (aIsHorizontal)
|
||||
child = GetCellAt(i,aIndex);
|
||||
else
|
||||
child = GetCellAt(aIndex,i);
|
||||
@ -1079,11 +1079,11 @@ nsGrid::GetMaxRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aSize
|
||||
|
||||
child->GetMaxSize(aState, childSize);
|
||||
|
||||
nsSprocketLayout::AddLargestSize(size, childSize, aIsRow);
|
||||
nsSprocketLayout::AddLargestSize(size, childSize, aIsHorizontal);
|
||||
}
|
||||
}
|
||||
|
||||
row->mMax = GET_HEIGHT(size, aIsRow) + top + bottom;
|
||||
row->mMax = GET_HEIGHT(size, aIsHorizontal) + top + bottom;
|
||||
|
||||
aSize = row->mMax;
|
||||
|
||||
@ -1116,11 +1116,11 @@ nsGrid::IsGrid(nsIBox* aBox)
|
||||
* tags are around us. Their flexibilty will affect ours.
|
||||
*/
|
||||
nsresult
|
||||
nsGrid::GetRowFlex(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aFlex, PRBool aIsRow)
|
||||
nsGrid::GetRowFlex(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aFlex, PRBool aIsHorizontal)
|
||||
{
|
||||
RebuildIfNeeded();
|
||||
|
||||
nsGridRow* row = GetRowAt(aIndex, aIsRow);
|
||||
nsGridRow* row = GetRowAt(aIndex, aIsHorizontal);
|
||||
|
||||
if (row->IsFlexSet())
|
||||
{
|
||||
@ -1220,9 +1220,9 @@ nsGrid::GetRowFlex(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aFlex, PRB
|
||||
}
|
||||
|
||||
void
|
||||
nsGrid::SetLargestSize(nsSize& aSize, nscoord aHeight, PRBool aIsRow)
|
||||
nsGrid::SetLargestSize(nsSize& aSize, nscoord aHeight, PRBool aIsHorizontal)
|
||||
{
|
||||
if (aIsRow) {
|
||||
if (aIsHorizontal) {
|
||||
if (aSize.height < aHeight)
|
||||
aSize.height = aHeight;
|
||||
} else {
|
||||
@ -1232,9 +1232,9 @@ nsGrid::SetLargestSize(nsSize& aSize, nscoord aHeight, PRBool aIsRow)
|
||||
}
|
||||
|
||||
void
|
||||
nsGrid::SetSmallestSize(nsSize& aSize, nscoord aHeight, PRBool aIsRow)
|
||||
nsGrid::SetSmallestSize(nsSize& aSize, nscoord aHeight, PRBool aIsHorizontal)
|
||||
{
|
||||
if (aIsRow) {
|
||||
if (aIsHorizontal) {
|
||||
if (aSize.height > aHeight)
|
||||
aSize.height = aHeight;
|
||||
} else {
|
||||
@ -1244,20 +1244,20 @@ nsGrid::SetSmallestSize(nsSize& aSize, nscoord aHeight, PRBool aIsRow)
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsGrid::GetRowCount(PRInt32 aIsRow)
|
||||
nsGrid::GetRowCount(PRInt32 aIsHorizontal)
|
||||
{
|
||||
RebuildIfNeeded();
|
||||
|
||||
if (aIsRow)
|
||||
if (aIsHorizontal)
|
||||
return mRowCount;
|
||||
else
|
||||
return mColumnCount;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsGrid::GetColumnCount(PRInt32 aIsRow)
|
||||
nsGrid::GetColumnCount(PRInt32 aIsHorizontal)
|
||||
{
|
||||
return GetRowCount(!aIsRow);
|
||||
return GetRowCount(!aIsHorizontal);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1265,7 +1265,7 @@ nsGrid::GetColumnCount(PRInt32 aIsRow)
|
||||
* in some way.
|
||||
*/
|
||||
void
|
||||
nsGrid::RowChildIsDirty(nsBoxLayoutState& aState, PRInt32 aRowIndex, PRInt32 aColumnIndex, PRBool aIsRow)
|
||||
nsGrid::RowChildIsDirty(nsBoxLayoutState& aState, PRInt32 aRowIndex, PRInt32 aColumnIndex, PRBool aIsHorizontal)
|
||||
{
|
||||
// if we are already dirty do nothing.
|
||||
if (mNeedsRebuild || mMarkingDirty)
|
||||
@ -1274,7 +1274,7 @@ nsGrid::RowChildIsDirty(nsBoxLayoutState& aState, PRInt32 aRowIndex, PRInt32 aCo
|
||||
mMarkingDirty = PR_TRUE;
|
||||
|
||||
// index out of range. Rebuild it all
|
||||
if (aRowIndex >= GetRowCount(aIsRow) || aColumnIndex >= GetColumnCount(aIsRow))
|
||||
if (aRowIndex >= GetRowCount(aIsHorizontal) || aColumnIndex >= GetColumnCount(aIsHorizontal))
|
||||
{
|
||||
NeedsRebuild(aState);
|
||||
return;
|
||||
@ -1293,10 +1293,10 @@ nsGrid::RowChildIsDirty(nsBoxLayoutState& aState, PRInt32 aRowIndex, PRInt32 aCo
|
||||
mColumnBox->MarkDirty(aState);
|
||||
|
||||
// dirty just our row and column that we were given
|
||||
nsGridRow* row = GetRowAt(aRowIndex, aIsRow);
|
||||
nsGridRow* row = GetRowAt(aRowIndex, aIsHorizontal);
|
||||
row->MarkDirty(aState);
|
||||
|
||||
nsGridRow* column = GetColumnAt(aColumnIndex, aIsRow);
|
||||
nsGridRow* column = GetColumnAt(aColumnIndex, aIsHorizontal);
|
||||
column->MarkDirty(aState);
|
||||
|
||||
|
||||
@ -1308,7 +1308,7 @@ nsGrid::RowChildIsDirty(nsBoxLayoutState& aState, PRInt32 aRowIndex, PRInt32 aCo
|
||||
* force it to change size
|
||||
*/
|
||||
void
|
||||
nsGrid::RowIsDirty(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsRow)
|
||||
nsGrid::RowIsDirty(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsHorizontal)
|
||||
{
|
||||
if (mMarkingDirty)
|
||||
return;
|
||||
@ -1320,7 +1320,7 @@ nsGrid::RowIsDirty(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsRow)
|
||||
* A cell in the given row or columns at the given index has had a child added or removed
|
||||
*/
|
||||
void
|
||||
nsGrid::CellAddedOrRemoved(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsRow)
|
||||
nsGrid::CellAddedOrRemoved(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsHorizontal)
|
||||
{
|
||||
// TBD see if the cell will fit in our current row. If it will
|
||||
// just add it in.
|
||||
@ -1335,7 +1335,7 @@ nsGrid::CellAddedOrRemoved(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsR
|
||||
* A row or columns at the given index had been added or removed
|
||||
*/
|
||||
void
|
||||
nsGrid::RowAddedOrRemoved(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsRow)
|
||||
nsGrid::RowAddedOrRemoved(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsHorizontal)
|
||||
{
|
||||
// TBD see if we have extra room in the table and just add the new row in
|
||||
// for now rebuild the world
|
||||
|
@ -62,57 +62,57 @@ public:
|
||||
nsGrid();
|
||||
~nsGrid();
|
||||
|
||||
nsGridRow* GetColumnAt(PRInt32 aIndex, PRBool aIsRow = PR_TRUE);
|
||||
nsGridRow* GetRowAt(PRInt32 aIndex, PRBool aIsRow = PR_TRUE);
|
||||
nsGridRow* GetColumnAt(PRInt32 aIndex, PRBool aIsHorizontal = PR_TRUE);
|
||||
nsGridRow* GetRowAt(PRInt32 aIndex, PRBool aIsHorizontal = PR_TRUE);
|
||||
nsGridCell* GetCellAt(PRInt32 aX, PRInt32 aY);
|
||||
|
||||
void NeedsRebuild(nsBoxLayoutState& aBoxLayoutState);
|
||||
void RebuildIfNeeded();
|
||||
|
||||
nsresult GetPrefRowSize(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, nsSize& aSize, PRBool aIsRow = PR_TRUE);
|
||||
nsresult GetMinRowSize(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, nsSize& aSize, PRBool aIsRow = PR_TRUE);
|
||||
nsresult GetMaxRowSize(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, nsSize& aSize, PRBool aIsRow = PR_TRUE);
|
||||
nsresult GetRowFlex(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, nscoord& aSize, PRBool aIsRow = PR_TRUE);
|
||||
nsresult GetPrefRowSize(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, nsSize& aSize, PRBool aIsHorizontal = PR_TRUE);
|
||||
nsresult GetMinRowSize(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, nsSize& aSize, PRBool aIsHorizontal = PR_TRUE);
|
||||
nsresult GetMaxRowSize(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, nsSize& aSize, PRBool aIsHorizontal = PR_TRUE);
|
||||
nsresult GetRowFlex(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, nscoord& aSize, PRBool aIsHorizontal = PR_TRUE);
|
||||
|
||||
nsresult GetPrefRowHeight(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, nscoord& aHeight, PRBool aIsRow = PR_TRUE);
|
||||
nsresult GetMinRowHeight(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, nscoord& aHeight, PRBool aIsRow = PR_TRUE);
|
||||
nsresult GetMaxRowHeight(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, nscoord& aHeight, PRBool aIsRow = PR_TRUE);
|
||||
void GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, nscoord& aBottom, PRBool aIsRow = PR_TRUE);
|
||||
nsresult GetPrefRowHeight(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, nscoord& aHeight, PRBool aIsHorizontal = PR_TRUE);
|
||||
nsresult GetMinRowHeight(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, nscoord& aHeight, PRBool aIsHorizontal = PR_TRUE);
|
||||
nsresult GetMaxRowHeight(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, nscoord& aHeight, PRBool aIsHorizontal = PR_TRUE);
|
||||
void GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, nscoord& aBottom, PRBool aIsHorizontal = PR_TRUE);
|
||||
|
||||
void RowChildIsDirty(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, PRInt32 aColumnIndex, PRBool aIsRow = PR_TRUE);
|
||||
void RowIsDirty(nsBoxLayoutState& aBoxLayoutState, PRInt32 aIndex, PRBool aIsRow = PR_TRUE);
|
||||
void RowAddedOrRemoved(nsBoxLayoutState& aBoxLayoutState, PRInt32 aIndex, PRBool aIsRow = PR_TRUE);
|
||||
void CellAddedOrRemoved(nsBoxLayoutState& aBoxLayoutState, PRInt32 aIndex, PRBool aIsRow = PR_TRUE);
|
||||
void RowChildIsDirty(nsBoxLayoutState& aBoxLayoutState, PRInt32 aRowIndex, PRInt32 aColumnIndex, PRBool aIsHorizontal = PR_TRUE);
|
||||
void RowIsDirty(nsBoxLayoutState& aBoxLayoutState, PRInt32 aIndex, PRBool aIsHorizontal = PR_TRUE);
|
||||
void RowAddedOrRemoved(nsBoxLayoutState& aBoxLayoutState, PRInt32 aIndex, PRBool aIsHorizontal = PR_TRUE);
|
||||
void CellAddedOrRemoved(nsBoxLayoutState& aBoxLayoutState, PRInt32 aIndex, PRBool aIsHorizontal = PR_TRUE);
|
||||
void DirtyRows(nsIBox* aRowBox, nsBoxLayoutState& aState);
|
||||
#ifdef DEBUG_grid
|
||||
void PrintCellMap();
|
||||
#endif
|
||||
PRInt32 GetExtraColumnCount(PRBool aIsRow = PR_TRUE);
|
||||
PRInt32 GetExtraRowCount(PRBool aIsRow = PR_TRUE);
|
||||
PRInt32 GetExtraColumnCount(PRBool aIsHorizontal = PR_TRUE);
|
||||
PRInt32 GetExtraRowCount(PRBool aIsHorizontal = PR_TRUE);
|
||||
|
||||
// accessors
|
||||
void SetBox(nsIBox* aBox) { mBox = aBox; }
|
||||
nsIBox* GetBox() { return mBox; }
|
||||
nsGridRow* GetColumns();
|
||||
nsGridRow* GetRows();
|
||||
PRInt32 GetRowCount(PRInt32 aIsRow = PR_TRUE);
|
||||
PRInt32 GetColumnCount(PRInt32 aIsRow = PR_TRUE);
|
||||
PRInt32 GetRowCount(PRInt32 aIsHorizontal = PR_TRUE);
|
||||
PRInt32 GetColumnCount(PRInt32 aIsHorizontal = PR_TRUE);
|
||||
|
||||
static nsIBox* GetScrolledBox(nsIBox* aChild);
|
||||
static nsIBox* GetScrollBox(nsIBox* aChild);
|
||||
|
||||
private:
|
||||
void GetPartFromBox(nsIBox* aBox, nsIGridPart** aPart);
|
||||
void GetBoxTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsRow = PR_TRUE);
|
||||
void GetBoxTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal = PR_TRUE);
|
||||
|
||||
void FreeMap();
|
||||
void FindRowsAndColumns(nsIBox** aRows, nsIBox** aColumns);
|
||||
void BuildRows(nsIBox* aBox, PRBool aSize, nsGridRow** aColumnsRows, PRBool aIsRow = PR_TRUE);
|
||||
void BuildRows(nsIBox* aBox, PRBool aSize, nsGridRow** aColumnsRows, PRBool aIsHorizontal = PR_TRUE);
|
||||
void BuildCellMap(PRInt32 aRows, PRInt32 aColumns, nsGridCell** aCells);
|
||||
void PopulateCellMap(nsGridRow* aRows, nsGridRow* aColumns, PRInt32 aRowCount, PRInt32 aColumnCount, PRBool aIsRow = PR_TRUE);
|
||||
void PopulateCellMap(nsGridRow* aRows, nsGridRow* aColumns, PRInt32 aRowCount, PRInt32 aColumnCount, PRBool aIsHorizontal = PR_TRUE);
|
||||
void CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount);
|
||||
void SetLargestSize(nsSize& aSize, nscoord aHeight, PRBool aIsRow = PR_TRUE);
|
||||
void SetSmallestSize(nsSize& aSize, nscoord aHeight, PRBool aIsRow = PR_TRUE);
|
||||
void SetLargestSize(nsSize& aSize, nscoord aHeight, PRBool aIsHorizontal = PR_TRUE);
|
||||
void SetSmallestSize(nsSize& aSize, nscoord aHeight, PRBool aIsHorizontal = PR_TRUE);
|
||||
PRBool IsGrid(nsIBox* aBox);
|
||||
|
||||
// the box that implement the <grid> tag
|
||||
|
@ -142,7 +142,7 @@ nsGridLayout2::CastToGridLayout(nsGridLayout2** aGridLayout)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGridLayout2::GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsRow)
|
||||
nsGridLayout2::GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal)
|
||||
{
|
||||
aMargin.left = 0;
|
||||
aMargin.right = 0;
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
NS_IMETHOD CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount);
|
||||
NS_IMETHOD DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState);
|
||||
NS_IMETHOD BuildRows(nsIBox* aBox, nsGridRow* aRows, PRInt32* aCount);
|
||||
NS_IMETHOD GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsRow);
|
||||
NS_IMETHOD GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal);
|
||||
NS_IMETHOD GetRowCount(PRInt32& aRowCount);
|
||||
|
||||
protected:
|
||||
|
@ -79,18 +79,18 @@ nsGridRowGroupLayout::ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState
|
||||
nsGrid* grid = nsnull;
|
||||
PRInt32 index = 0;
|
||||
GetGrid(aBox, &grid, &index);
|
||||
PRInt32 isRow = IsHorizontal(aBox);
|
||||
PRInt32 isHorizontal = IsHorizontal(aBox);
|
||||
|
||||
if (grid)
|
||||
grid->RowAddedOrRemoved(aState, index, isRow);
|
||||
grid->RowAddedOrRemoved(aState, index, isHorizontal);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsGridRowGroupLayout::AddWidth(nsSize& aSize, nscoord aSize2, PRBool aIsRow)
|
||||
nsGridRowGroupLayout::AddWidth(nsSize& aSize, nscoord aSize2, PRBool aIsHorizontal)
|
||||
{
|
||||
nscoord& size = GET_WIDTH(aSize, aIsRow);
|
||||
nscoord& size = GET_WIDTH(aSize, aIsHorizontal);
|
||||
|
||||
if (size == NS_INTRINSICSIZE || aSize2 == NS_INTRINSICSIZE)
|
||||
size = NS_INTRINSICSIZE;
|
||||
@ -118,16 +118,16 @@ nsGridRowGroupLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize
|
||||
if (grid)
|
||||
{
|
||||
// make sure we add in extra columns sizes as well
|
||||
PRInt32 isRow = IsHorizontal(aBox);
|
||||
PRInt32 extraColumns = grid->GetExtraColumnCount(isRow);
|
||||
PRInt32 start = grid->GetColumnCount(isRow) - grid->GetExtraColumnCount(isRow);
|
||||
PRInt32 isHorizontal = IsHorizontal(aBox);
|
||||
PRInt32 extraColumns = grid->GetExtraColumnCount(isHorizontal);
|
||||
PRInt32 start = grid->GetColumnCount(isHorizontal) - grid->GetExtraColumnCount(isHorizontal);
|
||||
for (PRInt32 i=0; i < extraColumns; i++)
|
||||
{
|
||||
nsGridRow* column = grid->GetColumnAt(i+start, isRow);
|
||||
nsGridRow* column = grid->GetColumnAt(i+start, isHorizontal);
|
||||
nscoord size = 0;
|
||||
grid->GetPrefRowHeight(aState, i+start, size, !isRow); // GetPrefColumnWidth
|
||||
grid->GetPrefRowHeight(aState, i+start, size, !isHorizontal); // GetPrefColumnWidth
|
||||
|
||||
AddWidth(aSize, size, isRow);
|
||||
AddWidth(aSize, size, isHorizontal);
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,16 +146,16 @@ nsGridRowGroupLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize&
|
||||
if (grid)
|
||||
{
|
||||
// make sure we add in extra columns sizes as well
|
||||
PRInt32 isRow = IsHorizontal(aBox);
|
||||
PRInt32 extraColumns = grid->GetExtraColumnCount(isRow);
|
||||
PRInt32 start = grid->GetColumnCount(isRow) - grid->GetExtraColumnCount(isRow);
|
||||
PRInt32 isHorizontal = IsHorizontal(aBox);
|
||||
PRInt32 extraColumns = grid->GetExtraColumnCount(isHorizontal);
|
||||
PRInt32 start = grid->GetColumnCount(isHorizontal) - grid->GetExtraColumnCount(isHorizontal);
|
||||
for (PRInt32 i=0; i < extraColumns; i++)
|
||||
{
|
||||
nsGridRow* column = grid->GetColumnAt(i+start, isRow);
|
||||
nsGridRow* column = grid->GetColumnAt(i+start, isHorizontal);
|
||||
nscoord size = 0;
|
||||
grid->GetMaxRowHeight(aState, i+start, size, !isRow); // GetMaxColumnWidth
|
||||
grid->GetMaxRowHeight(aState, i+start, size, !isHorizontal); // GetMaxColumnWidth
|
||||
|
||||
AddWidth(aSize, size, isRow);
|
||||
AddWidth(aSize, size, isHorizontal);
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,16 +174,16 @@ nsGridRowGroupLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize&
|
||||
if (grid)
|
||||
{
|
||||
// make sure we add in extra columns sizes as well
|
||||
PRInt32 isRow = IsHorizontal(aBox);
|
||||
PRInt32 extraColumns = grid->GetExtraColumnCount(isRow);
|
||||
PRInt32 start = grid->GetColumnCount(isRow) - grid->GetExtraColumnCount(isRow);
|
||||
PRInt32 isHorizontal = IsHorizontal(aBox);
|
||||
PRInt32 extraColumns = grid->GetExtraColumnCount(isHorizontal);
|
||||
PRInt32 start = grid->GetColumnCount(isHorizontal) - grid->GetExtraColumnCount(isHorizontal);
|
||||
for (PRInt32 i=0; i < extraColumns; i++)
|
||||
{
|
||||
nsGridRow* column = grid->GetColumnAt(i+start, isRow);
|
||||
nsGridRow* column = grid->GetColumnAt(i+start, isHorizontal);
|
||||
nscoord size = 0;
|
||||
grid->GetMinRowHeight(aState, i+start, size, !isRow); // GetMinColumnWidth
|
||||
grid->GetMinRowHeight(aState, i+start, size, !isHorizontal); // GetMinColumnWidth
|
||||
|
||||
AddWidth(aSize, size, isRow);
|
||||
AddWidth(aSize, size, isHorizontal);
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,11 +331,11 @@ nsGridRowGroupLayout::CastToRowGroupLayout(nsGridRowGroupLayout** aRowGroup)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGridRowGroupLayout::GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsRow)
|
||||
nsGridRowGroupLayout::GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal)
|
||||
{
|
||||
// group have border and padding added to the total margin
|
||||
|
||||
nsresult rv = nsGridRowLayout::GetTotalMargin(aBox, aMargin, aIsRow);
|
||||
nsresult rv = nsGridRowLayout::GetTotalMargin(aBox, aMargin, aIsHorizontal);
|
||||
|
||||
// make sure we have the scrollframe on the outside if it has one.
|
||||
// thats where the border it.
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
NS_IMETHOD CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount);
|
||||
NS_IMETHOD DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState);
|
||||
NS_IMETHOD BuildRows(nsIBox* aBox, nsGridRow* aRows, PRInt32* aCount);
|
||||
NS_IMETHOD GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsRow);
|
||||
NS_IMETHOD GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal);
|
||||
NS_IMETHOD GetRowCount(PRInt32& aRowCount);
|
||||
|
||||
protected:
|
||||
@ -68,7 +68,7 @@ protected:
|
||||
virtual ~nsGridRowGroupLayout();
|
||||
|
||||
NS_IMETHOD ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState);
|
||||
static void AddWidth(nsSize& aSize, nscoord aSize2, PRBool aIsRow);
|
||||
static void AddWidth(nsSize& aSize, nscoord aSize2, PRBool aIsHorizontal);
|
||||
|
||||
private:
|
||||
nsGridRow* mRowColumn;
|
||||
|
@ -194,7 +194,7 @@ nsGridRowLayout::CastToGridLayout(nsGridLayout2** aGridLayout)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGridRowLayout::GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsRow)
|
||||
nsGridRowLayout::GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal)
|
||||
{
|
||||
// get our parents margin
|
||||
nsMargin margin(0,0,0,0);
|
||||
@ -217,7 +217,7 @@ nsGridRowLayout::GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsRow)
|
||||
// get the parent first child to see if we are first
|
||||
parent->GetChildBox(&child);
|
||||
|
||||
part->GetTotalMargin(parent,margin,aIsRow);
|
||||
part->GetTotalMargin(parent,margin,aIsHorizontal);
|
||||
|
||||
// if first or last
|
||||
if (child == aBox || next == nsnull) {
|
||||
@ -226,7 +226,7 @@ nsGridRowLayout::GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsRow)
|
||||
// we don't need it.
|
||||
if (child != aBox)
|
||||
{
|
||||
if (aIsRow)
|
||||
if (aIsHorizontal)
|
||||
margin.top = 0;
|
||||
else
|
||||
margin.left = 0;
|
||||
@ -236,7 +236,7 @@ nsGridRowLayout::GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsRow)
|
||||
// we don't need it.
|
||||
if (next != nsnull)
|
||||
{
|
||||
if (aIsRow)
|
||||
if (aIsHorizontal)
|
||||
margin.bottom = 0;
|
||||
else
|
||||
margin.right = 0;
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
NS_IMETHOD ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList);
|
||||
NS_IMETHOD ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList);
|
||||
NS_IMETHOD ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList);
|
||||
NS_IMETHOD GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsRow);
|
||||
NS_IMETHOD GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal);
|
||||
|
||||
protected:
|
||||
NS_IMETHOD ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState)=0;
|
||||
|
@ -97,20 +97,20 @@ nsGridRowLeafFrame::GetBorderAndPadding(nsMargin& aBorderAndPadding)
|
||||
if (!grid)
|
||||
return rv;
|
||||
|
||||
PRInt32 isRow = IsHorizontal();
|
||||
PRInt32 isHorizontal = IsHorizontal();
|
||||
|
||||
nsBoxLayoutState state((nsIPresContext*)nsnull);
|
||||
|
||||
// only the first and last rows can be affected.
|
||||
nsGridRow* row = grid->GetRowAt(0, isRow);
|
||||
nsGridRow* row = grid->GetRowAt(0, isHorizontal);
|
||||
if (row && row->GetBox() == this) {
|
||||
|
||||
nscoord top = 0;
|
||||
nscoord bottom = 0;
|
||||
//grid->GetRowTopBottomPadding(index, top, PR_TRUE, isRow);
|
||||
grid->GetRowOffsets(state, 0, top, bottom, isRow);
|
||||
//grid->GetRowTopBottomPadding(index, top, PR_TRUE, isHorizontal);
|
||||
grid->GetRowOffsets(state, 0, top, bottom, isHorizontal);
|
||||
|
||||
if (isRow) {
|
||||
if (isHorizontal) {
|
||||
if (top > aBorderAndPadding.top)
|
||||
aBorderAndPadding.top = top;
|
||||
} else {
|
||||
@ -119,19 +119,19 @@ nsGridRowLeafFrame::GetBorderAndPadding(nsMargin& aBorderAndPadding)
|
||||
}
|
||||
}
|
||||
|
||||
nscoord count = grid->GetRowCount(isRow);
|
||||
nscoord count = grid->GetRowCount(isHorizontal);
|
||||
if (count == 0)
|
||||
return rv;
|
||||
|
||||
row = grid->GetRowAt(count-1, isRow);
|
||||
row = grid->GetRowAt(count-1, isHorizontal);
|
||||
if (row && row->GetBox() == this) {
|
||||
|
||||
nscoord top = 0;
|
||||
nscoord bottom = 0;
|
||||
//grid->GetRowTopBottomPadding(index, bottom, PR_FALSE, isRow);
|
||||
grid->GetRowOffsets(state, count-1, top, bottom, isRow);
|
||||
//grid->GetRowTopBottomPadding(index, bottom, PR_FALSE, isHorizontal);
|
||||
grid->GetRowOffsets(state, count-1, top, bottom, isHorizontal);
|
||||
|
||||
if (isRow) {
|
||||
if (isHorizontal) {
|
||||
if (bottom > aBorderAndPadding.bottom)
|
||||
aBorderAndPadding.bottom = bottom;
|
||||
} else {
|
||||
|
@ -82,14 +82,14 @@ nsGridRowLeafLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize&
|
||||
nsGrid* grid = nsnull;
|
||||
PRInt32 index = 0;
|
||||
GetGrid(aBox, &grid, &index);
|
||||
PRInt32 isRow = IsHorizontal(aBox);
|
||||
PRInt32 isHorizontal = IsHorizontal(aBox);
|
||||
|
||||
// If we are not in a grid. Then we just work like a box. But if we are in a grid
|
||||
// ask the grid for our size.
|
||||
if (!grid)
|
||||
return nsGridRowLayout::GetPrefSize(aBox, aState, aSize);
|
||||
else {
|
||||
nsresult rv = grid->GetPrefRowSize(aState, index, aSize, isRow);
|
||||
nsresult rv = grid->GetPrefRowSize(aState, index, aSize, isHorizontal);
|
||||
//AddBorderAndPadding(aBox, aSize);
|
||||
//AddInset(aBox, aSize);
|
||||
return rv;
|
||||
@ -102,12 +102,12 @@ nsGridRowLeafLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize&
|
||||
nsGrid* grid = nsnull;
|
||||
PRInt32 index = 0;
|
||||
GetGrid(aBox, &grid, &index);
|
||||
PRInt32 isRow = IsHorizontal(aBox);
|
||||
PRInt32 isHorizontal = IsHorizontal(aBox);
|
||||
|
||||
if (!grid)
|
||||
return nsGridRowLayout::GetMinSize(aBox, aState, aSize);
|
||||
else {
|
||||
nsresult rv = grid->GetMinRowSize(aState, index, aSize, isRow);
|
||||
nsresult rv = grid->GetMinRowSize(aState, index, aSize, isHorizontal);
|
||||
AddBorderAndPadding(aBox, aSize);
|
||||
AddInset(aBox, aSize);
|
||||
return rv;
|
||||
@ -120,12 +120,12 @@ nsGridRowLeafLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize&
|
||||
nsGrid* grid = nsnull;
|
||||
PRInt32 index = 0;
|
||||
GetGrid(aBox, &grid, &index);
|
||||
PRInt32 isRow = IsHorizontal(aBox);
|
||||
PRInt32 isHorizontal = IsHorizontal(aBox);
|
||||
|
||||
if (!grid)
|
||||
return nsGridRowLayout::GetMaxSize(aBox, aState, aSize);
|
||||
else {
|
||||
nsresult rv = grid->GetMaxRowSize(aState, index, aSize, isRow);
|
||||
nsresult rv = grid->GetMaxRowSize(aState, index, aSize, isHorizontal);
|
||||
AddBorderAndPadding(aBox, aSize);
|
||||
AddInset(aBox, aSize);
|
||||
return rv;
|
||||
@ -138,12 +138,12 @@ nsGridRowLeafLayout::ChildBecameDirty(nsIBox* aBox, nsBoxLayoutState& aState, ns
|
||||
nsGrid* grid = nsnull;
|
||||
PRInt32 index = 0;
|
||||
GetGrid(aBox, &grid, &index);
|
||||
PRInt32 isRow = IsHorizontal(aBox);
|
||||
PRInt32 isHorizontal = IsHorizontal(aBox);
|
||||
|
||||
if (grid) {
|
||||
PRInt32 columnIndex = -1;
|
||||
aBox->GetIndexOf(aChild, &columnIndex);
|
||||
grid->RowChildIsDirty(aState, index, columnIndex, isRow);
|
||||
grid->RowChildIsDirty(aState, index, columnIndex, isHorizontal);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -155,10 +155,10 @@ nsGridRowLeafLayout::BecameDirty(nsIBox* aBox, nsBoxLayoutState& aState)
|
||||
nsGrid* grid = nsnull;
|
||||
PRInt32 index = 0;
|
||||
GetGrid(aBox, &grid, &index);
|
||||
PRInt32 isRow = IsHorizontal(aBox);
|
||||
PRInt32 isHorizontal = IsHorizontal(aBox);
|
||||
|
||||
if (grid)
|
||||
grid->RowIsDirty(aState, index, isRow);
|
||||
grid->RowIsDirty(aState, index, isHorizontal);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -171,10 +171,10 @@ nsGridRowLeafLayout::ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState)
|
||||
nsGrid* grid = nsnull;
|
||||
PRInt32 index = 0;
|
||||
GetGrid(aBox, &grid, &index);
|
||||
PRInt32 isRow = IsHorizontal(aBox);
|
||||
PRInt32 isHorizontal = IsHorizontal(aBox);
|
||||
|
||||
if (grid)
|
||||
grid->CellAddedOrRemoved(aState, index, isRow);
|
||||
grid->CellAddedOrRemoved(aState, index, isHorizontal);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -185,14 +185,14 @@ nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, ns
|
||||
nsGrid* grid = nsnull;
|
||||
PRInt32 index = 0;
|
||||
GetGrid(aBox, &grid, &index);
|
||||
PRInt32 isRow = IsHorizontal(aBox);
|
||||
PRInt32 isHorizontal = IsHorizontal(aBox);
|
||||
|
||||
// Our base class SprocketLayout is giving us a chance to change the box sizes before layout
|
||||
// If we are a row lets change the sizes to match our columns. If we are a column then do the opposite
|
||||
// and make them match or rows.
|
||||
if (grid) {
|
||||
nsGridRow* column;
|
||||
PRInt32 count = grid->GetColumnCount(isRow);
|
||||
PRInt32 count = grid->GetColumnCount(isHorizontal);
|
||||
nsBoxSize* start = nsnull;
|
||||
nsBoxSize* last = nsnull;
|
||||
nsBoxSize* current = nsnull;
|
||||
@ -200,7 +200,7 @@ nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, ns
|
||||
aBox->GetChildBox(&child);
|
||||
for (int i=0; i < count; i++)
|
||||
{
|
||||
column = grid->GetColumnAt(i,isRow);
|
||||
column = grid->GetColumnAt(i,isHorizontal);
|
||||
|
||||
// make sure the value was computed before we use it.
|
||||
nscoord pref = 0;
|
||||
@ -212,12 +212,12 @@ nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, ns
|
||||
|
||||
current = new (aState) nsBoxSize();
|
||||
|
||||
// !isRow is passed in to invert the behavor of these methods.
|
||||
grid->GetPrefRowHeight(aState, i, pref, !isRow); // GetPrefColumnWidth
|
||||
grid->GetMinRowHeight(aState, i, min, !isRow); // GetMinColumnWidth
|
||||
grid->GetMaxRowHeight(aState, i, max, !isRow); // GetMaxColumnWidth
|
||||
grid->GetRowFlex(aState, i, flex, !isRow); // GetColumnFlex
|
||||
grid->GetRowOffsets(aState, i, left, right, !isRow); // GetColumnOffsets
|
||||
// !isHorizontal is passed in to invert the behavor of these methods.
|
||||
grid->GetPrefRowHeight(aState, i, pref, !isHorizontal); // GetPrefColumnWidth
|
||||
grid->GetMinRowHeight(aState, i, min, !isHorizontal); // GetMinColumnWidth
|
||||
grid->GetMaxRowHeight(aState, i, max, !isHorizontal); // GetMaxColumnWidth
|
||||
grid->GetRowFlex(aState, i, flex, !isHorizontal); // GetColumnFlex
|
||||
grid->GetRowOffsets(aState, i, left, right, !isHorizontal); // GetColumnOffsets
|
||||
|
||||
pref = pref - (left + right);
|
||||
if (pref < 0)
|
||||
@ -230,11 +230,11 @@ nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, ns
|
||||
// or equal to our left or right
|
||||
if (i == 0 || i == count-1) {
|
||||
nsMargin offset(0,0,0,0);
|
||||
GetTotalMargin(aBox, offset, isRow);
|
||||
GetTotalMargin(aBox, offset, isHorizontal);
|
||||
// subtract from out left and right
|
||||
if (i == 0)
|
||||
{
|
||||
if (isRow)
|
||||
if (isHorizontal)
|
||||
left -= offset.left;
|
||||
else
|
||||
left -= offset.top;
|
||||
@ -242,7 +242,7 @@ nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, ns
|
||||
|
||||
if (i == count-1)
|
||||
{
|
||||
if (isRow)
|
||||
if (isHorizontal)
|
||||
right -= offset.right;
|
||||
else
|
||||
right -= offset.bottom;
|
||||
@ -291,8 +291,8 @@ nsGridRowLeafLayout::ComputeChildSizes(nsIBox* aBox,
|
||||
if (aBox) {
|
||||
|
||||
// go up the parent chain looking for scrollframes
|
||||
PRBool isRow = PR_FALSE;
|
||||
aBox->GetOrientation(isRow);
|
||||
PRBool isHorizontal = PR_FALSE;
|
||||
aBox->GetOrientation(isHorizontal);
|
||||
|
||||
nsIBox* scrollbox = nsnull;
|
||||
aBox->GetParentBox(&aBox);
|
||||
@ -316,7 +316,7 @@ nsGridRowLeafLayout::ComputeChildSizes(nsIBox* aBox,
|
||||
scrollbox->GetInset(padding);
|
||||
ourRect.Deflate(padding);
|
||||
|
||||
if (isRow) {
|
||||
if (isHorizontal) {
|
||||
diff = ourRect.width - clipSize.width;
|
||||
} else {
|
||||
diff = ourRect.height - clipSize.height;
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
NS_IMETHOD CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount)=0;
|
||||
NS_IMETHOD DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState)=0;
|
||||
NS_IMETHOD BuildRows(nsIBox* aBox, nsGridRow* aRows, PRInt32* aCount)=0;
|
||||
NS_IMETHOD GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsRow)=0;
|
||||
NS_IMETHOD GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal)=0;
|
||||
NS_IMETHOD GetRowCount(PRInt32& aRowCount)=0;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user