зеркало из https://github.com/mozilla/pjs.git
Bug 363879, deCOMtaminate nsGrid dir, part 2, p=Andreas Lange, r+sr=roc
This commit is contained in:
Родитель
673a2835ad
Коммит
458ea9c2e0
|
@ -239,7 +239,7 @@ nsGrid::RebuildIfNeeded()
|
||||||
BuildRows(mColumnsBox, columnCount, &mColumns, PR_FALSE);
|
BuildRows(mColumnsBox, columnCount, &mColumns, PR_FALSE);
|
||||||
|
|
||||||
// build and populate the cell map
|
// build and populate the cell map
|
||||||
BuildCellMap(rowCount, columnCount, &mCellMap);
|
mCellMap = BuildCellMap(rowCount, columnCount);
|
||||||
|
|
||||||
mRowCount = rowCount;
|
mRowCount = rowCount;
|
||||||
mColumnCount = columnCount;
|
mColumnCount = columnCount;
|
||||||
|
@ -305,8 +305,7 @@ nsGrid::FindRowsAndColumns(nsIBox** aRows, nsIBox** aColumns)
|
||||||
nsCOMPtr<nsIGridPart> monument( do_QueryInterface(layout) );
|
nsCOMPtr<nsIGridPart> monument( do_QueryInterface(layout) );
|
||||||
if (monument)
|
if (monument)
|
||||||
{
|
{
|
||||||
nsGridRowGroupLayout* rowGroup = nsnull;
|
nsGridRowGroupLayout* rowGroup = monument->CastToRowGroupLayout();
|
||||||
monument->CastToRowGroupLayout(&rowGroup);
|
|
||||||
if (rowGroup) {
|
if (rowGroup) {
|
||||||
PRBool isHorizontal = !nsSprocketLayout::IsHorizontal(child);
|
PRBool isHorizontal = !nsSprocketLayout::IsHorizontal(child);
|
||||||
if (isHorizontal)
|
if (isHorizontal)
|
||||||
|
@ -352,7 +351,7 @@ nsGrid::CountRowsColumns(nsIBox* aRowBox, PRInt32& aRowCount, PRInt32& aComputed
|
||||||
* Given the number of rows create nsGridRow objects for them and full them out.
|
* Given the number of rows create nsGridRow objects for them and full them out.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
nsGrid::BuildRows(nsIBox* aBox, PRBool aRowCount, nsGridRow** aRows, PRBool aIsHorizontal)
|
nsGrid::BuildRows(nsIBox* aBox, PRInt32 aRowCount, nsGridRow** aRows, PRBool aIsHorizontal)
|
||||||
{
|
{
|
||||||
// if no rows then return null
|
// if no rows then return null
|
||||||
if (aRowCount == 0) {
|
if (aRowCount == 0) {
|
||||||
|
@ -400,8 +399,7 @@ nsGrid::BuildRows(nsIBox* aBox, PRBool aRowCount, nsGridRow** aRows, PRBool aIsH
|
||||||
if (layout) {
|
if (layout) {
|
||||||
nsCOMPtr<nsIGridPart> monument( do_QueryInterface(layout) );
|
nsCOMPtr<nsIGridPart> monument( do_QueryInterface(layout) );
|
||||||
if (monument) {
|
if (monument) {
|
||||||
PRInt32 count;
|
monument->BuildRows(aBox, row);
|
||||||
monument->BuildRows(aBox, row, &count);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -413,19 +411,18 @@ nsGrid::BuildRows(nsIBox* aBox, PRBool aRowCount, nsGridRow** aRows, PRBool aIsH
|
||||||
/**
|
/**
|
||||||
* Given the number of rows and columns. Build a cellmap
|
* Given the number of rows and columns. Build a cellmap
|
||||||
*/
|
*/
|
||||||
void
|
nsGridCell*
|
||||||
nsGrid::BuildCellMap(PRInt32 aRows, PRInt32 aColumns, nsGridCell** aCells)
|
nsGrid::BuildCellMap(PRInt32 aRows, PRInt32 aColumns)
|
||||||
{
|
{
|
||||||
PRInt32 size = aRows*aColumns;
|
PRInt32 size = aRows*aColumns;
|
||||||
PRInt32 oldsize = mRowCount*mColumnCount;
|
PRInt32 oldsize = mRowCount*mColumnCount;
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
delete[] mCellMap;
|
delete[] mCellMap;
|
||||||
(*aCells) = nsnull;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (size > oldsize) {
|
if (size > oldsize) {
|
||||||
delete[] mCellMap;
|
delete[] mCellMap;
|
||||||
(*aCells) = new nsGridCell[size];
|
return new nsGridCell[size];
|
||||||
} else {
|
} else {
|
||||||
// clear out cellmap
|
// clear out cellmap
|
||||||
for (PRInt32 i=0; i < oldsize; i++)
|
for (PRInt32 i=0; i < oldsize; i++)
|
||||||
|
@ -433,10 +430,10 @@ nsGrid::BuildCellMap(PRInt32 aRows, PRInt32 aColumns, nsGridCell** aCells)
|
||||||
mCellMap[i].SetBoxInRow(nsnull);
|
mCellMap[i].SetBoxInRow(nsnull);
|
||||||
mCellMap[i].SetBoxInColumn(nsnull);
|
mCellMap[i].SetBoxInColumn(nsnull);
|
||||||
}
|
}
|
||||||
|
return mCellMap;
|
||||||
(*aCells) = mCellMap;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -450,7 +447,7 @@ nsGrid::PopulateCellMap(nsGridRow* aRows, nsGridRow* aColumns, PRInt32 aRowCount
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// look through the columns
|
// look through the columns
|
||||||
nscoord j = 0;
|
PRInt32 j = 0;
|
||||||
|
|
||||||
for(PRInt32 i=0; i < aRowCount; i++)
|
for(PRInt32 i=0; i < aRowCount; i++)
|
||||||
{
|
{
|
||||||
|
@ -644,17 +641,19 @@ nsGrid::GetPartFromBox(nsIBox* aBox, nsIGridPart** aPart)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
nsMargin
|
||||||
nsGrid::GetBoxTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal)
|
nsGrid::GetBoxTotalMargin(nsIBox* aBox, PRBool aIsHorizontal)
|
||||||
{
|
{
|
||||||
|
nsMargin margin(0,0,0,0);
|
||||||
// walk the boxes parent chain getting the border/padding/margin of our parent rows
|
// walk the boxes parent chain getting the border/padding/margin of our parent rows
|
||||||
|
|
||||||
// first get the layour manager
|
// first get the layour manager
|
||||||
nsCOMPtr<nsIGridPart> part;
|
nsCOMPtr<nsIGridPart> part;
|
||||||
nsCOMPtr<nsIGridPart> parent;
|
|
||||||
GetPartFromBox(aBox, getter_AddRefs(part));
|
GetPartFromBox(aBox, getter_AddRefs(part));
|
||||||
if (part)
|
if (part)
|
||||||
part->GetTotalMargin(aBox, aMargin, aIsHorizontal);
|
margin = part->GetTotalMargin(aBox, aIsHorizontal);
|
||||||
|
|
||||||
|
return margin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -767,8 +766,6 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n
|
||||||
totalBorderPadding += inset;
|
totalBorderPadding += inset;
|
||||||
totalBorderPadding += border;
|
totalBorderPadding += border;
|
||||||
totalBorderPadding += padding;
|
totalBorderPadding += padding;
|
||||||
|
|
||||||
box->GetMargin(margin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we are the first or last row
|
// if we are the first or last row
|
||||||
|
@ -777,9 +774,7 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n
|
||||||
// fortunately they only affect the first
|
// fortunately they only affect the first
|
||||||
// and last row inside the <rows> tag
|
// and last row inside the <rows> tag
|
||||||
|
|
||||||
GetBoxTotalMargin(box, margin, aIsHorizontal);
|
totalMargin = GetBoxTotalMargin(box, aIsHorizontal);
|
||||||
|
|
||||||
totalMargin = margin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aIsHorizontal) {
|
if (aIsHorizontal) {
|
||||||
|
@ -835,7 +830,7 @@ nsGrid::GetRowOffsets(nsBoxLayoutState& aState, PRInt32 aIndex, nscoord& aTop, n
|
||||||
// include the margin of the columns. To the row
|
// include the margin of the columns. To the row
|
||||||
// at this point border/padding and margins all added
|
// at this point border/padding and margins all added
|
||||||
// up to more needed space.
|
// up to more needed space.
|
||||||
GetBoxTotalMargin(box, margin, !aIsHorizontal);
|
margin = GetBoxTotalMargin(box, !aIsHorizontal);
|
||||||
box->GetInset(inset);
|
box->GetInset(inset);
|
||||||
// get real border and padding. GetBorderAndPadding
|
// get real border and padding. GetBorderAndPadding
|
||||||
// is redefined on nsGridRowLeafFrame. If we called it here
|
// is redefined on nsGridRowLeafFrame. If we called it here
|
||||||
|
@ -1139,8 +1134,7 @@ nsGrid::IsGrid(nsIBox* aBox)
|
||||||
if (!part)
|
if (!part)
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
nsGridLayout2* grid = nsnull;
|
nsGridLayout2* grid = part->CastToGridLayout();
|
||||||
part->CastToGridLayout(&grid);
|
|
||||||
|
|
||||||
if (grid)
|
if (grid)
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
|
|
@ -108,12 +108,12 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void GetPartFromBox(nsIBox* aBox, nsIGridPart** aPart);
|
void GetPartFromBox(nsIBox* aBox, nsIGridPart** aPart);
|
||||||
void GetBoxTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal = PR_TRUE);
|
nsMargin GetBoxTotalMargin(nsIBox* aBox, PRBool aIsHorizontal = PR_TRUE);
|
||||||
|
|
||||||
void FreeMap();
|
void FreeMap();
|
||||||
void FindRowsAndColumns(nsIBox** aRows, nsIBox** aColumns);
|
void FindRowsAndColumns(nsIBox** aRows, nsIBox** aColumns);
|
||||||
void BuildRows(nsIBox* aBox, PRBool aSize, nsGridRow** aColumnsRows, PRBool aIsHorizontal = PR_TRUE);
|
void BuildRows(nsIBox* aBox, PRInt32 aSize, nsGridRow** aColumnsRows, PRBool aIsHorizontal = PR_TRUE);
|
||||||
void BuildCellMap(PRInt32 aRows, PRInt32 aColumns, nsGridCell** aCells);
|
nsGridCell* BuildCellMap(PRInt32 aRows, PRInt32 aColumns);
|
||||||
void PopulateCellMap(nsGridRow* aRows, nsGridRow* aColumns, PRInt32 aRowCount, PRInt32 aColumnCount, PRBool aIsHorizontal = 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 CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount);
|
||||||
void SetLargestSize(nsSize& aSize, nscoord aHeight, PRBool aIsHorizontal = PR_TRUE);
|
void SetLargestSize(nsSize& aSize, nscoord aHeight, PRBool aIsHorizontal = PR_TRUE);
|
||||||
|
|
|
@ -93,8 +93,8 @@ nsGridLayout2::IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutSt
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsGrid*
|
||||||
nsGridLayout2::GetGrid(nsIBox* aBox, nsGrid** aGrid, PRInt32* aIndex, nsGridRowLayout* aRequestor)
|
nsGridLayout2::GetGrid(nsIBox* aBox, PRInt32* aIndex, nsGridRowLayout* aRequestor)
|
||||||
{
|
{
|
||||||
// XXX This should be set a better way!
|
// XXX This should be set a better way!
|
||||||
mGrid.SetBox(aBox);
|
mGrid.SetBox(aBox);
|
||||||
|
@ -106,15 +106,7 @@ nsGridLayout2::GetGrid(nsIBox* aBox, nsGrid** aGrid, PRInt32* aIndex, nsGridRowL
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*aGrid = &mGrid;
|
return &mGrid;
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGridLayout2::GetParentGridPart(nsIBox* aBox, nsIBox** aParentBox, nsIGridPart** aParentGridRow)
|
|
||||||
{
|
|
||||||
NS_ERROR("Should not be called");
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -255,63 +247,11 @@ nsGridLayout2::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsMargin
|
||||||
nsGridLayout2::CountRowsColumns(nsIBox* aRowBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount)
|
nsGridLayout2::GetTotalMargin(nsIBox* aBox, PRBool aIsHorizontal)
|
||||||
{
|
{
|
||||||
NS_ERROR("Should not be called");
|
nsMargin margin(0,0,0,0);
|
||||||
return NS_ERROR_FAILURE;
|
return margin;
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGridLayout2::DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState)
|
|
||||||
{
|
|
||||||
NS_ERROR("Should not be called");
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGridLayout2::BuildRows(nsIBox* aBox, nsGridRow* aRows, PRInt32* aCount)
|
|
||||||
{
|
|
||||||
NS_ERROR("Should not be called");
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGridLayout2::CastToRowGroupLayout(nsGridRowGroupLayout** aRowGroup)
|
|
||||||
{
|
|
||||||
(*aRowGroup) = nsnull;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGridLayout2::CastToGridLayout(nsGridLayout2** aGridLayout)
|
|
||||||
{
|
|
||||||
(*aGridLayout) = this;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGridLayout2::GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal)
|
|
||||||
{
|
|
||||||
aMargin.left = 0;
|
|
||||||
aMargin.right = 0;
|
|
||||||
aMargin.top = 0;
|
|
||||||
aMargin.bottom = 0;
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGridLayout2::GetRowCount(PRInt32& aRowCount)
|
|
||||||
{
|
|
||||||
NS_ERROR("Should not be called");
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP_(nsIGridPart::Type)
|
|
||||||
nsGridLayout2::GetType()
|
|
||||||
{
|
|
||||||
return eGrid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -330,7 +270,6 @@ nsGridLayout2::ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGridLayout2::ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState,
|
nsGridLayout2::ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState,
|
||||||
nsIBox* aChildList)
|
nsIBox* aChildList)
|
||||||
|
@ -339,7 +278,6 @@ nsGridLayout2::ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGridLayout2::ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState,
|
nsGridLayout2::ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState,
|
||||||
nsIBox* aChildList)
|
nsIBox* aChildList)
|
||||||
|
|
|
@ -67,19 +67,19 @@ public:
|
||||||
NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState);
|
NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState);
|
||||||
NS_IMETHOD IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState);
|
NS_IMETHOD IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState);
|
||||||
|
|
||||||
NS_IMETHOD CastToRowGroupLayout(nsGridRowGroupLayout** aRowGroup);
|
virtual nsGridRowGroupLayout* CastToRowGroupLayout() { return nsnull; }
|
||||||
NS_IMETHOD CastToGridLayout(nsGridLayout2** aGrid);
|
virtual nsGridLayout2* CastToGridLayout() { return this; }
|
||||||
NS_IMETHOD GetGrid(nsIBox* aBox, nsGrid** aList, PRInt32* aIndex, nsGridRowLayout* aRequestor=nsnull);
|
virtual nsGrid* GetGrid(nsIBox* aBox, PRInt32* aIndex, nsGridRowLayout* aRequestor=nsnull);
|
||||||
NS_IMETHOD GetParentGridPart(nsIBox* aBox, nsIBox** aParentBox, nsIGridPart** aParentGridPart);
|
virtual void GetParentGridPart(nsIBox* aBox, nsIBox** aParentBox, nsIGridPart** aParentGridPart) { NS_NOTREACHED("Should not be called"); }
|
||||||
NS_IMETHOD GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
NS_IMETHOD GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||||
NS_IMETHOD GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
NS_IMETHOD GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||||
NS_IMETHOD GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
NS_IMETHOD GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||||
NS_IMETHOD CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount);
|
virtual void CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount) { NS_NOTREACHED("Should not be called"); }
|
||||||
NS_IMETHOD DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState);
|
virtual void DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState) { NS_NOTREACHED("Should not be called"); }
|
||||||
NS_IMETHOD BuildRows(nsIBox* aBox, nsGridRow* aRows, PRInt32* aCount);
|
virtual PRInt32 BuildRows(nsIBox* aBox, nsGridRow* aRows) { NS_NOTREACHED("Should not be called"); return 0; }
|
||||||
NS_IMETHOD GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal);
|
virtual nsMargin GetTotalMargin(nsIBox* aBox, PRBool aIsHorizontal);
|
||||||
NS_IMETHOD GetRowCount(PRInt32& aRowCount);
|
virtual PRInt32 GetRowCount() { NS_NOTREACHED("Should not be called"); return 0; }
|
||||||
NS_IMETHOD_(Type) GetType();
|
virtual Type GetType() { return eGrid; }
|
||||||
NS_IMETHOD ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState,
|
NS_IMETHOD ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState,
|
||||||
nsIBox* aPrevBox, nsIBox* aChildList);
|
nsIBox* aPrevBox, nsIBox* aChildList);
|
||||||
NS_IMETHOD ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState,
|
NS_IMETHOD ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState,
|
||||||
|
|
|
@ -72,18 +72,15 @@ nsGridRowGroupLayout::~nsGridRowGroupLayout()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
void
|
||||||
nsGridRowGroupLayout::ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState)
|
nsGridRowGroupLayout::ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
nsGrid* grid = nsnull;
|
|
||||||
PRInt32 index = 0;
|
PRInt32 index = 0;
|
||||||
GetGrid(aBox, &grid, &index);
|
nsGrid* grid = GetGrid(aBox, &index);
|
||||||
PRBool isHorizontal = IsHorizontal(aBox);
|
PRBool isHorizontal = IsHorizontal(aBox);
|
||||||
|
|
||||||
if (grid)
|
if (grid)
|
||||||
grid->RowAddedOrRemoved(aState, index, isHorizontal);
|
grid->RowAddedOrRemoved(aState, index, isHorizontal);
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -110,9 +107,8 @@ nsGridRowGroupLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize
|
||||||
* as well.
|
* as well.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nsGrid* grid = nsnull;
|
|
||||||
PRInt32 index = 0;
|
PRInt32 index = 0;
|
||||||
GetGrid(aBox, &grid, &index);
|
nsGrid* grid = GetGrid(aBox, &index);
|
||||||
|
|
||||||
if (grid)
|
if (grid)
|
||||||
{
|
{
|
||||||
|
@ -137,9 +133,8 @@ nsGridRowGroupLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize&
|
||||||
{
|
{
|
||||||
nsresult rv = nsGridRowLayout::GetMaxSize(aBox, aState, aSize);
|
nsresult rv = nsGridRowLayout::GetMaxSize(aBox, aState, aSize);
|
||||||
|
|
||||||
nsGrid* grid = nsnull;
|
|
||||||
PRInt32 index = 0;
|
PRInt32 index = 0;
|
||||||
GetGrid(aBox, &grid, &index);
|
nsGrid* grid = GetGrid(aBox, &index);
|
||||||
|
|
||||||
if (grid)
|
if (grid)
|
||||||
{
|
{
|
||||||
|
@ -164,9 +159,8 @@ nsGridRowGroupLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize&
|
||||||
{
|
{
|
||||||
nsresult rv = nsGridRowLayout::GetMinSize(aBox, aState, aSize);
|
nsresult rv = nsGridRowLayout::GetMinSize(aBox, aState, aSize);
|
||||||
|
|
||||||
nsGrid* grid = nsnull;
|
|
||||||
PRInt32 index = 0;
|
PRInt32 index = 0;
|
||||||
GetGrid(aBox, &grid, &index);
|
nsGrid* grid = GetGrid(aBox, &index);
|
||||||
|
|
||||||
if (grid)
|
if (grid)
|
||||||
{
|
{
|
||||||
|
@ -188,7 +182,7 @@ nsGridRowGroupLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize&
|
||||||
/*
|
/*
|
||||||
* Run down through our children dirtying them recursively.
|
* Run down through our children dirtying them recursively.
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP
|
void
|
||||||
nsGridRowGroupLayout::DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState)
|
nsGridRowGroupLayout::DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
if (aBox) {
|
if (aBox) {
|
||||||
|
@ -217,12 +211,10 @@ nsGridRowGroupLayout::DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState)
|
||||||
child->GetNextBox(&child);
|
child->GetNextBox(&child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
void
|
||||||
nsGridRowGroupLayout::CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount)
|
nsGridRowGroupLayout::CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount)
|
||||||
{
|
{
|
||||||
if (aBox) {
|
if (aBox) {
|
||||||
|
@ -256,28 +248,14 @@ nsGridRowGroupLayout::CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32
|
||||||
|
|
||||||
mRowCount = aRowCount - startCount;
|
mRowCount = aRowCount - startCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGridRowGroupLayout::GetRowCount(PRInt32& aRowCount)
|
|
||||||
{
|
|
||||||
aRowCount = mRowCount;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP_(nsIGridPart::Type)
|
|
||||||
nsGridRowGroupLayout::GetType()
|
|
||||||
{
|
|
||||||
return eRowGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill out the given row structure recursively
|
* Fill out the given row structure recursively
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP
|
PRInt32
|
||||||
nsGridRowGroupLayout::BuildRows(nsIBox* aBox, nsGridRow* aRows, PRInt32* aCount)
|
nsGridRowGroupLayout::BuildRows(nsIBox* aBox, nsGridRow* aRows)
|
||||||
{
|
{
|
||||||
PRInt32 rowCount = 0;
|
PRInt32 rowCount = 0;
|
||||||
|
|
||||||
|
@ -295,9 +273,7 @@ nsGridRowGroupLayout::BuildRows(nsIBox* aBox, nsGridRow* aRows, PRInt32* aCount)
|
||||||
if (layout) {
|
if (layout) {
|
||||||
nsCOMPtr<nsIGridPart> monument( do_QueryInterface(layout) );
|
nsCOMPtr<nsIGridPart> monument( do_QueryInterface(layout) );
|
||||||
if (monument) {
|
if (monument) {
|
||||||
PRInt32 count = 0;
|
rowCount += monument->BuildRows(deepChild, &aRows[rowCount]);
|
||||||
monument->BuildRows(deepChild, &aRows[rowCount], &count);
|
|
||||||
rowCount += count;
|
|
||||||
child->GetNextBox(&child);
|
child->GetNextBox(&child);
|
||||||
deepChild = child;
|
deepChild = child;
|
||||||
continue;
|
continue;
|
||||||
|
@ -313,24 +289,15 @@ nsGridRowGroupLayout::BuildRows(nsIBox* aBox, nsGridRow* aRows, PRInt32* aCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*aCount = rowCount;
|
return rowCount;
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsMargin
|
||||||
nsGridRowGroupLayout::CastToRowGroupLayout(nsGridRowGroupLayout** aRowGroup)
|
nsGridRowGroupLayout::GetTotalMargin(nsIBox* aBox, PRBool aIsHorizontal)
|
||||||
{
|
|
||||||
(*aRowGroup) = this;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGridRowGroupLayout::GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal)
|
|
||||||
{
|
{
|
||||||
// group have border and padding added to the total margin
|
// group have border and padding added to the total margin
|
||||||
|
|
||||||
nsresult rv = nsGridRowLayout::GetTotalMargin(aBox, aMargin, aIsHorizontal);
|
nsMargin margin = nsGridRowLayout::GetTotalMargin(aBox, aIsHorizontal);
|
||||||
|
|
||||||
// make sure we have the scrollframe on the outside if it has one.
|
// make sure we have the scrollframe on the outside if it has one.
|
||||||
// that's where the border is.
|
// that's where the border is.
|
||||||
|
@ -339,13 +306,12 @@ nsGridRowGroupLayout::GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIs
|
||||||
// add our border/padding to it
|
// add our border/padding to it
|
||||||
nsMargin borderPadding(0,0,0,0);
|
nsMargin borderPadding(0,0,0,0);
|
||||||
aBox->GetBorderAndPadding(borderPadding);
|
aBox->GetBorderAndPadding(borderPadding);
|
||||||
|
margin += borderPadding;
|
||||||
|
|
||||||
aMargin += borderPadding;
|
|
||||||
aBox->GetInset(borderPadding);
|
aBox->GetInset(borderPadding);
|
||||||
|
margin += borderPadding;
|
||||||
|
|
||||||
aMargin += borderPadding;
|
return margin;
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,22 +56,22 @@ public:
|
||||||
|
|
||||||
friend nsresult NS_NewGridRowGroupLayout(nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout);
|
friend nsresult NS_NewGridRowGroupLayout(nsIPresShell* aPresShell, nsIBoxLayout** aNewLayout);
|
||||||
|
|
||||||
NS_IMETHOD CastToRowGroupLayout(nsGridRowGroupLayout** aRowGroup);
|
virtual nsGridRowGroupLayout* CastToRowGroupLayout() { return this; }
|
||||||
NS_IMETHOD GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
NS_IMETHOD GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||||
NS_IMETHOD GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
NS_IMETHOD GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||||
NS_IMETHOD GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
NS_IMETHOD GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||||
NS_IMETHOD CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount);
|
virtual void CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount);
|
||||||
NS_IMETHOD DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState);
|
virtual void DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState);
|
||||||
NS_IMETHOD BuildRows(nsIBox* aBox, nsGridRow* aRows, PRInt32* aCount);
|
virtual PRInt32 BuildRows(nsIBox* aBox, nsGridRow* aRows);
|
||||||
NS_IMETHOD GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal);
|
virtual nsMargin GetTotalMargin(nsIBox* aBox, PRBool aIsHorizontal);
|
||||||
NS_IMETHOD GetRowCount(PRInt32& aRowCount);
|
virtual PRInt32 GetRowCount() { return mRowCount; }
|
||||||
NS_IMETHOD_(Type) GetType();
|
virtual Type GetType() { return eRowGroup; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsGridRowGroupLayout(nsIPresShell* aShell);
|
nsGridRowGroupLayout(nsIPresShell* aShell);
|
||||||
virtual ~nsGridRowGroupLayout();
|
virtual ~nsGridRowGroupLayout();
|
||||||
|
|
||||||
NS_IMETHOD ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState);
|
virtual void ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState);
|
||||||
static void AddWidth(nsSize& aSize, nscoord aSize2, PRBool aIsHorizontal);
|
static void AddWidth(nsSize& aSize, nscoord aSize2, PRBool aIsHorizontal);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -56,28 +56,32 @@ nsGridRowLayout::nsGridRowLayout(nsIPresShell* aPresShell):nsSprocketLayout()
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGridRowLayout::ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, nsIBox* aChildList)
|
nsGridRowLayout::ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, nsIBox* aChildList)
|
||||||
{
|
{
|
||||||
return ChildAddedOrRemoved(aBox, aState);
|
ChildAddedOrRemoved(aBox, aState);
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGridRowLayout::ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)
|
nsGridRowLayout::ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)
|
||||||
{
|
{
|
||||||
return ChildAddedOrRemoved(aBox, aState);
|
ChildAddedOrRemoved(aBox, aState);
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGridRowLayout::ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)
|
nsGridRowLayout::ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)
|
||||||
{
|
{
|
||||||
return ChildAddedOrRemoved(aBox, aState);
|
ChildAddedOrRemoved(aBox, aState);
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGridRowLayout::ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)
|
nsGridRowLayout::ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList)
|
||||||
{
|
{
|
||||||
return ChildAddedOrRemoved(aBox, aState);
|
ChildAddedOrRemoved(aBox, aState);
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
void
|
||||||
nsGridRowLayout::GetParentGridPart(nsIBox* aBox, nsIBox** aParentBox, nsIGridPart** aParentGridPart)
|
nsGridRowLayout::GetParentGridPart(nsIBox* aBox, nsIBox** aParentBox, nsIGridPart** aParentGridPart)
|
||||||
{
|
{
|
||||||
// go up and find our parent gridRow. Skip and non gridRow
|
// go up and find our parent gridRow. Skip and non gridRow
|
||||||
|
@ -90,26 +94,23 @@ nsGridRowLayout::GetParentGridPart(nsIBox* aBox, nsIBox** aParentBox, nsIGridPar
|
||||||
|
|
||||||
// get the parent
|
// get the parent
|
||||||
if (aBox)
|
if (aBox)
|
||||||
aBox->GetParentBox(&aBox);
|
aBox->GetParentBox(&aBox);
|
||||||
|
|
||||||
if (aBox)
|
if (aBox)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIBoxLayout> layout;
|
nsCOMPtr<nsIBoxLayout> layout;
|
||||||
aBox->GetLayoutManager(getter_AddRefs(layout));
|
aBox->GetLayoutManager(getter_AddRefs(layout));
|
||||||
nsCOMPtr<nsIGridPart> parentGridRow = do_QueryInterface(layout);
|
nsCOMPtr<nsIGridPart> parentGridRow = do_QueryInterface(layout);
|
||||||
if (parentGridRow && parentGridRow->CanContain(this)) {
|
if (parentGridRow && parentGridRow->CanContain(this)) {
|
||||||
parentGridRow.swap(*aParentGridPart);
|
parentGridRow.swap(*aParentGridPart);
|
||||||
*aParentBox = aBox;
|
*aParentBox = aBox;
|
||||||
return NS_OK;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsGrid*
|
||||||
nsGridRowLayout::GetGrid(nsIBox* aBox, nsGrid** aList, PRInt32* aIndex, nsGridRowLayout* aRequestor)
|
nsGridRowLayout::GetGrid(nsIBox* aBox, PRInt32* aIndex, nsGridRowLayout* aRequestor)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (aRequestor == nsnull)
|
if (aRequestor == nsnull)
|
||||||
|
@ -118,9 +119,8 @@ nsGridRowLayout::GetGrid(nsIBox* aBox, nsGrid** aList, PRInt32* aIndex, nsGridRo
|
||||||
nsIBox* parentBox; // nsIBox is implemented by nsIFrame and is not refcounted.
|
nsIBox* parentBox; // nsIBox is implemented by nsIFrame and is not refcounted.
|
||||||
GetParentGridPart(aBox, &parentBox, getter_AddRefs(parent));
|
GetParentGridPart(aBox, &parentBox, getter_AddRefs(parent));
|
||||||
if (parent)
|
if (parent)
|
||||||
return parent->GetGrid(parentBox, aList, aIndex, this);
|
return parent->GetGrid(parentBox, aIndex, this);
|
||||||
else
|
return nsnull;
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
@ -145,10 +145,7 @@ nsGridRowLayout::GetGrid(nsIBox* aBox, nsGrid** aList, PRInt32* aIndex, nsGridRo
|
||||||
index = count;
|
index = count;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
count += gridRow->GetRowCount();
|
||||||
PRInt32 c = 0;
|
|
||||||
gridRow->GetRowCount(c);
|
|
||||||
count += c;
|
|
||||||
} else
|
} else
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
|
@ -159,9 +156,8 @@ nsGridRowLayout::GetGrid(nsIBox* aBox, nsGrid** aList, PRInt32* aIndex, nsGridRo
|
||||||
// this could happen during initial construction so lets just
|
// this could happen during initial construction so lets just
|
||||||
// fail.
|
// fail.
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
*aList = nsnull;
|
|
||||||
*aIndex = -1;
|
*aIndex = -1;
|
||||||
return NS_OK;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*aIndex) += index;
|
(*aIndex) += index;
|
||||||
|
@ -171,27 +167,13 @@ nsGridRowLayout::GetGrid(nsIBox* aBox, nsGrid** aList, PRInt32* aIndex, nsGridRo
|
||||||
GetParentGridPart(aBox, &parentBox, getter_AddRefs(parent));
|
GetParentGridPart(aBox, &parentBox, getter_AddRefs(parent));
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
parent->GetGrid(parentBox, aList, aIndex, this);
|
return parent->GetGrid(parentBox, aIndex, this);
|
||||||
|
|
||||||
return NS_OK;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsMargin
|
||||||
nsGridRowLayout::CastToRowGroupLayout(nsGridRowGroupLayout** aRowGroup)
|
nsGridRowLayout::GetTotalMargin(nsIBox* aBox, PRBool aIsHorizontal)
|
||||||
{
|
|
||||||
(*aRowGroup) = nsnull;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGridRowLayout::CastToGridLayout(nsGridLayout2** aGridLayout)
|
|
||||||
{
|
|
||||||
(*aGridLayout) = nsnull;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGridRowLayout::GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal)
|
|
||||||
{
|
{
|
||||||
// get our parents margin
|
// get our parents margin
|
||||||
nsMargin margin(0,0,0,0);
|
nsMargin margin(0,0,0,0);
|
||||||
|
@ -214,7 +196,7 @@ nsGridRowLayout::GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHoriz
|
||||||
// get the parent first child to see if we are first
|
// get the parent first child to see if we are first
|
||||||
parent->GetChildBox(&child);
|
parent->GetChildBox(&child);
|
||||||
|
|
||||||
part->GetTotalMargin(parent,margin,aIsHorizontal);
|
margin = part->GetTotalMargin(parent, aIsHorizontal);
|
||||||
|
|
||||||
// if first or last
|
// if first or last
|
||||||
if (child == aBox || next == nsnull) {
|
if (child == aBox || next == nsnull) {
|
||||||
|
@ -242,13 +224,12 @@ nsGridRowLayout::GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHoriz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aMargin = margin;
|
|
||||||
|
|
||||||
// add ours to it.
|
// add ours to it.
|
||||||
aBox->GetMargin(margin);
|
nsMargin ourMargin;
|
||||||
aMargin += margin;
|
aBox->GetMargin(ourMargin);
|
||||||
|
margin += ourMargin;
|
||||||
|
|
||||||
return NS_OK;
|
return margin;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(nsGridRowLayout, nsBoxLayout)
|
NS_IMPL_ADDREF_INHERITED(nsGridRowLayout, nsBoxLayout)
|
||||||
|
|
|
@ -66,18 +66,18 @@ class nsGridRowLayout : public nsSprocketLayout,
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
NS_IMETHOD CastToRowGroupLayout(nsGridRowGroupLayout** aRowGroup);
|
virtual nsGridRowGroupLayout* CastToRowGroupLayout() { return nsnull; }
|
||||||
NS_IMETHOD CastToGridLayout(nsGridLayout2** aGrid);
|
virtual nsGridLayout2* CastToGridLayout() { return nsnull; }
|
||||||
NS_IMETHOD GetGrid(nsIBox* aBox, nsGrid** aList, PRInt32* aIndex, nsGridRowLayout* aRequestor=nsnull);
|
virtual nsGrid* GetGrid(nsIBox* aBox, PRInt32* aIndex, nsGridRowLayout* aRequestor=nsnull);
|
||||||
NS_IMETHOD GetParentGridPart(nsIBox* aBox, nsIBox** aParentBox, nsIGridPart** aParentGridRow);
|
virtual void GetParentGridPart(nsIBox* aBox, nsIBox** aParentBox, nsIGridPart** aParentGridRow);
|
||||||
NS_IMETHOD ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, nsIBox* aChildList);
|
NS_IMETHOD ChildrenInserted(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aPrevBox, nsIBox* aChildList);
|
||||||
NS_IMETHOD ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList);
|
NS_IMETHOD ChildrenAppended(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList);
|
||||||
NS_IMETHOD ChildrenRemoved(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 ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList);
|
||||||
NS_IMETHOD GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal);
|
virtual nsMargin GetTotalMargin(nsIBox* aBox, PRBool aIsHorizontal);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NS_IMETHOD ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState)=0;
|
virtual void ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState)=0;
|
||||||
|
|
||||||
nsGridRowLayout(nsIPresShell* aShell);
|
nsGridRowLayout(nsIPresShell* aShell);
|
||||||
};
|
};
|
||||||
|
|
|
@ -76,9 +76,8 @@ nsGridRowLeafFrame::GetBorderAndPadding(nsMargin& aBorderAndPadding)
|
||||||
if (!part)
|
if (!part)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
nsGrid* grid = nsnull;
|
|
||||||
PRInt32 index = 0;
|
PRInt32 index = 0;
|
||||||
part->GetGrid(this, &grid, &index);
|
nsGrid* grid = part->GetGrid(this, &index);
|
||||||
|
|
||||||
if (!grid)
|
if (!grid)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -72,9 +72,8 @@ nsGridRowLeafLayout::~nsGridRowLeafLayout()
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGridRowLeafLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize)
|
nsGridRowLeafLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize)
|
||||||
{
|
{
|
||||||
nsGrid* grid = nsnull;
|
|
||||||
PRInt32 index = 0;
|
PRInt32 index = 0;
|
||||||
GetGrid(aBox, &grid, &index);
|
nsGrid* grid = GetGrid(aBox, &index);
|
||||||
PRBool isHorizontal = IsHorizontal(aBox);
|
PRBool isHorizontal = IsHorizontal(aBox);
|
||||||
|
|
||||||
// If we are not in a grid. Then we just work like a box. But if we are in a grid
|
// If we are not in a grid. Then we just work like a box. But if we are in a grid
|
||||||
|
@ -92,9 +91,8 @@ nsGridRowLeafLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize&
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGridRowLeafLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize)
|
nsGridRowLeafLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize)
|
||||||
{
|
{
|
||||||
nsGrid* grid = nsnull;
|
|
||||||
PRInt32 index = 0;
|
PRInt32 index = 0;
|
||||||
GetGrid(aBox, &grid, &index);
|
nsGrid* grid = GetGrid(aBox, &index);
|
||||||
PRBool isHorizontal = IsHorizontal(aBox);
|
PRBool isHorizontal = IsHorizontal(aBox);
|
||||||
|
|
||||||
if (!grid)
|
if (!grid)
|
||||||
|
@ -110,9 +108,8 @@ nsGridRowLeafLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize&
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGridRowLeafLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize)
|
nsGridRowLeafLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize)
|
||||||
{
|
{
|
||||||
nsGrid* grid = nsnull;
|
|
||||||
PRInt32 index = 0;
|
PRInt32 index = 0;
|
||||||
GetGrid(aBox, &grid, &index);
|
nsGrid* grid = GetGrid(aBox, &index);
|
||||||
PRBool isHorizontal = IsHorizontal(aBox);
|
PRBool isHorizontal = IsHorizontal(aBox);
|
||||||
|
|
||||||
if (!grid)
|
if (!grid)
|
||||||
|
@ -127,26 +124,22 @@ nsGridRowLeafLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize&
|
||||||
|
|
||||||
/** If a child is added or removed or changes size
|
/** If a child is added or removed or changes size
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP
|
void
|
||||||
nsGridRowLeafLayout::ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState)
|
nsGridRowLeafLayout::ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
nsGrid* grid = nsnull;
|
|
||||||
PRInt32 index = 0;
|
PRInt32 index = 0;
|
||||||
GetGrid(aBox, &grid, &index);
|
nsGrid* grid = GetGrid(aBox, &index);
|
||||||
PRBool isHorizontal = IsHorizontal(aBox);
|
PRBool isHorizontal = IsHorizontal(aBox);
|
||||||
|
|
||||||
if (grid)
|
if (grid)
|
||||||
grid->CellAddedOrRemoved(aState, index, isHorizontal);
|
grid->CellAddedOrRemoved(aState, index, isHorizontal);
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBoxSize*& aBoxSizes, nsComputedBoxSize*& aComputedBoxSizes, nscoord& aMinSize, nscoord& aMaxSize, PRInt32& aFlexes)
|
nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBoxSize*& aBoxSizes, nsComputedBoxSize*& aComputedBoxSizes, nscoord& aMinSize, nscoord& aMaxSize, PRInt32& aFlexes)
|
||||||
{
|
{
|
||||||
nsGrid* grid = nsnull;
|
|
||||||
PRInt32 index = 0;
|
PRInt32 index = 0;
|
||||||
GetGrid(aBox, &grid, &index);
|
nsGrid* grid = GetGrid(aBox, &index);
|
||||||
PRBool isHorizontal = IsHorizontal(aBox);
|
PRBool isHorizontal = IsHorizontal(aBox);
|
||||||
|
|
||||||
// Our base class SprocketLayout is giving us a chance to change the box sizes before layout
|
// Our base class SprocketLayout is giving us a chance to change the box sizes before layout
|
||||||
|
@ -201,8 +194,7 @@ nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, ns
|
||||||
grid->GetFirstAndLastRow(aState, firstIndex, lastIndex, firstRow, lastRow, !isHorizontal);
|
grid->GetFirstAndLastRow(aState, firstIndex, lastIndex, firstRow, lastRow, !isHorizontal);
|
||||||
|
|
||||||
if (i == firstIndex || i == lastIndex) {
|
if (i == firstIndex || i == lastIndex) {
|
||||||
nsMargin offset(0,0,0,0);
|
nsMargin offset = GetTotalMargin(aBox, isHorizontal);
|
||||||
GetTotalMargin(aBox, offset, isHorizontal);
|
|
||||||
|
|
||||||
nsMargin border(0,0,0,0);
|
nsMargin border(0,0,0,0);
|
||||||
// can't call GetBorderPadding we will get into recursion
|
// can't call GetBorderPadding we will get into recursion
|
||||||
|
@ -328,7 +320,7 @@ nsGridRowLeafLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState)
|
||||||
return nsGridRowLayout::Layout(aBox, aBoxLayoutState);
|
return nsGridRowLayout::Layout(aBox, aBoxLayoutState);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
void
|
||||||
nsGridRowLeafLayout::DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState)
|
nsGridRowLeafLayout::DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState)
|
||||||
{
|
{
|
||||||
if (aBox) {
|
if (aBox) {
|
||||||
|
@ -338,11 +330,9 @@ nsGridRowLeafLayout::DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState)
|
||||||
// calling MarkIntrinsicWidthsDirty for every row.
|
// calling MarkIntrinsicWidthsDirty for every row.
|
||||||
aState.PresShell()->FrameNeedsReflow(aBox, nsIPresShell::eTreeChange);
|
aState.PresShell()->FrameNeedsReflow(aBox, nsIPresShell::eTreeChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
void
|
||||||
nsGridRowLeafLayout::CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount)
|
nsGridRowLeafLayout::CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount)
|
||||||
{
|
{
|
||||||
if (aBox) {
|
if (aBox) {
|
||||||
|
@ -362,33 +352,16 @@ nsGridRowLeafLayout::CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32&
|
||||||
|
|
||||||
aRowCount++;
|
aRowCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRInt32
|
||||||
nsGridRowLeafLayout::BuildRows(nsIBox* aBox, nsGridRow* aRows, PRInt32* aCount)
|
nsGridRowLeafLayout::BuildRows(nsIBox* aBox, nsGridRow* aRows)
|
||||||
{
|
{
|
||||||
if (aBox) {
|
if (aBox) {
|
||||||
aRows[0].Init(aBox, PR_FALSE);
|
aRows[0].Init(aBox, PR_FALSE);
|
||||||
*aCount = 1;
|
return 1;
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*aCount = 0;
|
return 0;
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGridRowLeafLayout::GetRowCount(PRInt32& aRowCount)
|
|
||||||
{
|
|
||||||
aRowCount = 1;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP_(nsIGridPart::Type)
|
|
||||||
nsGridRowLeafLayout::GetType()
|
|
||||||
{
|
|
||||||
return eRowLeaf;
|
|
||||||
}
|
|
||||||
|
|
|
@ -62,13 +62,13 @@ public:
|
||||||
NS_IMETHOD GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
NS_IMETHOD GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||||
NS_IMETHOD GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
NS_IMETHOD GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||||
NS_IMETHOD GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
NS_IMETHOD GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||||
NS_IMETHOD ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState);
|
virtual void ChildAddedOrRemoved(nsIBox* aBox, nsBoxLayoutState& aState);
|
||||||
NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState);
|
NS_IMETHOD Layout(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState);
|
||||||
NS_IMETHOD CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount);
|
virtual void CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount);
|
||||||
NS_IMETHOD DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState);
|
virtual void DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState);
|
||||||
NS_IMETHOD BuildRows(nsIBox* aBox, nsGridRow* aRows, PRInt32* aCount);
|
virtual PRInt32 BuildRows(nsIBox* aBox, nsGridRow* aRows);
|
||||||
NS_IMETHOD GetRowCount(PRInt32& aRowCount);
|
virtual PRInt32 GetRowCount() { return 1; }
|
||||||
NS_IMETHOD_(Type) GetType();
|
virtual Type GetType() { return eRowLeaf; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -47,10 +47,10 @@ class nsGridRowLayout;
|
||||||
class nsGridRow;
|
class nsGridRow;
|
||||||
class nsGridLayout2;
|
class nsGridLayout2;
|
||||||
|
|
||||||
// adaee669-f8db-42d7-8817-a2299a341404
|
// 07373ed7-e947-4a5e-b36c-69f7c195677b
|
||||||
#define NS_IGRIDPART_IID \
|
#define NS_IGRIDPART_IID \
|
||||||
{ 0xadaee669, 0xf8db, 0x42d7, \
|
{ 0x07373ed7, 0xe947, 0x4a5e, \
|
||||||
{ 0x88, 0x17, 0xa2, 0x29, 0x9a, 0x34, 0x14, 0x04 } }
|
{ 0xb3, 0x6c, 0x69, 0xf7, 0xc1, 0x95, 0x67, 0x7b } }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An additional interface implemented by nsIBoxLayout implementations
|
* An additional interface implemented by nsIBoxLayout implementations
|
||||||
|
@ -62,14 +62,12 @@ public:
|
||||||
|
|
||||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IGRIDPART_IID)
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IGRIDPART_IID)
|
||||||
|
|
||||||
NS_IMETHOD CastToRowGroupLayout(nsGridRowGroupLayout** aRowGroup)=0;
|
virtual nsGridRowGroupLayout* CastToRowGroupLayout()=0;
|
||||||
NS_IMETHOD CastToGridLayout(nsGridLayout2** aGrid)=0;
|
virtual nsGridLayout2* CastToGridLayout()=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param aBox [IN] The other half of the |this| parameter, i.e., the box
|
* @param aBox [IN] The other half of the |this| parameter, i.e., the box
|
||||||
* whose layout manager is |this|.
|
* whose layout manager is |this|.
|
||||||
* @param aList [OUT] The grid of which aBox (a row, row group, or grid)
|
|
||||||
* is a part.
|
|
||||||
* @param aIndex [INOUT] For callers not setting aRequestor, the value
|
* @param aIndex [INOUT] For callers not setting aRequestor, the value
|
||||||
* pointed to by aIndex is incremented by the index
|
* pointed to by aIndex is incremented by the index
|
||||||
* of the row (aBox) within its row group; if aBox
|
* of the row (aBox) within its row group; if aBox
|
||||||
|
@ -82,8 +80,9 @@ public:
|
||||||
* in which case it is a pointer to that grid part.
|
* in which case it is a pointer to that grid part.
|
||||||
* (This may only be non-null for row groups and
|
* (This may only be non-null for row groups and
|
||||||
* grids.)
|
* grids.)
|
||||||
|
* @return The grid of which aBox (a row, row group, or grid) is a part.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetGrid(nsIBox* aBox, nsGrid** aList, PRInt32* aIndex, nsGridRowLayout* aRequestor=nsnull)=0;
|
virtual nsGrid* GetGrid(nsIBox* aBox, PRInt32* aIndex, nsGridRowLayout* aRequestor=nsnull)=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param aBox [IN] The other half of the |this| parameter, i.e., the box
|
* @param aBox [IN] The other half of the |this| parameter, i.e., the box
|
||||||
|
@ -93,19 +92,25 @@ public:
|
||||||
* row group).
|
* row group).
|
||||||
* @param aParentGridRow [OUT] The layout manager for aParentBox.
|
* @param aParentGridRow [OUT] The layout manager for aParentBox.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetParentGridPart(nsIBox* aBox, nsIBox** aParentBox, nsIGridPart** aParentGridRow)=0;
|
virtual void GetParentGridPart(nsIBox* aBox, nsIBox** aParentBox, nsIGridPart** aParentGridRow)=0;
|
||||||
|
|
||||||
NS_IMETHOD CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount)=0;
|
/**
|
||||||
NS_IMETHOD DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState)=0;
|
* @param aBox [IN] The other half of the |this| parameter, i.e., the box
|
||||||
NS_IMETHOD BuildRows(nsIBox* aBox, nsGridRow* aRows, PRInt32* aCount)=0;
|
* whose layout manager is |this|.
|
||||||
NS_IMETHOD GetTotalMargin(nsIBox* aBox, nsMargin& aMargin, PRBool aIsHorizontal)=0;
|
* @param aRowCount [INOUT] Row count
|
||||||
NS_IMETHOD GetRowCount(PRInt32& aRowCount)=0;
|
* @param aComputedColumnCount [INOUT] Column count
|
||||||
|
*/
|
||||||
|
virtual void CountRowsColumns(nsIBox* aBox, PRInt32& aRowCount, PRInt32& aComputedColumnCount)=0;
|
||||||
|
virtual void DirtyRows(nsIBox* aBox, nsBoxLayoutState& aState)=0;
|
||||||
|
virtual PRInt32 BuildRows(nsIBox* aBox, nsGridRow* aRows)=0;
|
||||||
|
virtual nsMargin GetTotalMargin(nsIBox* aBox, PRBool aIsHorizontal)=0;
|
||||||
|
virtual PRInt32 GetRowCount()=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the level of the grid hierarchy this grid part represents.
|
* Return the level of the grid hierarchy this grid part represents.
|
||||||
*/
|
*/
|
||||||
enum Type { eGrid, eRowGroup, eRowLeaf };
|
enum Type { eGrid, eRowGroup, eRowLeaf };
|
||||||
NS_IMETHOD_(Type) GetType()=0;
|
virtual Type GetType()=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether this grid part is an appropriate parent for the argument.
|
* Return whether this grid part is an appropriate parent for the argument.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче