mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 20:47:44 +00:00
0d2a433c21
--HG-- rename : layout/xul/base/src/grid/Makefile.in => layout/xul/grid/Makefile.in rename : layout/xul/base/src/grid/crashtests/306911-crash.xul => layout/xul/grid/crashtests/306911-crash.xul rename : layout/xul/base/src/grid/crashtests/306911-grid-testcases.xul => layout/xul/grid/crashtests/306911-grid-testcases.xul rename : layout/xul/base/src/grid/crashtests/306911-grid-testcases2.xul => layout/xul/grid/crashtests/306911-grid-testcases2.xul rename : layout/xul/base/src/grid/crashtests/311710-1.xul => layout/xul/grid/crashtests/311710-1.xul rename : layout/xul/base/src/grid/crashtests/312784-1.xul => layout/xul/grid/crashtests/312784-1.xul rename : layout/xul/base/src/grid/crashtests/313173-1-inner.xul => layout/xul/grid/crashtests/313173-1-inner.xul rename : layout/xul/base/src/grid/crashtests/313173-1.html => layout/xul/grid/crashtests/313173-1.html rename : layout/xul/base/src/grid/crashtests/321066-1.xul => layout/xul/grid/crashtests/321066-1.xul rename : layout/xul/base/src/grid/crashtests/321073-1.xul => layout/xul/grid/crashtests/321073-1.xul rename : layout/xul/base/src/grid/crashtests/382750-1.xul => layout/xul/grid/crashtests/382750-1.xul rename : layout/xul/base/src/grid/crashtests/400790-1.xul => layout/xul/grid/crashtests/400790-1.xul rename : layout/xul/base/src/grid/crashtests/423802-crash.xul => layout/xul/grid/crashtests/423802-crash.xul rename : layout/xul/base/src/grid/crashtests/crashtests.list => layout/xul/grid/crashtests/crashtests.list rename : layout/xul/base/src/grid/examples/borderedcolumns.xul => layout/xul/grid/examples/borderedcolumns.xul rename : layout/xul/base/src/grid/examples/borderedrowscolumns.xul => layout/xul/grid/examples/borderedrowscolumns.xul rename : layout/xul/base/src/grid/examples/borderedrowscolumns2.xul => layout/xul/grid/examples/borderedrowscolumns2.xul rename : layout/xul/base/src/grid/examples/borderedrowscolumns3.xul => layout/xul/grid/examples/borderedrowscolumns3.xul rename : layout/xul/base/src/grid/examples/bordermargincolumns1.xul => layout/xul/grid/examples/bordermargincolumns1.xul rename : layout/xul/base/src/grid/examples/collapsetest.xul => layout/xul/grid/examples/collapsetest.xul rename : layout/xul/base/src/grid/examples/divcolumngrid.xul => layout/xul/grid/examples/divcolumngrid.xul rename : layout/xul/base/src/grid/examples/divrowgrid.xul => layout/xul/grid/examples/divrowgrid.xul rename : layout/xul/base/src/grid/examples/dynamicgrid.xul => layout/xul/grid/examples/dynamicgrid.xul rename : layout/xul/base/src/grid/examples/flexgroupgrid.xul => layout/xul/grid/examples/flexgroupgrid.xul rename : layout/xul/base/src/grid/examples/javascriptappend.xul => layout/xul/grid/examples/javascriptappend.xul rename : layout/xul/base/src/grid/examples/jumpygrid.xul => layout/xul/grid/examples/jumpygrid.xul rename : layout/xul/base/src/grid/examples/nestedrows.xul => layout/xul/grid/examples/nestedrows.xul rename : layout/xul/base/src/grid/examples/rowspan.xul => layout/xul/grid/examples/rowspan.xul rename : layout/xul/base/src/grid/examples/scrollingcolumns.xul => layout/xul/grid/examples/scrollingcolumns.xul rename : layout/xul/base/src/grid/examples/scrollingrows.xul => layout/xul/grid/examples/scrollingrows.xul rename : layout/xul/base/src/grid/examples/splitter.xul => layout/xul/grid/examples/splitter.xul rename : layout/xul/base/src/grid/nsGrid.cpp => layout/xul/grid/nsGrid.cpp rename : layout/xul/base/src/grid/nsGrid.h => layout/xul/grid/nsGrid.h rename : layout/xul/base/src/grid/nsGridCell.cpp => layout/xul/grid/nsGridCell.cpp rename : layout/xul/base/src/grid/nsGridCell.h => layout/xul/grid/nsGridCell.h rename : layout/xul/base/src/grid/nsGridLayout2.cpp => layout/xul/grid/nsGridLayout2.cpp rename : layout/xul/base/src/grid/nsGridLayout2.h => layout/xul/grid/nsGridLayout2.h rename : layout/xul/base/src/grid/nsGridRow.cpp => layout/xul/grid/nsGridRow.cpp rename : layout/xul/base/src/grid/nsGridRow.h => layout/xul/grid/nsGridRow.h rename : layout/xul/base/src/grid/nsGridRowGroupFrame.cpp => layout/xul/grid/nsGridRowGroupFrame.cpp rename : layout/xul/base/src/grid/nsGridRowGroupFrame.h => layout/xul/grid/nsGridRowGroupFrame.h rename : layout/xul/base/src/grid/nsGridRowGroupLayout.cpp => layout/xul/grid/nsGridRowGroupLayout.cpp rename : layout/xul/base/src/grid/nsGridRowGroupLayout.h => layout/xul/grid/nsGridRowGroupLayout.h rename : layout/xul/base/src/grid/nsGridRowLayout.cpp => layout/xul/grid/nsGridRowLayout.cpp rename : layout/xul/base/src/grid/nsGridRowLayout.h => layout/xul/grid/nsGridRowLayout.h rename : layout/xul/base/src/grid/nsGridRowLeafFrame.cpp => layout/xul/grid/nsGridRowLeafFrame.cpp rename : layout/xul/base/src/grid/nsGridRowLeafFrame.h => layout/xul/grid/nsGridRowLeafFrame.h rename : layout/xul/base/src/grid/nsGridRowLeafLayout.cpp => layout/xul/grid/nsGridRowLeafLayout.cpp rename : layout/xul/base/src/grid/nsGridRowLeafLayout.h => layout/xul/grid/nsGridRowLeafLayout.h rename : layout/xul/base/src/grid/nsIGridPart.h => layout/xul/grid/nsIGridPart.h rename : layout/xul/base/src/grid/reftests/column-sizing-1-ref.xul => layout/xul/grid/reftests/column-sizing-1-ref.xul rename : layout/xul/base/src/grid/reftests/column-sizing-1.xul => layout/xul/grid/reftests/column-sizing-1.xul rename : layout/xul/base/src/grid/reftests/not-full-basic-ref.xhtml => layout/xul/grid/reftests/not-full-basic-ref.xhtml rename : layout/xul/base/src/grid/reftests/not-full-basic.xul => layout/xul/grid/reftests/not-full-basic.xul rename : layout/xul/base/src/grid/reftests/not-full-grid-pack-align.xul => layout/xul/grid/reftests/not-full-grid-pack-align.xul rename : layout/xul/base/src/grid/reftests/not-full-row-group-align-ref.xhtml => layout/xul/grid/reftests/not-full-row-group-align-ref.xhtml rename : layout/xul/base/src/grid/reftests/not-full-row-group-align.xul => layout/xul/grid/reftests/not-full-row-group-align.xul rename : layout/xul/base/src/grid/reftests/not-full-row-group-direction-ref.xhtml => layout/xul/grid/reftests/not-full-row-group-direction-ref.xhtml rename : layout/xul/base/src/grid/reftests/not-full-row-group-direction.xul => layout/xul/grid/reftests/not-full-row-group-direction.xul rename : layout/xul/base/src/grid/reftests/not-full-row-group-pack-ref.xhtml => layout/xul/grid/reftests/not-full-row-group-pack-ref.xhtml rename : layout/xul/base/src/grid/reftests/not-full-row-group-pack.xul => layout/xul/grid/reftests/not-full-row-group-pack.xul rename : layout/xul/base/src/grid/reftests/not-full-row-leaf-align.xul => layout/xul/grid/reftests/not-full-row-leaf-align.xul rename : layout/xul/base/src/grid/reftests/not-full-row-leaf-direction.xul => layout/xul/grid/reftests/not-full-row-leaf-direction.xul rename : layout/xul/base/src/grid/reftests/not-full-row-leaf-pack-ref.xhtml => layout/xul/grid/reftests/not-full-row-leaf-pack-ref.xhtml rename : layout/xul/base/src/grid/reftests/not-full-row-leaf-pack.xul => layout/xul/grid/reftests/not-full-row-leaf-pack.xul rename : layout/xul/base/src/grid/reftests/reftest.list => layout/xul/grid/reftests/reftest.list rename : layout/xul/base/src/grid/reftests/row-or-column-sizing-1.xul => layout/xul/grid/reftests/row-or-column-sizing-1.xul rename : layout/xul/base/src/grid/reftests/row-or-column-sizing-2.xul => layout/xul/grid/reftests/row-or-column-sizing-2.xul rename : layout/xul/base/src/grid/reftests/row-or-column-sizing-3.xul => layout/xul/grid/reftests/row-or-column-sizing-3.xul rename : layout/xul/base/src/grid/reftests/row-or-column-sizing-4.xul => layout/xul/grid/reftests/row-or-column-sizing-4.xul rename : layout/xul/base/src/grid/reftests/row-sizing-1-ref.xul => layout/xul/grid/reftests/row-sizing-1-ref.xul rename : layout/xul/base/src/grid/reftests/row-sizing-1.xul => layout/xul/grid/reftests/row-sizing-1.xul rename : layout/xul/base/src/grid/reftests/scrollable-columns-ref.xhtml => layout/xul/grid/reftests/scrollable-columns-ref.xhtml rename : layout/xul/base/src/grid/reftests/scrollable-columns.xul => layout/xul/grid/reftests/scrollable-columns.xul rename : layout/xul/base/src/grid/reftests/scrollable-rows-ref.xhtml => layout/xul/grid/reftests/scrollable-rows-ref.xhtml rename : layout/xul/base/src/grid/reftests/scrollable-rows.xul => layout/xul/grid/reftests/scrollable-rows.xul rename : layout/xul/base/src/grid/reftests/sizing-2d-ref.xul => layout/xul/grid/reftests/sizing-2d-ref.xul rename : layout/xul/base/src/grid/reftests/sizing-2d.xul => layout/xul/grid/reftests/sizing-2d.xul rename : layout/xul/base/src/grid/reftests/z-order-1-ref.xul => layout/xul/grid/reftests/z-order-1-ref.xul rename : layout/xul/base/src/grid/reftests/z-order-1.xul => layout/xul/grid/reftests/z-order-1.xul rename : layout/xul/base/src/grid/reftests/z-order-2-ref.xul => layout/xul/grid/reftests/z-order-2-ref.xul rename : layout/xul/base/src/grid/reftests/z-order-2.xul => layout/xul/grid/reftests/z-order-2.xul rename : layout/xul/base/src/tree/src/Makefile.in => layout/xul/tree/Makefile.in rename : layout/xul/base/src/tree/src/crashtests/307298-1.xul => layout/xul/tree/crashtests/307298-1.xul rename : layout/xul/base/src/tree/src/crashtests/309732-1.xul => layout/xul/tree/crashtests/309732-1.xul rename : layout/xul/base/src/tree/src/crashtests/309732-2.xul => layout/xul/tree/crashtests/309732-2.xul rename : layout/xul/base/src/tree/src/crashtests/366583-1.xul => layout/xul/tree/crashtests/366583-1.xul rename : layout/xul/base/src/tree/src/crashtests/380217-1.xul => layout/xul/tree/crashtests/380217-1.xul rename : layout/xul/base/src/tree/src/crashtests/382444-1-inner.html => layout/xul/tree/crashtests/382444-1-inner.html rename : layout/xul/base/src/tree/src/crashtests/382444-1.html => layout/xul/tree/crashtests/382444-1.html rename : layout/xul/base/src/tree/src/crashtests/391178-1.xhtml => layout/xul/tree/crashtests/391178-1.xhtml rename : layout/xul/base/src/tree/src/crashtests/391178-2.xul => layout/xul/tree/crashtests/391178-2.xul rename : layout/xul/base/src/tree/src/crashtests/393665-1.xul => layout/xul/tree/crashtests/393665-1.xul rename : layout/xul/base/src/tree/src/crashtests/399227-1.xul => layout/xul/tree/crashtests/399227-1.xul rename : layout/xul/base/src/tree/src/crashtests/399227-2.xul => layout/xul/tree/crashtests/399227-2.xul rename : layout/xul/base/src/tree/src/crashtests/399692-1.xhtml => layout/xul/tree/crashtests/399692-1.xhtml rename : layout/xul/base/src/tree/src/crashtests/399715-1.xhtml => layout/xul/tree/crashtests/399715-1.xhtml rename : layout/xul/base/src/tree/src/crashtests/409807-1.xul => layout/xul/tree/crashtests/409807-1.xul rename : layout/xul/base/src/tree/src/crashtests/414170-1.xul => layout/xul/tree/crashtests/414170-1.xul rename : layout/xul/base/src/tree/src/crashtests/430394-1.xul => layout/xul/tree/crashtests/430394-1.xul rename : layout/xul/base/src/tree/src/crashtests/454186-1.xul => layout/xul/tree/crashtests/454186-1.xul rename : layout/xul/base/src/tree/src/crashtests/479931-1.xhtml => layout/xul/tree/crashtests/479931-1.xhtml rename : layout/xul/base/src/tree/src/crashtests/509602-1-overlay.xul => layout/xul/tree/crashtests/509602-1-overlay.xul rename : layout/xul/base/src/tree/src/crashtests/509602-1.xul => layout/xul/tree/crashtests/509602-1.xul rename : layout/xul/base/src/tree/src/crashtests/601427.html => layout/xul/tree/crashtests/601427.html rename : layout/xul/base/src/tree/src/crashtests/crashtests.list => layout/xul/tree/crashtests/crashtests.list rename : layout/xul/base/src/tree/public/nsITreeBoxObject.idl => layout/xul/tree/nsITreeBoxObject.idl rename : layout/xul/base/src/tree/public/nsITreeColumns.idl => layout/xul/tree/nsITreeColumns.idl rename : layout/xul/base/src/tree/public/nsITreeContentView.idl => layout/xul/tree/nsITreeContentView.idl rename : layout/xul/base/src/tree/public/nsITreeSelection.idl => layout/xul/tree/nsITreeSelection.idl rename : layout/xul/base/src/tree/public/nsITreeView.idl => layout/xul/tree/nsITreeView.idl rename : layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp => layout/xul/tree/nsTreeBodyFrame.cpp rename : layout/xul/base/src/tree/src/nsTreeBodyFrame.h => layout/xul/tree/nsTreeBodyFrame.h rename : layout/xul/base/src/tree/src/nsTreeBoxObject.cpp => layout/xul/tree/nsTreeBoxObject.cpp rename : layout/xul/base/src/tree/src/nsTreeBoxObject.h => layout/xul/tree/nsTreeBoxObject.h rename : layout/xul/base/src/tree/src/nsTreeColFrame.cpp => layout/xul/tree/nsTreeColFrame.cpp rename : layout/xul/base/src/tree/src/nsTreeColFrame.h => layout/xul/tree/nsTreeColFrame.h rename : layout/xul/base/src/tree/src/nsTreeColumns.cpp => layout/xul/tree/nsTreeColumns.cpp rename : layout/xul/base/src/tree/src/nsTreeColumns.h => layout/xul/tree/nsTreeColumns.h rename : layout/xul/base/src/tree/src/nsTreeContentView.cpp => layout/xul/tree/nsTreeContentView.cpp rename : layout/xul/base/src/tree/src/nsTreeContentView.h => layout/xul/tree/nsTreeContentView.h rename : layout/xul/base/src/tree/src/nsTreeImageListener.cpp => layout/xul/tree/nsTreeImageListener.cpp rename : layout/xul/base/src/tree/src/nsTreeImageListener.h => layout/xul/tree/nsTreeImageListener.h rename : layout/xul/base/src/tree/src/nsTreeSelection.cpp => layout/xul/tree/nsTreeSelection.cpp rename : layout/xul/base/src/tree/src/nsTreeSelection.h => layout/xul/tree/nsTreeSelection.h rename : layout/xul/base/src/tree/src/nsTreeStyleCache.cpp => layout/xul/tree/nsTreeStyleCache.cpp rename : layout/xul/base/src/tree/src/nsTreeStyleCache.h => layout/xul/tree/nsTreeStyleCache.h rename : layout/xul/base/src/tree/src/nsTreeUtils.cpp => layout/xul/tree/nsTreeUtils.cpp rename : layout/xul/base/src/tree/src/nsTreeUtils.h => layout/xul/tree/nsTreeUtils.h
263 lines
6.8 KiB
C++
263 lines
6.8 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
//
|
|
// Eric Vaughan
|
|
// Netscape Communications
|
|
//
|
|
// See documentation in associated header file
|
|
//
|
|
|
|
#include "nsGridLayout2.h"
|
|
#include "nsGridRowGroupLayout.h"
|
|
#include "nsGridRow.h"
|
|
#include "nsBox.h"
|
|
#include "nsIScrollableFrame.h"
|
|
#include "nsSprocketLayout.h"
|
|
#include "nsHTMLReflowState.h"
|
|
|
|
nsresult
|
|
NS_NewGridLayout2( nsIPresShell* aPresShell, nsBoxLayout** aNewLayout)
|
|
{
|
|
*aNewLayout = new nsGridLayout2(aPresShell);
|
|
NS_IF_ADDREF(*aNewLayout);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
nsGridLayout2::nsGridLayout2(nsIPresShell* aPresShell):nsStackLayout()
|
|
{
|
|
}
|
|
|
|
// static
|
|
void
|
|
nsGridLayout2::AddOffset(nsBoxLayoutState& aState, nsIFrame* aChild, nsSize& aSize)
|
|
{
|
|
nsMargin offset;
|
|
GetOffset(aState, aChild, offset);
|
|
aSize.width += offset.left;
|
|
aSize.height += offset.top;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsGridLayout2::Layout(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState)
|
|
{
|
|
// XXX This should be set a better way!
|
|
mGrid.SetBox(aBox);
|
|
NS_ASSERTION(aBox->GetLayoutManager() == this, "setting incorrect box");
|
|
|
|
nsresult rv = nsStackLayout::Layout(aBox, aBoxLayoutState);
|
|
#ifdef DEBUG_grid
|
|
mGrid.PrintCellMap();
|
|
#endif
|
|
return rv;
|
|
}
|
|
|
|
void
|
|
nsGridLayout2::IntrinsicWidthsDirty(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState)
|
|
{
|
|
nsStackLayout::IntrinsicWidthsDirty(aBox, aBoxLayoutState);
|
|
// XXXldb We really don't need to do all the work that NeedsRebuild
|
|
// does; we just need to mark intrinsic widths dirty on the
|
|
// (row/column)(s/-groups).
|
|
mGrid.NeedsRebuild(aBoxLayoutState);
|
|
}
|
|
|
|
nsGrid*
|
|
nsGridLayout2::GetGrid(nsIFrame* aBox, int32_t* aIndex, nsGridRowLayout* aRequestor)
|
|
{
|
|
// XXX This should be set a better way!
|
|
mGrid.SetBox(aBox);
|
|
NS_ASSERTION(aBox->GetLayoutManager() == this, "setting incorrect box");
|
|
return &mGrid;
|
|
}
|
|
|
|
void
|
|
nsGridLayout2::AddWidth(nsSize& aSize, nscoord aSize2, bool aIsHorizontal)
|
|
{
|
|
nscoord& size = GET_WIDTH(aSize, aIsHorizontal);
|
|
|
|
if (size != NS_INTRINSICSIZE) {
|
|
if (aSize2 == NS_INTRINSICSIZE)
|
|
size = NS_INTRINSICSIZE;
|
|
else
|
|
size += aSize2;
|
|
}
|
|
}
|
|
|
|
nsSize
|
|
nsGridLayout2::GetMinSize(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|
{
|
|
nsSize minSize = nsStackLayout::GetMinSize(aBox, aState);
|
|
|
|
// if there are no <rows> tags that will sum up our columns,
|
|
// sum up our columns here.
|
|
nsSize total(0,0);
|
|
nsIFrame* rowsBox = mGrid.GetRowsBox();
|
|
nsIFrame* columnsBox = mGrid.GetColumnsBox();
|
|
if (!rowsBox || !columnsBox) {
|
|
if (!rowsBox) {
|
|
// max height is the sum of our rows
|
|
int32_t rows = mGrid.GetRowCount();
|
|
for (int32_t i=0; i < rows; i++)
|
|
{
|
|
nscoord height = mGrid.GetMinRowHeight(aState, i, true);
|
|
AddWidth(total, height, false); // AddHeight
|
|
}
|
|
}
|
|
|
|
if (!columnsBox) {
|
|
// max height is the sum of our rows
|
|
int32_t columns = mGrid.GetColumnCount();
|
|
for (int32_t i=0; i < columns; i++)
|
|
{
|
|
nscoord width = mGrid.GetMinRowHeight(aState, i, false);
|
|
AddWidth(total, width, true); // AddWidth
|
|
}
|
|
}
|
|
|
|
AddMargin(aBox, total);
|
|
AddOffset(aState, aBox, total);
|
|
AddLargestSize(minSize, total);
|
|
}
|
|
|
|
return minSize;
|
|
}
|
|
|
|
nsSize
|
|
nsGridLayout2::GetPrefSize(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|
{
|
|
nsSize pref = nsStackLayout::GetPrefSize(aBox, aState);
|
|
|
|
// if there are no <rows> tags that will sum up our columns,
|
|
// sum up our columns here.
|
|
nsSize total(0,0);
|
|
nsIFrame* rowsBox = mGrid.GetRowsBox();
|
|
nsIFrame* columnsBox = mGrid.GetColumnsBox();
|
|
if (!rowsBox || !columnsBox) {
|
|
if (!rowsBox) {
|
|
// max height is the sum of our rows
|
|
int32_t rows = mGrid.GetRowCount();
|
|
for (int32_t i=0; i < rows; i++)
|
|
{
|
|
nscoord height = mGrid.GetPrefRowHeight(aState, i, true);
|
|
AddWidth(total, height, false); // AddHeight
|
|
}
|
|
}
|
|
|
|
if (!columnsBox) {
|
|
// max height is the sum of our rows
|
|
int32_t columns = mGrid.GetColumnCount();
|
|
for (int32_t i=0; i < columns; i++)
|
|
{
|
|
nscoord width = mGrid.GetPrefRowHeight(aState, i, false);
|
|
AddWidth(total, width, true); // AddWidth
|
|
}
|
|
}
|
|
|
|
AddMargin(aBox, total);
|
|
AddOffset(aState, aBox, total);
|
|
AddLargestSize(pref, total);
|
|
}
|
|
|
|
return pref;
|
|
}
|
|
|
|
nsSize
|
|
nsGridLayout2::GetMaxSize(nsIFrame* aBox, nsBoxLayoutState& aState)
|
|
{
|
|
nsSize maxSize = nsStackLayout::GetMaxSize(aBox, aState);
|
|
|
|
// if there are no <rows> tags that will sum up our columns,
|
|
// sum up our columns here.
|
|
nsSize total(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
|
nsIFrame* rowsBox = mGrid.GetRowsBox();
|
|
nsIFrame* columnsBox = mGrid.GetColumnsBox();
|
|
if (!rowsBox || !columnsBox) {
|
|
if (!rowsBox) {
|
|
total.height = 0;
|
|
// max height is the sum of our rows
|
|
int32_t rows = mGrid.GetRowCount();
|
|
for (int32_t i=0; i < rows; i++)
|
|
{
|
|
nscoord height = mGrid.GetMaxRowHeight(aState, i, true);
|
|
AddWidth(total, height, false); // AddHeight
|
|
}
|
|
}
|
|
|
|
if (!columnsBox) {
|
|
total.width = 0;
|
|
// max height is the sum of our rows
|
|
int32_t columns = mGrid.GetColumnCount();
|
|
for (int32_t i=0; i < columns; i++)
|
|
{
|
|
nscoord width = mGrid.GetMaxRowHeight(aState, i, false);
|
|
AddWidth(total, width, true); // AddWidth
|
|
}
|
|
}
|
|
|
|
AddMargin(aBox, total);
|
|
AddOffset(aState, aBox, total);
|
|
AddSmallestSize(maxSize, total);
|
|
}
|
|
|
|
return maxSize;
|
|
}
|
|
|
|
int32_t
|
|
nsGridLayout2::BuildRows(nsIFrame* aBox, nsGridRow* aRows)
|
|
{
|
|
if (aBox) {
|
|
aRows[0].Init(aBox, true);
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
nsMargin
|
|
nsGridLayout2::GetTotalMargin(nsIFrame* aBox, bool aIsHorizontal)
|
|
{
|
|
nsMargin margin(0,0,0,0);
|
|
return margin;
|
|
}
|
|
|
|
void
|
|
nsGridLayout2::ChildrenInserted(nsIFrame* aBox, nsBoxLayoutState& aState,
|
|
nsIFrame* aPrevBox,
|
|
const nsFrameList::Slice& aNewChildren)
|
|
{
|
|
mGrid.NeedsRebuild(aState);
|
|
}
|
|
|
|
void
|
|
nsGridLayout2::ChildrenAppended(nsIFrame* aBox, nsBoxLayoutState& aState,
|
|
const nsFrameList::Slice& aNewChildren)
|
|
{
|
|
mGrid.NeedsRebuild(aState);
|
|
}
|
|
|
|
void
|
|
nsGridLayout2::ChildrenRemoved(nsIFrame* aBox, nsBoxLayoutState& aState,
|
|
nsIFrame* aChildList)
|
|
{
|
|
mGrid.NeedsRebuild(aState);
|
|
}
|
|
|
|
void
|
|
nsGridLayout2::ChildrenSet(nsIFrame* aBox, nsBoxLayoutState& aState,
|
|
nsIFrame* aChildList)
|
|
{
|
|
mGrid.NeedsRebuild(aState);
|
|
}
|
|
|
|
NS_IMPL_ADDREF_INHERITED(nsGridLayout2, nsStackLayout)
|
|
NS_IMPL_RELEASE_INHERITED(nsGridLayout2, nsStackLayout)
|
|
|
|
NS_INTERFACE_MAP_BEGIN(nsGridLayout2)
|
|
NS_INTERFACE_MAP_ENTRY(nsIGridPart)
|
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIGridPart)
|
|
NS_INTERFACE_MAP_END_INHERITING(nsStackLayout)
|