Bug 1525737 - Remove layout/xul/grid directory. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D53296
This commit is contained in:
Tim Nguyen 2020-11-17 01:20:33 +00:00
parent eb259473ce
commit 73e2871fa8
68 changed files with 1 additions and 4488 deletions

View File

@ -34,8 +34,6 @@ FRAME_CLASSES = [
Frame("nsIFrame", "None", NOT_LEAF),
Frame("nsGfxButtonControlFrame", "GfxButtonControl", LEAF),
Frame("nsGridContainerFrame", "GridContainer", NOT_LEAF),
Frame("nsGridRowGroupFrame", "Box", NOT_LEAF),
Frame("nsGridRowLeafFrame", "Box", NOT_LEAF),
Frame("nsHTMLButtonControlFrame", "HTMLButtonControl", NOT_LEAF),
Frame("nsHTMLCanvasFrame", "HTMLCanvas", NOT_LEAF),
Frame("nsHTMLFramesetBlankFrame", "None", LEAF),

View File

@ -419,9 +419,6 @@ skip-if(Android) include xul/reftest.list
# xul (no XUL theme on Android)
skip-if(Android) include ../xul/reftest/reftest.list
# xul grid (no XUL theme on Android)
skip-if(Android) include ../xul/grid/reftests/reftest.list
# -webkit-box & associated properties (mapped to modern flexbox)
include webkit-box/reftest.list

View File

@ -18,7 +18,6 @@ reftest.jar:
content/text-shadow (../../reftests/text-shadow/*)
content/xul-document-load (../../reftests/xul-document-load/*)
content/xul (../../reftests/xul/*)
content/grid (../../xul/grid/reftests/*)
content/xul/reftest (../../xul/reftest/*)
content/fonts/fira (../../reftests/fonts/fira/*)
content/fonts/sil (../../reftests/fonts/sil/*)
@ -38,7 +37,6 @@ reftest.jar:
content/crashtests/layout/base/crashtests (../../../layout/base/crashtests/*)
content/crashtests/layout/xul/tree/crashtests (../../../layout/xul/tree/crashtests/*)
content/crashtests/layout/xul/crashtests (../../../layout/xul/crashtests/*)
content/crashtests/layout/xul/grid/crashtests (../../../layout/xul/grid/crashtests/*)
content/crashtests/layout/generic/crashtests (../../../layout/generic/crashtests/*)
content/crashtests/layout/style/crashtests (../../../layout/style/crashtests/*)
content/crashtests/gfx/tests/crashtests (../../../gfx/tests/crashtests/*)

View File

@ -1,99 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<tabbox>
<tabs>
<tab label="full grid" />
<tab label="grid alone" />
<tab label="columns alone" />
<tab label="rows alone" />
<tab label="column alone" />
<tab label="row alone" />
<tab label="wacky" />
</tabs>
<tabpanels>
<tabpanel>
<grid>
<rows style="color: blue">
<row>
<label value="row 1,1" />
<label value="row 1,2" />
</row>
<row>
<label value="row 2,1" />
<label value="row 2,2" />
</row>
</rows>
<columns style="color: fuchsia; opacity: 0.7">
<column>
<label value="column 1,1" />
<label value="column 1,2" />
</column>
<column>
<label value="column 2,1" />
<label value="column 2,2" />
</column>
</columns>
</grid>
</tabpanel>
<tabpanel>
<grid>
<label value="Text inside grid" />
</grid>
</tabpanel>
<tabpanel>
<columns>
<label value="Text inside columns" />
</columns>
</tabpanel>
<tabpanel>
<rows>
<label value="Text inside rows" />
</rows>
</tabpanel>
<tabpanel>
<column>
<label value="Text inside column" />
</column>
</tabpanel>
<tabpanel>
<row>
<label value="Text inside row" />
</row>
</tabpanel>
<tabpanel>
<grid>
<label value="Text inside grid one" />
<rows style="color: blue">
<label value="Text inside rows #1" />
<row>
<label value="row 1,1" />
<label value="row 1,2" />
</row>
<label value="Text inside rows #2" />
<row>
<label value="row 2,1" />
<label value="row 2,2" />
</row>
<label value="Text inside rows #3" />
</rows>
<label value="Text inside grid two" style="opacity: 0.7" />
<columns style="color: fuchsia; opacity: 0.7">
<label value="Text inside columns #1" />
<column>
<label value="column 1,1" />
<label value="column 1,2" />
</column>
<label value="Text inside columns #2" />
<column>
<label value="column 2,1" />
<label value="column 2,2" />
</column>
<label value="Text inside columns #3" />
</columns>
<label value="Text inside grid three" style="opacity: 0.4" />
</grid>
</tabpanel>
</tabpanels>
</tabbox>
</window>

View File

@ -1,98 +0,0 @@
<?xml version="1.0"?>
<!-- vim:sw=4:ts=4:noet:
-->
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<tabbox>
<tabs>
<tab label="no group" />
<tab label="wacky orientations" />
</tabs>
<tabpanels>
<tabpanel>
<grid>
<row>
<label value="row 1,1" />
<label value="row 1,2" />
</row>
<row>
<label value="row 2,1" />
<label value="row 2,2" />
</row>
<column>
<label value="column 1,1" />
<label value="column 1,2" />
</column>
<column>
<label value="column 2,1" />
<label value="column 2,2" />
</column>
</grid>
</tabpanel>
<tabpanel>
<grid>
<rows style="color: green">
<row>
<label value="rows+row 1" />
<label value="rows+row 2" />
</row>
<column>
<label value="rows+column 1" />
<label value="rows+column 2" />
</column>
<rows style="color: purple">
<row>
<label value="rows+rows+row 1" />
<label value="rows+rows+row 2" />
</row>
<column>
<label value="rows+rows+column 1" />
<label value="rows+rows+column 2" />
</column>
</rows>
<columns style="color: blue">
<row>
<label value="rows+columns+row 1" />
<label value="rows+columns+row 2" />
</row>
<column>
<label value="rows+columns+column 1" />
<label value="rows+columns+column 2" />
</column>
</columns>
</rows>
<columns style="opacity: 0.7; color: lime">
<row>
<label value="columns+row 1" />
<label value="columns+row 2" />
</row>
<column>
<label value="columns+column 1" />
<label value="columns+column 2" />
</column>
<rows style="color: fuchsia">
<row>
<label value="columns+rows+row 1" />
<label value="columns+rows+row 2" />
</row>
<column>
<label value="columns+rows+column 1" />
<label value="columns+rows+column 2" />
</column>
</rows>
<columns style="color: aqua">
<row>
<label value="columns+columns+row 1" />
<label value="columns+columns+row 2" />
</row>
<column>
<label value="columns+columns+column 1" />
<label value="columns+columns+column 2" />
</column>
</columns>
</columns>
</grid>
</tabpanel>
</tabpanels>
</tabbox>
</window>

View File

@ -1,22 +0,0 @@
<window title="Testcase bug 311710 - Evil xul testcase, using display:-moz-grid-group causes crash [@ nsGridRow::IsCollapsed]"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<script type="application/x-javascript">
function clickit() {
var button = document.getElementById('button');
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
button.dispatchEvent(evt);
}
window.addEventListener('load', clickit, false);
</script>
<grid>
<rows>
<row>
<separator/>
</row>
</rows>
</grid>
<button id="button" onclick="document.getElementsByTagName('row')[0].style.display='-moz-grid-group'" label="Mozilla should not crash, when clicking this button"/>
</window>

View File

@ -1,29 +0,0 @@
<?xml version="1.0"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-JavaScript">
function crash() {
document.getElementById("test").style.display = "none";
}
function clickit() {
var button = document.getElementById('button');
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
button.dispatchEvent(evt);
}
window.onload = clickit;
</script>
<grid>
<columns>
<column/>
</columns>
<rows id="test">
<row><button label="placeholder"/></row>
</rows>
</grid>
<button id="button" label="Crash me" onclick="crash()"/>
</window>

View File

@ -1,41 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<window title="Testcase bug - Crash with evil xul testcase, using -moz-grid/table-caption"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<grid flex="1">
<columns>
<column flex="1"/>
</columns>
<rows>
<row>
</row>
</rows>
</grid>
<html:script>
function doe(){
document.getElementsByTagName('columns')[0].style.display='table-caption';
setTimeout(doe2,20);
}
function doe2(){
document.getElementsByTagName('columns')[0].style.display='-moz-grid';
}
function clickit() {
var button = document.getElementById('button');
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
button.dispatchEvent(evt);
setTimeout('clickit();', 20);
}
window.addEventListener('load', clickit, false);
</html:script>
<html:button id="button" onclick="doe()" label="click">Clicking this should not crash Mozilla</html:button>
</window>

View File

@ -1,9 +0,0 @@
<html class="reftest-wait">
<head>
<script>
setTimeout('document.documentElement.className = ""', 500);
</script>
<body>
<iframe src="313173-1-inner.xhtml"></iframe>
</body>
</html>

View File

@ -1,8 +0,0 @@
<?xml version="1.0"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<grid>
<rows>
<column/>
</rows>
</grid>
</window>

View File

@ -1,13 +0,0 @@
<?xml version="1.0"?>
<window xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<grid>
<columns>
<column id="col1" flex="1"/>
<column id="col2" flex="1"/>
<column id="col3" flex="P-2"/>
</columns>
</grid>
</window>

View File

@ -1,7 +0,0 @@
load chrome://reftest/content/crashtests/layout/xul/grid/crashtests/306911-grid-testcases.xhtml
load chrome://reftest/content/crashtests/layout/xul/grid/crashtests/306911-grid-testcases2.xhtml
load chrome://reftest/content/crashtests/layout/xul/grid/crashtests/311710-1.xhtml
load chrome://reftest/content/crashtests/layout/xul/grid/crashtests/312784-1.xhtml
load 313173-1.html
load chrome://reftest/content/crashtests/layout/xul/grid/crashtests/321066-1.xhtml
load chrome://reftest/content/crashtests/layout/xul/grid/crashtests/423802-crash.xhtml

View File

@ -1,43 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
with Files("**"):
BUG_COMPONENT = ("Core", "XUL")
EXPORTS += [
"nsGrid.h",
"nsGridCell.h",
"nsGridLayout2.h",
"nsGridRow.h",
"nsGridRowGroupLayout.h",
"nsGridRowLayout.h",
"nsGridRowLeafFrame.h",
"nsGridRowLeafLayout.h",
"nsIGridPart.h",
]
UNIFIED_SOURCES += [
"nsGrid.cpp",
"nsGridCell.cpp",
"nsGridLayout2.cpp",
"nsGridRow.cpp",
"nsGridRowGroupFrame.cpp",
"nsGridRowGroupLayout.cpp",
"nsGridRowLayout.cpp",
"nsGridRowLeafFrame.cpp",
"nsGridRowLeafLayout.cpp",
]
FINAL_LIBRARY = "xul"
LOCAL_INCLUDES += [
"..",
"../../forms",
"../../generic",
"../../style",
]
if CONFIG["CC_TYPE"] in ("clang", "gcc"):
CXXFLAGS += ["-Wno-error=shadow"]

File diff suppressed because it is too large Load Diff

View File

@ -1,141 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef nsGrid_h___
#define nsGrid_h___
#include "nsStackLayout.h"
#include "nsIGridPart.h"
#include "nsCOMPtr.h"
#include "mozilla/UniquePtr.h"
class nsBoxLayoutState;
class nsGridCell;
//#define DEBUG_grid 1
/**
* The grid data structure, i.e., the grid cellmap.
*/
class nsGrid {
public:
nsGrid();
~nsGrid();
nsGridRow* GetColumnAt(int32_t aIndex, bool aIsHorizontal = true);
nsGridRow* GetRowAt(int32_t aIndex, bool aIsHorizontal = true);
nsGridCell* GetCellAt(int32_t aX, int32_t aY);
void NeedsRebuild(nsBoxLayoutState& aBoxLayoutState);
void RebuildIfNeeded();
// For all the methods taking an aIsHorizontal parameter:
// * When aIsHorizontal is true, the words "rows" and (for
// GetColumnCount) "columns" refer to their normal meanings.
// * When aIsHorizontal is false, the meanings are flipped.
// FIXME: Maybe eliminate GetColumnCount and change aIsHorizontal to
// aIsRows? (Calling it horizontal doesn't really make sense because
// row groups and columns have vertical orientation, whereas column
// groups and rows are horizontal.)
nsSize GetPrefRowSize(nsBoxLayoutState& aBoxLayoutState, int32_t aRowIndex,
bool aIsHorizontal = true);
nsSize GetMinRowSize(nsBoxLayoutState& aBoxLayoutState, int32_t aRowIndex,
bool aIsHorizontal = true);
nsSize GetMaxRowSize(nsBoxLayoutState& aBoxLayoutState, int32_t aRowIndex,
bool aIsHorizontal = true);
nscoord GetRowFlex(int32_t aRowIndex, bool aIsHorizontal = true);
nscoord GetPrefRowHeight(nsBoxLayoutState& aBoxLayoutState, int32_t aRowIndex,
bool aIsHorizontal = true);
nscoord GetMinRowHeight(nsBoxLayoutState& aBoxLayoutState, int32_t aRowIndex,
bool aIsHorizontal = true);
nscoord GetMaxRowHeight(nsBoxLayoutState& aBoxLayoutState, int32_t aRowIndex,
bool aIsHorizontal = true);
void GetRowOffsets(int32_t aIndex, nscoord& aTop, nscoord& aBottom,
bool aIsHorizontal = true);
void RowAddedOrRemoved(nsBoxLayoutState& aBoxLayoutState, int32_t aIndex,
bool aIsHorizontal = true);
void CellAddedOrRemoved(nsBoxLayoutState& aBoxLayoutState, int32_t aIndex,
bool aIsHorizontal = true);
void DirtyRows(nsIFrame* aRowBox, nsBoxLayoutState& aState);
#ifdef DEBUG_grid
void PrintCellMap();
#endif
int32_t GetExtraColumnCount(bool aIsHorizontal = true);
int32_t GetExtraRowCount(bool aIsHorizontal = true);
// accessors
void SetBox(nsIFrame* aBox) { mBox = aBox; }
nsIFrame* GetBox() { return mBox; }
nsIFrame* GetRowsBox() { return mRowsBox; }
nsIFrame* GetColumnsBox() { return mColumnsBox; }
int32_t GetRowCount(int32_t aIsHorizontal = true);
int32_t GetColumnCount(int32_t aIsHorizontal = true);
static nsIFrame* GetScrolledBox(nsIFrame* aChild);
static nsIFrame* GetScrollBox(nsIFrame* aChild);
static nsIGridPart* GetPartFromBox(nsIFrame* aBox);
void GetFirstAndLastRow(int32_t& aFirstIndex, int32_t& aLastIndex,
nsGridRow*& aFirstRow, nsGridRow*& aLastRow,
bool aIsHorizontal);
private:
nsMargin GetBoxTotalMargin(nsIFrame* aBox, bool aIsHorizontal = true);
void FreeMap();
void FindRowsAndColumns(nsIFrame** aRows, nsIFrame** aColumns);
mozilla::UniquePtr<nsGridRow[]> BuildRows(nsIFrame* aBox, int32_t aSize,
bool aIsHorizontal = true);
mozilla::UniquePtr<nsGridCell[]> BuildCellMap(int32_t aRows,
int32_t aColumns);
void PopulateCellMap(nsGridRow* aRows, nsGridRow* aColumns, int32_t aRowCount,
int32_t aColumnCount, bool aIsHorizontal = true);
void CountRowsColumns(nsIFrame* aBox, int32_t& aRowCount,
int32_t& aComputedColumnCount);
void SetLargestSize(nsSize& aSize, nscoord aHeight,
bool aIsHorizontal = true);
void SetSmallestSize(nsSize& aSize, nscoord aHeight,
bool aIsHorizontal = true);
bool IsGrid(nsIFrame* aBox);
// the box that implement the <grid> tag
nsIFrame* mBox;
// an array of row object
mozilla::UniquePtr<nsGridRow[]> mRows;
// an array of columns objects.
mozilla::UniquePtr<nsGridRow[]> mColumns;
// the first in the <grid> that implements the <rows> tag.
nsIFrame* mRowsBox;
// the first in the <grid> that implements the <columns> tag.
nsIFrame* mColumnsBox;
// a flag that is false tells us to rebuild the who grid
bool mNeedsRebuild;
// number of rows and columns as defined by the XUL
int32_t mRowCount;
int32_t mColumnCount;
// number of rows and columns that are implied but not
// explicitly defined int he XUL
int32_t mExtraRowCount;
int32_t mExtraColumnCount;
// x,y array of cells in the rows and columns
mozilla::UniquePtr<nsGridCell[]> mCellMap;
// a flag that when true suppresses all other MarkDirties. This
// prevents lots of extra work being done.
bool mMarkingDirty;
};
#endif

View File

@ -1,105 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "nsGridCell.h"
#include "nsIFrame.h"
#include "nsGridLayout2.h"
nsGridCell::nsGridCell() : mBoxInColumn(nullptr), mBoxInRow(nullptr) {
MOZ_COUNT_CTOR(nsGridCell);
}
nsGridCell::~nsGridCell() { MOZ_COUNT_DTOR(nsGridCell); }
nsSize nsGridCell::GetXULPrefSize(nsBoxLayoutState& aState) {
nsSize sum(0, 0);
// take our 2 children and add them up.
// we are as wide as the widest child plus its left offset
// we are tall as the tallest child plus its top offset
if (mBoxInColumn) {
nsSize pref = mBoxInColumn->GetXULPrefSize(aState);
nsIFrame::AddXULMargin(mBoxInColumn, pref);
nsBoxLayout::AddLargestSize(sum, pref);
}
if (mBoxInRow) {
nsSize pref = mBoxInRow->GetXULPrefSize(aState);
nsIFrame::AddXULMargin(mBoxInRow, pref);
nsBoxLayout::AddLargestSize(sum, pref);
}
return sum;
}
nsSize nsGridCell::GetXULMinSize(nsBoxLayoutState& aState) {
nsSize sum(0, 0);
// take our 2 children and add them up.
// we are as wide as the widest child plus its left offset
// we are tall as the tallest child plus its top offset
if (mBoxInColumn) {
nsSize min = mBoxInColumn->GetXULMinSize(aState);
nsIFrame::AddXULMargin(mBoxInColumn, min);
nsBoxLayout::AddLargestSize(sum, min);
}
if (mBoxInRow) {
nsSize min = mBoxInRow->GetXULMinSize(aState);
nsIFrame::AddXULMargin(mBoxInRow, min);
nsBoxLayout::AddLargestSize(sum, min);
}
return sum;
}
nsSize nsGridCell::GetXULMaxSize(nsBoxLayoutState& aState) {
nsSize sum(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
// take our 2 children and add them up.
// we are as wide as the smallest child plus its left offset
// we are tall as the shortest child plus its top offset
if (mBoxInColumn) {
nsSize max = mBoxInColumn->GetXULMaxSize(aState);
nsIFrame::AddXULMargin(mBoxInColumn, max);
nsBoxLayout::AddSmallestSize(sum, max);
}
if (mBoxInRow) {
nsSize max = mBoxInRow->GetXULMaxSize(aState);
nsIFrame::AddXULMargin(mBoxInRow, max);
nsBoxLayout::AddSmallestSize(sum, max);
}
return sum;
}
bool nsGridCell::IsXULCollapsed() {
return ((mBoxInColumn && mBoxInColumn->IsXULCollapsed()) ||
(mBoxInRow && mBoxInRow->IsXULCollapsed()));
}

View File

@ -1,52 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
/**
Author:
Eric D Vaughan
**/
#ifndef nsGridCell_h___
#define nsGridCell_h___
#include "mozilla/Attributes.h"
class nsBoxLayoutState;
struct nsSize;
class nsIFrame;
/*
* Grid cell is what makes up the cellmap in the grid. Each GridCell contains
* 2 pointers. One to the matching box in the columns and one to the matching
* box in the rows. Remember that you can put content in both rows and columns.
* When asked for preferred/min/max sizes it works like a stack and takes the
* biggest sizes.
*/
class nsGridCell final {
public:
nsGridCell();
~nsGridCell();
nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState);
nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState);
nsSize GetXULMaxSize(nsBoxLayoutState& aBoxLayoutState);
bool IsXULCollapsed();
// accessors
nsIFrame* GetBoxInColumn() { return mBoxInColumn; }
nsIFrame* GetBoxInRow() { return mBoxInRow; }
void SetBoxInRow(nsIFrame* aBox) { mBoxInRow = aBox; }
void SetBoxInColumn(nsIFrame* aBox) { mBoxInColumn = aBox; }
private:
nsIFrame* mBoxInColumn;
nsIFrame* mBoxInRow;
};
#endif

View File

@ -1,214 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "nsIScrollableFrame.h"
#include "nsSprocketLayout.h"
#include "mozilla/ReflowInput.h"
nsresult NS_NewGridLayout2(nsBoxLayout** aNewLayout) {
*aNewLayout = new nsGridLayout2();
NS_IF_ADDREF(*aNewLayout);
return NS_OK;
}
NS_IMETHODIMP
nsGridLayout2::XULLayout(nsIFrame* aBox, nsBoxLayoutState& aBoxLayoutState) {
// XXX This should be set a better way!
mGrid.SetBox(aBox);
NS_ASSERTION(aBox->GetXULLayoutManager() == this, "setting incorrect box");
nsresult rv = nsStackLayout::XULLayout(aBox, aBoxLayoutState);
#ifdef DEBUG_grid
mGrid.PrintCellMap();
#endif
return rv;
}
void nsGridLayout2::IntrinsicISizesDirty(nsIFrame* aBox,
nsBoxLayoutState& aBoxLayoutState) {
nsStackLayout::IntrinsicISizesDirty(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->GetXULLayoutManager() == this, "setting incorrect box");
return &mGrid;
}
void nsGridLayout2::AddWidth(nsSize& aSize, nscoord aSize2,
bool aIsHorizontal) {
nscoord& size = GET_WIDTH(aSize, aIsHorizontal);
if (size != NS_UNCONSTRAINEDSIZE) {
if (aSize2 == NS_UNCONSTRAINEDSIZE)
size = NS_UNCONSTRAINEDSIZE;
else
size += aSize2;
}
}
nsSize nsGridLayout2::GetXULMinSize(nsIFrame* aBox, nsBoxLayoutState& aState) {
nsSize minSize = nsStackLayout::GetXULMinSize(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
}
}
AddXULMargin(aBox, total);
AddLargestSize(minSize, total);
}
return minSize;
}
nsSize nsGridLayout2::GetXULPrefSize(nsIFrame* aBox, nsBoxLayoutState& aState) {
nsSize pref = nsStackLayout::GetXULPrefSize(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
}
}
AddXULMargin(aBox, total);
AddLargestSize(pref, total);
}
return pref;
}
nsSize nsGridLayout2::GetXULMaxSize(nsIFrame* aBox, nsBoxLayoutState& aState) {
nsSize maxSize = nsStackLayout::GetXULMaxSize(aBox, aState);
// if there are no <rows> tags that will sum up our columns,
// sum up our columns here.
nsSize total(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
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
}
}
AddXULMargin(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)

View File

@ -1,83 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef nsGridLayout2_h___
#define nsGridLayout2_h___
#include "mozilla/Attributes.h"
#include "nsStackLayout.h"
#include "nsIGridPart.h"
#include "nsCoord.h"
#include "nsGrid.h"
class nsGridRowGroupLayout;
class nsGridRowLayout;
class nsGridRow;
class nsBoxLayoutState;
/**
* The nsBoxLayout implementation for a grid.
*/
class nsGridLayout2 final : public nsStackLayout, public nsIGridPart {
public:
friend nsresult NS_NewGridLayout2(nsBoxLayout** aNewLayout);
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD XULLayout(nsIFrame* aBox,
nsBoxLayoutState& aBoxLayoutState) override;
virtual void IntrinsicISizesDirty(nsIFrame* aBox,
nsBoxLayoutState& aBoxLayoutState) override;
virtual nsGridRowGroupLayout* CastToRowGroupLayout() override {
return nullptr;
}
virtual nsGridLayout2* CastToGridLayout() override { return this; }
virtual nsGrid* GetGrid(nsIFrame* aBox, int32_t* aIndex,
nsGridRowLayout* aRequestor = nullptr) override;
virtual nsIGridPart* GetParentGridPart(nsIFrame* aBox,
nsIFrame** aParentBox) override {
MOZ_ASSERT_UNREACHABLE("Should not be called");
return nullptr;
}
virtual nsSize GetXULMinSize(nsIFrame* aBox,
nsBoxLayoutState& aBoxLayoutState) override;
virtual nsSize GetXULMaxSize(nsIFrame* aBox,
nsBoxLayoutState& aBoxLayoutState) override;
virtual nsSize GetXULPrefSize(nsIFrame* aBox,
nsBoxLayoutState& aBoxLayoutState) override;
virtual void CountRowsColumns(nsIFrame* aBox, int32_t& aRowCount,
int32_t& aComputedColumnCount) override {
aRowCount++;
}
virtual void DirtyRows(nsIFrame* aBox, nsBoxLayoutState& aState) override {}
virtual int32_t BuildRows(nsIFrame* aBox, nsGridRow* aRows) override;
virtual nsMargin GetTotalMargin(nsIFrame* aBox, bool aIsHorizontal) override;
virtual Type GetType() override { return eGrid; }
virtual void ChildrenInserted(
nsIFrame* aBox, nsBoxLayoutState& aState, nsIFrame* aPrevBox,
const nsFrameList::Slice& aNewChildren) override;
virtual void ChildrenAppended(
nsIFrame* aBox, nsBoxLayoutState& aState,
const nsFrameList::Slice& aNewChildren) override;
virtual void ChildrenRemoved(nsIFrame* aBox, nsBoxLayoutState& aState,
nsIFrame* aChildList) override;
virtual void ChildrenSet(nsIFrame* aBox, nsBoxLayoutState& aState,
nsIFrame* aChildList) override;
virtual nsIGridPart* AsGridPart() override { return this; }
protected:
explicit nsGridLayout2() = default;
virtual ~nsGridLayout2() = default;
nsGrid mGrid;
private:
void AddWidth(nsSize& aSize, nscoord aSize2, bool aIsHorizontal);
}; // class nsGridLayout2
#endif

View File

@ -1,49 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "nsGridRow.h"
#include "nsBoxLayoutState.h"
#include "nsIFrame.h"
nsGridRow::nsGridRow()
: mIsBogus(false),
mBox(nullptr),
mFlex(-1),
mPref(-1),
mMin(-1),
mMax(-1),
mTop(-1),
mBottom(-1),
mTopMargin(0),
mBottomMargin(0)
{
MOZ_COUNT_CTOR(nsGridRow);
}
void nsGridRow::Init(nsIFrame* aBox, bool aIsBogus) {
mBox = aBox;
mIsBogus = aIsBogus;
mFlex = -1;
mPref = -1;
mMin = -1;
mMax = -1;
mTop = -1;
mBottom = -1;
mTopMargin = 0;
mBottomMargin = 0;
}
nsGridRow::~nsGridRow() { MOZ_COUNT_DTOR(nsGridRow); }
bool nsGridRow::IsXULCollapsed() { return mBox && mBox->IsXULCollapsed(); }

View File

@ -1,53 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
/**
Author:
Eric D Vaughan
**/
#ifndef nsGridRow_h___
#define nsGridRow_h___
#include "nsCoord.h"
class nsIFrame;
/**
* The row (or column) data structure in the grid cellmap.
*/
class nsGridRow {
public:
nsGridRow();
~nsGridRow();
void Init(nsIFrame* aBox, bool aIsBogus);
// accessors
nsIFrame* GetBox() { return mBox; }
bool IsPrefSet() { return (mPref != -1); }
bool IsMinSet() { return (mMin != -1); }
bool IsMaxSet() { return (mMax != -1); }
bool IsFlexSet() { return (mFlex != -1); }
bool IsOffsetSet() { return (mTop != -1 && mBottom != -1); }
bool IsXULCollapsed();
public:
bool mIsBogus;
nsIFrame* mBox;
nscoord mFlex;
nscoord mPref;
nscoord mMin;
nscoord mMax;
nscoord mTop;
nscoord mBottom;
nscoord mTopMargin;
nscoord mBottomMargin;
};
#endif

View File

@ -1,62 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "mozilla/PresShell.h"
#include "nsGridRowGroupFrame.h"
#include "nsGridRowLeafLayout.h"
#include "nsGridRow.h"
#include "nsBoxLayoutState.h"
#include "nsGridLayout2.h"
using namespace mozilla;
already_AddRefed<nsBoxLayout> NS_NewGridRowGroupLayout();
nsIFrame* NS_NewGridRowGroupFrame(PresShell* aPresShell,
ComputedStyle* aStyle) {
nsCOMPtr<nsBoxLayout> layout = NS_NewGridRowGroupLayout();
return new (aPresShell)
nsGridRowGroupFrame(aStyle, aPresShell->GetPresContext(), layout);
}
NS_IMPL_FRAMEARENA_HELPERS(nsGridRowGroupFrame)
/**
* This is redefined because row groups have a funny property. If they are
* flexible then their flex must be equal to the sum of their children's flexes.
*/
nscoord nsGridRowGroupFrame::GetXULFlex() {
// if we are flexible out flexibility is determined by our columns.
// so first get the our flex. If not 0 then our flex is the sum of
// our columns flexes.
if (!XULNeedsRecalc(mFlex)) {
return mFlex;
}
if (nsBoxFrame::GetXULFlex() == 0) {
return 0;
}
// ok we are flexible add up our children
nscoord totalFlex = 0;
nsIFrame* child = nsIFrame::GetChildXULBox(this);
while (child) {
totalFlex += child->GetXULFlex();
child = GetNextXULBox(child);
}
mFlex = totalFlex;
return totalFlex;
}

View File

@ -1,45 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 D Vaughan
A frame that can have multiple children. Only one child may be displayed at
one time. So the can be flipped though like a deck of cards.
**/
#ifndef nsGridRowGroupFrame_h___
#define nsGridRowGroupFrame_h___
#include "mozilla/Attributes.h"
#include "nsBoxFrame.h"
/**
* A frame representing a grid row (or column) group, which is usually
* an element that is a child of a grid and contains all the rows (or
* all the columns). However, multiple levels of groups are allowed, so
* the parent or child could instead be another group.
*/
class nsGridRowGroupFrame final : public nsBoxFrame {
public:
NS_DECL_FRAMEARENA_HELPERS(nsGridRowGroupFrame)
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(u"nsGridRowGroup"_ns, aResult);
}
#endif
nsGridRowGroupFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
nsBoxLayout* aLayoutManager)
: nsBoxFrame(aStyle, aPresContext, kClassID, false, aLayoutManager) {}
virtual nscoord GetXULFlex() override;
}; // class nsGridRowGroupFrame
#endif

View File

@ -1,237 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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
//
/*
* The nsGridRowGroupLayout implements the <rows> or <columns> tag in a grid.
*/
#include "nsGridRowGroupLayout.h"
#include "nsCOMPtr.h"
#include "nsIScrollableFrame.h"
#include "nsBoxLayoutState.h"
#include "nsGridLayout2.h"
#include "nsGridRow.h"
#include "mozilla/ReflowInput.h"
already_AddRefed<nsBoxLayout> NS_NewGridRowGroupLayout() {
RefPtr<nsBoxLayout> layout = new nsGridRowGroupLayout();
return layout.forget();
}
nsGridRowGroupLayout::nsGridRowGroupLayout()
: nsGridRowLayout(), mRowCount(0) {}
nsGridRowGroupLayout::~nsGridRowGroupLayout() = default;
void nsGridRowGroupLayout::ChildAddedOrRemoved(nsIFrame* aBox,
nsBoxLayoutState& aState) {
int32_t index = 0;
nsGrid* grid = GetGrid(aBox, &index);
bool isHorizontal = IsXULHorizontal(aBox);
if (grid) grid->RowAddedOrRemoved(aState, index, isHorizontal);
}
void nsGridRowGroupLayout::AddWidth(nsSize& aSize, nscoord aSize2,
bool aIsHorizontal) {
nscoord& size = GET_WIDTH(aSize, aIsHorizontal);
if (size == NS_UNCONSTRAINEDSIZE || aSize2 == NS_UNCONSTRAINEDSIZE)
size = NS_UNCONSTRAINEDSIZE;
else
size += aSize2;
}
nsSize nsGridRowGroupLayout::GetXULPrefSize(nsIFrame* aBox,
nsBoxLayoutState& aState) {
nsSize vpref = nsGridRowLayout::GetXULPrefSize(aBox, aState);
/* It is possible that we could have some extra columns. This is when less
* columns in XUL were defined that needed. And example might be a grid with 3
* defined columns but a row with 4 cells in it. We would need an extra column
* to make the grid work. But because that extra column does not have a box
* associated with it we must add its size in manually. Remember we could have
* extra rows as well.
*/
int32_t index = 0;
nsGrid* grid = GetGrid(aBox, &index);
if (grid) {
// make sure we add in extra columns sizes as well
bool isHorizontal = IsXULHorizontal(aBox);
int32_t extraColumns = grid->GetExtraColumnCount(isHorizontal);
int32_t start = grid->GetColumnCount(isHorizontal) -
grid->GetExtraColumnCount(isHorizontal);
for (int32_t i = 0; i < extraColumns; i++) {
nscoord pref = grid->GetPrefRowHeight(
aState, i + start, !isHorizontal); // GetPrefColumnWidth
AddWidth(vpref, pref, isHorizontal);
}
}
return vpref;
}
nsSize nsGridRowGroupLayout::GetXULMaxSize(nsIFrame* aBox,
nsBoxLayoutState& aState) {
nsSize maxSize = nsGridRowLayout::GetXULMaxSize(aBox, aState);
int32_t index = 0;
nsGrid* grid = GetGrid(aBox, &index);
if (grid) {
// make sure we add in extra columns sizes as well
bool isHorizontal = IsXULHorizontal(aBox);
int32_t extraColumns = grid->GetExtraColumnCount(isHorizontal);
int32_t start = grid->GetColumnCount(isHorizontal) -
grid->GetExtraColumnCount(isHorizontal);
for (int32_t i = 0; i < extraColumns; i++) {
nscoord max = grid->GetMaxRowHeight(aState, i + start,
!isHorizontal); // GetMaxColumnWidth
AddWidth(maxSize, max, isHorizontal);
}
}
return maxSize;
}
nsSize nsGridRowGroupLayout::GetXULMinSize(nsIFrame* aBox,
nsBoxLayoutState& aState) {
nsSize minSize = nsGridRowLayout::GetXULMinSize(aBox, aState);
int32_t index = 0;
nsGrid* grid = GetGrid(aBox, &index);
if (grid) {
// make sure we add in extra columns sizes as well
bool isHorizontal = IsXULHorizontal(aBox);
int32_t extraColumns = grid->GetExtraColumnCount(isHorizontal);
int32_t start = grid->GetColumnCount(isHorizontal) -
grid->GetExtraColumnCount(isHorizontal);
for (int32_t i = 0; i < extraColumns; i++) {
nscoord min = grid->GetMinRowHeight(aState, i + start,
!isHorizontal); // GetMinColumnWidth
AddWidth(minSize, min, isHorizontal);
}
}
return minSize;
}
/*
* Run down through our children dirtying them recursively.
*/
void nsGridRowGroupLayout::DirtyRows(nsIFrame* aBox, nsBoxLayoutState& aState) {
if (aBox) {
// mark us dirty
// XXXldb We probably don't want to walk up the ancestor chain
// calling MarkIntrinsicISizesDirty for every row group.
aState.PresShell()->FrameNeedsReflow(
aBox, mozilla::IntrinsicDirty::TreeChange, NS_FRAME_IS_DIRTY);
nsIFrame* child = nsIFrame::GetChildXULBox(aBox);
while (child) {
// walk into scrollframes
nsIFrame* deepChild = nsGrid::GetScrolledBox(child);
// walk into other monuments
nsIGridPart* monument = nsGrid::GetPartFromBox(deepChild);
if (monument) monument->DirtyRows(deepChild, aState);
child = nsIFrame::GetNextXULBox(child);
}
}
}
void nsGridRowGroupLayout::CountRowsColumns(nsIFrame* aBox, int32_t& aRowCount,
int32_t& aComputedColumnCount) {
if (aBox) {
int32_t startCount = aRowCount;
nsIFrame* child = nsIFrame::GetChildXULBox(aBox);
while (child) {
// first see if it is a scrollframe. If so walk down into it and get the
// scrolled child
nsIFrame* deepChild = nsGrid::GetScrolledBox(child);
nsIGridPart* monument = nsGrid::GetPartFromBox(deepChild);
if (monument) {
monument->CountRowsColumns(deepChild, aRowCount, aComputedColumnCount);
child = nsIFrame::GetNextXULBox(child);
continue;
}
child = nsIFrame::GetNextXULBox(child);
// if not a monument. Then count it. It will be a bogus row
aRowCount++;
}
mRowCount = aRowCount - startCount;
}
}
/**
* Fill out the given row structure recursively
*/
int32_t nsGridRowGroupLayout::BuildRows(nsIFrame* aBox, nsGridRow* aRows) {
int32_t rowCount = 0;
if (aBox) {
nsIFrame* child = nsIFrame::GetChildXULBox(aBox);
while (child) {
// first see if it is a scrollframe. If so walk down into it and get the
// scrolled child
nsIFrame* deepChild = nsGrid::GetScrolledBox(child);
nsIGridPart* monument = nsGrid::GetPartFromBox(deepChild);
if (monument) {
rowCount += monument->BuildRows(deepChild, &aRows[rowCount]);
child = nsIFrame::GetNextXULBox(child);
continue;
}
aRows[rowCount].Init(child, true);
child = nsIFrame::GetNextXULBox(child);
// if not a monument. Then count it. It will be a bogus row
rowCount++;
}
}
return rowCount;
}
nsMargin nsGridRowGroupLayout::GetTotalMargin(nsIFrame* aBox,
bool aIsHorizontal) {
// group have border and padding added to the total margin
nsMargin margin = nsGridRowLayout::GetTotalMargin(aBox, aIsHorizontal);
// make sure we have the scrollframe on the outside if it has one.
// that's where the border is.
aBox = nsGrid::GetScrollBox(aBox);
// add our border/padding to it
nsMargin borderPadding(0, 0, 0, 0);
aBox->GetXULBorderAndPadding(borderPadding);
margin += borderPadding;
return margin;
}

View File

@ -1,54 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
/**
Author:
Eric D Vaughan
**/
#ifndef nsGridRowGroupLayout_h___
#define nsGridRowGroupLayout_h___
#include "mozilla/Attributes.h"
#include "nsGridRowLayout.h"
/**
* The nsBoxLayout implementation for nsGridRowGroupFrame.
*/
class nsGridRowGroupLayout : public nsGridRowLayout {
public:
friend already_AddRefed<nsBoxLayout> NS_NewGridRowGroupLayout();
virtual nsGridRowGroupLayout* CastToRowGroupLayout() override { return this; }
virtual nsSize GetXULMinSize(nsIFrame* aBox,
nsBoxLayoutState& aBoxLayoutState) override;
virtual nsSize GetXULPrefSize(nsIFrame* aBox,
nsBoxLayoutState& aBoxLayoutState) override;
virtual nsSize GetXULMaxSize(nsIFrame* aBox,
nsBoxLayoutState& aBoxLayoutState) override;
virtual void CountRowsColumns(nsIFrame* aBox, int32_t& aRowCount,
int32_t& aComputedColumnCount) override;
virtual void DirtyRows(nsIFrame* aBox, nsBoxLayoutState& aState) override;
virtual int32_t BuildRows(nsIFrame* aBox, nsGridRow* aRows) override;
virtual nsMargin GetTotalMargin(nsIFrame* aBox, bool aIsHorizontal) override;
virtual int32_t GetRowCount() override { return mRowCount; }
virtual Type GetType() override { return eRowGroup; }
protected:
nsGridRowGroupLayout();
virtual ~nsGridRowGroupLayout();
virtual void ChildAddedOrRemoved(nsIFrame* aBox,
nsBoxLayoutState& aState) override;
static void AddWidth(nsSize& aSize, nscoord aSize2, bool aIsHorizontal);
private:
int32_t mRowCount;
};
#endif

View File

@ -1,174 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "nsGridRowLayout.h"
#include "nsBoxLayoutState.h"
#include "nsIScrollableFrame.h"
#include "nsStackLayout.h"
#include "nsGrid.h"
nsGridRowLayout::nsGridRowLayout() : nsSprocketLayout() {}
nsGridRowLayout::~nsGridRowLayout() = default;
void nsGridRowLayout::ChildrenInserted(nsIFrame* aBox, nsBoxLayoutState& aState,
nsIFrame* aPrevBox,
const nsFrameList::Slice& aNewChildren) {
ChildAddedOrRemoved(aBox, aState);
}
void nsGridRowLayout::ChildrenAppended(nsIFrame* aBox, nsBoxLayoutState& aState,
const nsFrameList::Slice& aNewChildren) {
ChildAddedOrRemoved(aBox, aState);
}
void nsGridRowLayout::ChildrenRemoved(nsIFrame* aBox, nsBoxLayoutState& aState,
nsIFrame* aChildList) {
ChildAddedOrRemoved(aBox, aState);
}
void nsGridRowLayout::ChildrenSet(nsIFrame* aBox, nsBoxLayoutState& aState,
nsIFrame* aChildList) {
ChildAddedOrRemoved(aBox, aState);
}
nsIGridPart* nsGridRowLayout::GetParentGridPart(nsIFrame* aBox,
nsIFrame** aParentBox) {
// go up and find our parent gridRow. Skip and non gridRow
// parents.
*aParentBox = nullptr;
// walk up through any scrollboxes
aBox = nsGrid::GetScrollBox(aBox);
// get the parent
if (aBox) {
aBox = nsIFrame::GetParentXULBox(aBox);
}
if (aBox) {
nsIGridPart* parentGridRow = nsGrid::GetPartFromBox(aBox);
if (parentGridRow && parentGridRow->CanContain(this)) {
*aParentBox = aBox;
return parentGridRow;
}
}
return nullptr;
}
nsGrid* nsGridRowLayout::GetGrid(nsIFrame* aBox, int32_t* aIndex,
nsGridRowLayout* aRequestor) {
if (aRequestor == nullptr) {
nsIFrame* parentBox; // nsIFrame is implemented by nsIFrame and is not
// refcounted.
nsIGridPart* parent = GetParentGridPart(aBox, &parentBox);
if (parent) return parent->GetGrid(parentBox, aIndex, this);
return nullptr;
}
int32_t index = -1;
nsIFrame* child = nsIFrame::GetChildXULBox(aBox);
int32_t count = 0;
while (child) {
// if there is a scrollframe walk inside it to its child
nsIFrame* childBox = nsGrid::GetScrolledBox(child);
nsBoxLayout* layout = childBox->GetXULLayoutManager();
nsIGridPart* gridRow = nsGrid::GetPartFromBox(childBox);
if (gridRow) {
if (layout == aRequestor) {
index = count;
break;
}
count += gridRow->GetRowCount();
} else
count++;
child = nsIFrame::GetNextXULBox(child);
}
// if we didn't find ourselves then the tree isn't properly formed yet
// this could happen during initial construction so lets just
// fail.
if (index == -1) {
*aIndex = -1;
return nullptr;
}
(*aIndex) += index;
nsIFrame*
parentBox; // nsIFrame is implemented by nsIFrame and is not refcounted.
nsIGridPart* parent = GetParentGridPart(aBox, &parentBox);
if (parent) return parent->GetGrid(parentBox, aIndex, this);
return nullptr;
}
nsMargin nsGridRowLayout::GetTotalMargin(nsIFrame* aBox, bool aIsHorizontal) {
// get our parents margin
nsMargin margin(0, 0, 0, 0);
nsIFrame* parent = nullptr;
nsIGridPart* part = GetParentGridPart(aBox, &parent);
if (part && parent) {
// if we are the first or last child walk upward and add margins.
// make sure we check for a scrollbox
aBox = nsGrid::GetScrollBox(aBox);
// see if we have a next to see if we are last
nsIFrame* next = nsIFrame::GetNextXULBox(aBox);
// get the parent first child to see if we are first
nsIFrame* child = nsIFrame::GetChildXULBox(parent);
margin = part->GetTotalMargin(parent, aIsHorizontal);
// if first or last
if (child == aBox || next == nullptr) {
// if it's not the first child remove the top margin
// we don't need it.
if (child != aBox) {
if (aIsHorizontal)
margin.top = 0;
else
margin.left = 0;
}
// if it's not the last child remove the bottom margin
// we don't need it.
if (next != nullptr) {
if (aIsHorizontal)
margin.bottom = 0;
else
margin.right = 0;
}
}
}
// add ours to it.
nsMargin ourMargin;
aBox->GetXULMargin(ourMargin);
margin += ourMargin;
return margin;
}
NS_IMPL_ADDREF_INHERITED(nsGridRowLayout, nsBoxLayout)
NS_IMPL_RELEASE_INHERITED(nsGridRowLayout, nsBoxLayout)
NS_INTERFACE_MAP_BEGIN(nsGridRowLayout)
NS_INTERFACE_MAP_ENTRY(nsIGridPart)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIGridPart)
NS_INTERFACE_MAP_END_INHERITING(nsBoxLayout)

View File

@ -1,66 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
/**
Author:
Eric D Vaughan
**/
#ifndef nsGridRowLayout_h___
#define nsGridRowLayout_h___
#include "mozilla/Attributes.h"
#include "nsSprocketLayout.h"
#include "nsIGridPart.h"
class nsGridRowGroupLayout;
class nsGridLayout2;
class nsBoxLayoutState;
class nsGrid;
/**
* A common base class for nsGridRowLeafLayout (the nsBoxLayout object
* for a grid row or column) and nsGridRowGroupLayout (the nsBoxLayout
* object for a grid row group or column group).
*/
// XXXldb This needs a name that indicates that it's a base class for
// both row and rows (row-group).
class nsGridRowLayout : public nsSprocketLayout, public nsIGridPart {
public:
NS_DECL_ISUPPORTS_INHERITED
virtual nsGridRowGroupLayout* CastToRowGroupLayout() override {
return nullptr;
}
virtual nsGridLayout2* CastToGridLayout() override { return nullptr; }
virtual nsGrid* GetGrid(nsIFrame* aBox, int32_t* aIndex,
nsGridRowLayout* aRequestor = nullptr) override;
virtual nsIGridPart* GetParentGridPart(nsIFrame* aBox,
nsIFrame** aParentBox) override;
virtual void ChildrenInserted(
nsIFrame* aBox, nsBoxLayoutState& aState, nsIFrame* aPrevBox,
const nsFrameList::Slice& aNewChildren) override;
virtual void ChildrenAppended(
nsIFrame* aBox, nsBoxLayoutState& aState,
const nsFrameList::Slice& aNewChildren) override;
virtual void ChildrenRemoved(nsIFrame* aBox, nsBoxLayoutState& aState,
nsIFrame* aChildList) override;
virtual void ChildrenSet(nsIFrame* aBox, nsBoxLayoutState& aState,
nsIFrame* aChildList) override;
virtual nsMargin GetTotalMargin(nsIFrame* aBox, bool aIsHorizontal) override;
virtual nsIGridPart* AsGridPart() override { return this; }
protected:
virtual void ChildAddedOrRemoved(nsIFrame* aBox,
nsBoxLayoutState& aState) = 0;
nsGridRowLayout();
virtual ~nsGridRowLayout();
};
#endif

View File

@ -1,85 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "mozilla/PresShell.h"
#include "nsGridRowLeafFrame.h"
#include "nsGridRowLeafLayout.h"
#include "nsGridRow.h"
#include "nsBoxLayoutState.h"
#include "nsGridLayout2.h"
using namespace mozilla;
already_AddRefed<nsBoxLayout> NS_NewGridRowLeafLayout();
nsIFrame* NS_NewGridRowLeafFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
nsCOMPtr<nsBoxLayout> layout = NS_NewGridRowLeafLayout();
return new (aPresShell)
nsGridRowLeafFrame(aStyle, aPresShell->GetPresContext(), false, layout);
}
NS_IMPL_FRAMEARENA_HELPERS(nsGridRowLeafFrame)
/*
* Our border and padding could be affected by our columns or rows.
* Let's go check it out.
*/
nsresult nsGridRowLeafFrame::GetXULBorderAndPadding(
nsMargin& aBorderAndPadding) {
// if our columns have made our padding larger add it in.
nsresult rv = nsBoxFrame::GetXULBorderAndPadding(aBorderAndPadding);
nsIGridPart* part = nsGrid::GetPartFromBox(this);
if (!part) return rv;
int32_t index = 0;
nsGrid* grid = part->GetGrid(this, &index);
if (!grid) return rv;
bool isHorizontal = IsXULHorizontal();
int32_t firstIndex = 0;
int32_t lastIndex = 0;
nsGridRow* firstRow = nullptr;
nsGridRow* lastRow = nullptr;
grid->GetFirstAndLastRow(firstIndex, lastIndex, firstRow, lastRow,
isHorizontal);
// only the first and last rows can be affected.
if (firstRow && firstRow->GetBox() == this) {
nscoord top = 0;
nscoord bottom = 0;
grid->GetRowOffsets(firstIndex, top, bottom, isHorizontal);
if (isHorizontal) {
if (top > aBorderAndPadding.top) aBorderAndPadding.top = top;
} else {
if (top > aBorderAndPadding.left) aBorderAndPadding.left = top;
}
}
if (lastRow && lastRow->GetBox() == this) {
nscoord top = 0;
nscoord bottom = 0;
grid->GetRowOffsets(lastIndex, top, bottom, isHorizontal);
if (isHorizontal) {
if (bottom > aBorderAndPadding.bottom) aBorderAndPadding.bottom = bottom;
} else {
if (bottom > aBorderAndPadding.right) aBorderAndPadding.right = bottom;
}
}
return rv;
}

View File

@ -1,54 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 D Vaughan
A frame that can have multiple children. Only one child may be displayed at
one time. So the can be flipped though like a deck of cards.
**/
#ifndef nsGridRowLeafFrame_h___
#define nsGridRowLeafFrame_h___
#include "mozilla/Attributes.h"
#include "nsBoxFrame.h"
namespace mozilla {
class PresShell;
} // namespace mozilla
/**
* A frame representing a grid row (or column). Grid row (and column)
* elements are the children of row group (or column group) elements,
* and their children are placed one to a cell.
*/
// XXXldb This needs a better name that indicates that it's for any grid
// row.
class nsGridRowLeafFrame : public nsBoxFrame {
public:
NS_DECL_FRAMEARENA_HELPERS(nsGridRowLeafFrame)
friend nsIFrame* NS_NewGridRowLeafFrame(mozilla::PresShell* aPresShell,
ComputedStyle* aStyle);
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(u"nsGridRowLeaf"_ns, aResult);
}
#endif
nsGridRowLeafFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
bool aIsRoot, nsBoxLayout* aLayoutManager,
ClassID aID = kClassID)
: nsBoxFrame(aStyle, aPresContext, aID, aIsRoot, aLayoutManager) {}
virtual nsresult GetXULBorderAndPadding(nsMargin& aBorderAndPadding) override;
}; // class nsGridRowLeafFrame
#endif

View File

@ -1,306 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "nsGridRowLeafLayout.h"
#include "nsGridRowGroupLayout.h"
#include "nsGridRow.h"
#include "nsBoxLayoutState.h"
#include "nsIScrollableFrame.h"
#include "nsBoxFrame.h"
#include "nsGridLayout2.h"
#include <algorithm>
already_AddRefed<nsBoxLayout> NS_NewGridRowLeafLayout() {
RefPtr<nsBoxLayout> layout = new nsGridRowLeafLayout();
return layout.forget();
}
nsGridRowLeafLayout::nsGridRowLeafLayout() : nsGridRowLayout() {}
nsGridRowLeafLayout::~nsGridRowLeafLayout() = default;
nsSize nsGridRowLeafLayout::GetXULPrefSize(nsIFrame* aBox,
nsBoxLayoutState& aState) {
int32_t index = 0;
nsGrid* grid = GetGrid(aBox, &index);
bool isHorizontal = IsXULHorizontal(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::GetXULPrefSize(aBox, aState);
} else {
return grid->GetPrefRowSize(aState, index, isHorizontal);
// AddXULBorderAndPadding(aBox, pref);
}
}
nsSize nsGridRowLeafLayout::GetXULMinSize(nsIFrame* aBox,
nsBoxLayoutState& aState) {
int32_t index = 0;
nsGrid* grid = GetGrid(aBox, &index);
bool isHorizontal = IsXULHorizontal(aBox);
if (!grid)
return nsGridRowLayout::GetXULMinSize(aBox, aState);
else {
nsSize minSize = grid->GetMinRowSize(aState, index, isHorizontal);
AddXULBorderAndPadding(aBox, minSize);
return minSize;
}
}
nsSize nsGridRowLeafLayout::GetXULMaxSize(nsIFrame* aBox,
nsBoxLayoutState& aState) {
int32_t index = 0;
nsGrid* grid = GetGrid(aBox, &index);
bool isHorizontal = IsXULHorizontal(aBox);
if (!grid)
return nsGridRowLayout::GetXULMaxSize(aBox, aState);
else {
nsSize maxSize;
maxSize = grid->GetMaxRowSize(aState, index, isHorizontal);
AddXULBorderAndPadding(aBox, maxSize);
return maxSize;
}
}
/** If a child is added or removed or changes size
*/
void nsGridRowLeafLayout::ChildAddedOrRemoved(nsIFrame* aBox,
nsBoxLayoutState& aState) {
int32_t index = 0;
nsGrid* grid = GetGrid(aBox, &index);
bool isHorizontal = IsXULHorizontal(aBox);
if (grid) grid->CellAddedOrRemoved(aState, index, isHorizontal);
}
void nsGridRowLeafLayout::PopulateBoxSizes(nsIFrame* aBox,
nsBoxLayoutState& aState,
nsBoxSize*& aBoxSizes,
nscoord& aMinSize, nscoord& aMaxSize,
int32_t& aFlexes) {
int32_t index = 0;
nsGrid* grid = GetGrid(aBox, &index);
bool isHorizontal = IsXULHorizontal(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;
int32_t count = grid->GetColumnCount(isHorizontal);
nsBoxSize* start = nullptr;
nsBoxSize* last = nullptr;
nsBoxSize* current = nullptr;
nsIFrame* child = nsIFrame::GetChildXULBox(aBox);
for (int i = 0; i < count; i++) {
column = grid->GetColumnAt(i, isHorizontal);
// make sure the value was computed before we use it.
// !isHorizontal is passed in to invert the behavior of these methods.
nscoord pref = grid->GetPrefRowHeight(
aState, i, !isHorizontal); // GetPrefColumnWidth
nscoord min =
grid->GetMinRowHeight(aState, i, !isHorizontal); // GetMinColumnWidth
nscoord max =
grid->GetMaxRowHeight(aState, i, !isHorizontal); // GetMaxColumnWidth
nscoord flex = grid->GetRowFlex(i, !isHorizontal); // GetColumnFlex
nscoord left = 0;
nscoord right = 0;
grid->GetRowOffsets(i, left, right, !isHorizontal); // GetColumnOffsets
nsIFrame* box = column->GetBox();
bool collapsed = false;
nscoord topMargin = column->mTopMargin;
nscoord bottomMargin = column->mBottomMargin;
if (box) collapsed = box->IsXULCollapsed();
pref = pref - (left + right);
if (pref < 0) pref = 0;
// if this is the first or last column. Take into account that
// our row could have a border that could affect our left or right
// padding from our columns. If the row has padding subtract it.
// would should always be able to garentee that our margin is smaller
// or equal to our left or right
int32_t firstIndex = 0;
int32_t lastIndex = 0;
nsGridRow* firstRow = nullptr;
nsGridRow* lastRow = nullptr;
grid->GetFirstAndLastRow(firstIndex, lastIndex, firstRow, lastRow,
!isHorizontal);
if (i == firstIndex || i == lastIndex) {
nsMargin offset = GetTotalMargin(aBox, isHorizontal);
nsMargin border(0, 0, 0, 0);
// can't call GetBorderPadding we will get into recursion
aBox->GetXULBorder(border);
offset += border;
aBox->GetXULPadding(border);
offset += border;
// subtract from out left and right
if (i == firstIndex) {
if (isHorizontal)
left -= offset.left;
else
left -= offset.top;
}
if (i == lastIndex) {
if (isHorizontal)
right -= offset.right;
else
right -= offset.bottom;
}
}
// initialize the box size here
max = std::max(min, max);
pref = nsIFrame::XULBoundsCheck(min, pref, max);
current = new (aState) nsBoxSize();
current->pref = pref;
current->min = min;
current->max = max;
current->flex = flex;
current->bogus = column->mIsBogus;
current->left = left + topMargin;
current->right = right + bottomMargin;
current->collapsed = collapsed;
if (!start) {
start = current;
last = start;
} else {
last->next = current;
last = current;
}
if (child && !column->mIsBogus) {
child = nsIFrame::GetNextXULBox(child);
}
}
aBoxSizes = start;
}
nsSprocketLayout::PopulateBoxSizes(aBox, aState, aBoxSizes, aMinSize,
aMaxSize, aFlexes);
}
void nsGridRowLeafLayout::ComputeChildSizes(
nsIFrame* aBox, nsBoxLayoutState& aState, nscoord& aGivenSize,
nsBoxSize* aBoxSizes, nsComputedBoxSize*& aComputedBoxSizes) {
// see if we are in a scrollable frame. If we are then there could be
// scrollbars present if so we need to subtract them out to make sure our
// columns line up.
if (aBox) {
bool isHorizontal = aBox->IsXULHorizontal();
// go up the parent chain looking for scrollframes
nscoord diff = 0;
nsIFrame* parentBox;
(void)GetParentGridPart(aBox, &parentBox);
while (parentBox) {
nsIFrame* scrollbox = nsGrid::GetScrollBox(parentBox);
nsIScrollableFrame* scrollable = do_QueryFrame(scrollbox);
if (scrollable) {
// Don't call GetActualScrollbarSizes here because it's not safe
// to call that while we're reflowing the contents of the scrollframe,
// which we are here.
nsMargin scrollbarSizes = scrollable->GetDesiredScrollbarSizes(&aState);
uint32_t visible = scrollable->GetScrollbarVisibility();
if (isHorizontal && (visible & nsIScrollableFrame::VERTICAL)) {
diff += scrollbarSizes.left + scrollbarSizes.right;
} else if (!isHorizontal &&
(visible & nsIScrollableFrame::HORIZONTAL)) {
diff += scrollbarSizes.top + scrollbarSizes.bottom;
}
}
(void)GetParentGridPart(parentBox, &parentBox);
}
if (diff > 0) {
aGivenSize += diff;
nsSprocketLayout::ComputeChildSizes(aBox, aState, aGivenSize, aBoxSizes,
aComputedBoxSizes);
aGivenSize -= diff;
nsComputedBoxSize* s = aComputedBoxSizes;
nsComputedBoxSize* last = aComputedBoxSizes;
while (s) {
last = s;
s = s->next;
}
if (last) last->size -= diff;
return;
}
}
nsSprocketLayout::ComputeChildSizes(aBox, aState, aGivenSize, aBoxSizes,
aComputedBoxSizes);
}
NS_IMETHODIMP
nsGridRowLeafLayout::XULLayout(nsIFrame* aBox,
nsBoxLayoutState& aBoxLayoutState) {
return nsGridRowLayout::XULLayout(aBox, aBoxLayoutState);
}
void nsGridRowLeafLayout::DirtyRows(nsIFrame* aBox, nsBoxLayoutState& aState) {
if (aBox) {
// mark us dirty
// XXXldb We probably don't want to walk up the ancestor chain
// calling MarkIntrinsicISizesDirty for every row.
aState.PresShell()->FrameNeedsReflow(
aBox, mozilla::IntrinsicDirty::TreeChange, NS_FRAME_IS_DIRTY);
}
}
void nsGridRowLeafLayout::CountRowsColumns(nsIFrame* aBox, int32_t& aRowCount,
int32_t& aComputedColumnCount) {
if (aBox) {
nsIFrame* child = nsIFrame::GetChildXULBox(aBox);
// count the children
int32_t columnCount = 0;
while (child) {
child = nsIFrame::GetNextXULBox(child);
columnCount++;
}
// if our count is greater than the current column count
if (columnCount > aComputedColumnCount) aComputedColumnCount = columnCount;
aRowCount++;
}
}
int32_t nsGridRowLeafLayout::BuildRows(nsIFrame* aBox, nsGridRow* aRows) {
if (aBox) {
aRows[0].Init(aBox, false);
return 1;
}
return 0;
}

View File

@ -1,62 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
/**
Author:
Eric D Vaughan
**/
#ifndef nsGridRowLeafLayout_h___
#define nsGridRowLeafLayout_h___
#include "mozilla/Attributes.h"
#include "nsGridRowLayout.h"
#include "nsCOMPtr.h"
/**
* The nsBoxLayout implementation for nsGridRowLeafFrame.
*/
// XXXldb This needs a better name that indicates that it's for any grid
// row.
class nsGridRowLeafLayout final : public nsGridRowLayout {
public:
friend already_AddRefed<nsBoxLayout> NS_NewGridRowLeafLayout();
virtual nsSize GetXULPrefSize(nsIFrame* aBox,
nsBoxLayoutState& aBoxLayoutState) override;
virtual nsSize GetXULMinSize(nsIFrame* aBox,
nsBoxLayoutState& aBoxLayoutState) override;
virtual nsSize GetXULMaxSize(nsIFrame* aBox,
nsBoxLayoutState& aBoxLayoutState) override;
virtual void ChildAddedOrRemoved(nsIFrame* aBox,
nsBoxLayoutState& aState) override;
NS_IMETHOD XULLayout(nsIFrame* aBox,
nsBoxLayoutState& aBoxLayoutState) override;
virtual void CountRowsColumns(nsIFrame* aBox, int32_t& aRowCount,
int32_t& aComputedColumnCount) override;
virtual void DirtyRows(nsIFrame* aBox, nsBoxLayoutState& aState) override;
virtual int32_t BuildRows(nsIFrame* aBox, nsGridRow* aRows) override;
virtual Type GetType() override { return eRowLeaf; }
protected:
virtual void PopulateBoxSizes(nsIFrame* aBox,
nsBoxLayoutState& aBoxLayoutState,
nsBoxSize*& aBoxSizes, nscoord& aMinSize,
nscoord& aMaxSize, int32_t& aFlexes) override;
virtual void ComputeChildSizes(
nsIFrame* aBox, nsBoxLayoutState& aState, nscoord& aGivenSize,
nsBoxSize* aBoxSizes, nsComputedBoxSize*& aComputedBoxSizes) override;
nsGridRowLeafLayout();
virtual ~nsGridRowLeafLayout();
// virtual void AddXULBorderAndPadding(nsIFrame* aBox, nsSize& aSize);
private:
}; // class nsGridRowLeafLayout
#endif

View File

@ -1,99 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef nsIGridPart_h___
#define nsIGridPart_h___
#include "nsISupports.h"
class nsGridRowGroupLayout;
class nsGrid;
class nsGridRowLayout;
class nsGridRow;
class nsGridLayout2;
// 07373ed7-e947-4a5e-b36c-69f7c195677b
#define NS_IGRIDPART_IID \
{ \
0x07373ed7, 0xe947, 0x4a5e, { \
0xb3, 0x6c, 0x69, 0xf7, 0xc1, 0x95, 0x67, 0x7b \
} \
}
/**
* An additional interface implemented by nsBoxLayout implementations
* for parts of a grid (excluding cells, which are not special).
*/
class nsIGridPart : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IGRIDPART_IID)
virtual nsGridRowGroupLayout* CastToRowGroupLayout() = 0;
virtual nsGridLayout2* CastToGridLayout() = 0;
/**
* @param aBox [IN] The other half of the |this| parameter, i.e., the box
* whose layout manager is |this|.
* @param aIndex [INOUT] For callers not setting aRequestor, the value
* pointed to by aIndex is incremented by the index
* of the row (aBox) within its row group; if aBox
* is not a row/column, it is untouched.
* The implementation does this by doing the aIndex
* incrementing in the call to the parent row group
* when aRequestor is non-null.
* @param aRequestor [IN] Non-null if and only if this is a recursive
* call from the GetGrid method on a child grid part,
* in which case it is a pointer to that grid part.
* (This may only be non-null for row groups and
* grids.)
* @return The grid of which aBox (a row, row group, or grid) is a part.
*/
virtual nsGrid* GetGrid(nsIFrame* aBox, int32_t* aIndex,
nsGridRowLayout* aRequestor = nullptr) = 0;
/**
* @param aBox [IN] The other half of the |this| parameter, i.e., the box
* whose layout manager is |this|.
* @param aParentBox [OUT] The box representing the next level up in
* the grid (i.e., row group for a row, grid for a
* row group).
* @returns The layout manager for aParentBox.
*/
virtual nsIGridPart* GetParentGridPart(nsIFrame* aBox,
nsIFrame** aParentBox) = 0;
/**
* @param aBox [IN] The other half of the |this| parameter, i.e., the box
* whose layout manager is |this|.
* @param aRowCount [INOUT] Row count
* @param aComputedColumnCount [INOUT] Column count
*/
virtual void CountRowsColumns(nsIFrame* aBox, int32_t& aRowCount,
int32_t& aComputedColumnCount) = 0;
virtual void DirtyRows(nsIFrame* aBox, nsBoxLayoutState& aState) = 0;
virtual int32_t BuildRows(nsIFrame* aBox, nsGridRow* aRows) = 0;
virtual nsMargin GetTotalMargin(nsIFrame* aBox, bool aIsHorizontal) = 0;
virtual int32_t GetRowCount() { return 1; }
/**
* Return the level of the grid hierarchy this grid part represents.
*/
enum Type { eGrid, eRowGroup, eRowLeaf };
virtual Type GetType() = 0;
/**
* Return whether this grid part is an appropriate parent for the argument.
*/
bool CanContain(nsIGridPart* aPossibleChild) {
Type thisType = GetType(), childType = aPossibleChild->GetType();
return thisType + 1 == childType ||
(thisType == eRowGroup && childType == eRowGroup);
}
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIGridPart, NS_IGRIDPART_IID)
#endif

View File

@ -1,13 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<hbox>
<vbox style="background:aqua">
<label value="Left" />
</vbox>
<vbox style="background:yellow">
<input xmlns="http://www.w3.org/1999/xhtml" value="Right" />
</vbox>
</hbox>
</window>

View File

@ -1,15 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<grid>
<columns>
<column style="background:aqua">
<label value="Left" />
</column>
<column style="background:yellow">
<input xmlns="http://www.w3.org/1999/xhtml" value="Right" />
</column>
</columns>
</grid>
</window>

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XUL Grid Test</title>
<style type="text/css">
html { background: black; }
html, body { margin: 0; padding: 0; height: 100%; }
div { position: absolute; }
</style>
</head>
<body>
<div style="background: rgb(0, 102, 153);
top: 0px; height: 200px; left: 0px; width: 200px;" />
<div style="background: rgb(0, 255, 0);
top: 200px; bottom: 0px; left: 0px; width: 100px;" />
<div style="background: rgb(0, 255, 0);
top: 200px; height: 100px; left: 100px; width: 100px;" />
<div style="background: rgb(0, 0, 153);
top: 0px; height: 100px; left: 200px; right: 0px;" />
<div style="background: rgb(0, 0, 153);
top: 100px; height: 100px; left: 200px; width: 100px;" />
</body>
</html>

View File

@ -1,45 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
window { background: black; }
hbox { height: 100px; width: 100px; }
]]></style>
<grid flex="1">
<columns>
<column style="background: rgb(0, 255, 0)">
<hbox />
<hbox />
<hbox />
</column>
<column>
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
</column>
<column>
<hbox />
<hbox />
<hbox />
</column>
</columns>
<rows>
<row style="background: rgba(0, 0, 255, 0.6)">
<hbox />
<hbox />
<hbox />
</row>
<row>
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
</row>
<row>
<hbox />
<hbox />
<hbox />
</row>
</rows>
</grid>
</window>

View File

@ -1,46 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
window { background: black; }
hbox { height: 100px; width: 100px; }
]]></style>
<!-- align and pack should be no-ops on grid element (not on columns/rows) -->
<grid flex="1" align="start" pack="end">
<columns>
<column style="background: rgb(0, 255, 0)">
<hbox />
<hbox />
<hbox />
</column>
<column>
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
</column>
<column>
<hbox />
<hbox />
<hbox />
</column>
</columns>
<rows>
<row style="background: rgba(0, 0, 255, 0.6)">
<hbox />
<hbox />
<hbox />
</row>
<row>
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
</row>
<row>
<hbox />
<hbox />
<hbox />
</row>
</rows>
</grid>
</window>

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XUL Grid Test</title>
<style type="text/css">
html { background: black; }
html, body { margin: 0; padding: 0; height: 100%; }
div { position: absolute; }
</style>
</head>
<body>
<div style="background: rgb(0, 102, 153);
top: 100px; height: 100px; left: 100px; width: 100px;" />
<div style="background: rgb(0, 255, 0);
top: 0px; height: 100px; left: 100px; width: 100px;" />
<div style="background: rgb(0, 255, 0);
top: 200px; height: 100px; left: 100px; width: 100px;" />
<div style="background: rgb(0, 0, 153);
top: 100px; height: 100px; left: 0px; width: 100px;" />
<div style="background: rgb(0, 0, 153);
top: 100px; height: 100px; left: 200px; width: 100px;" />
</body>
</html>

View File

@ -1,46 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
window { background: black; }
hbox { height: 100px; width: 100px; }
]]></style>
<grid flex="1">
<!-- does anybody actually *want* the way columns align="start" behaves here? -->
<columns align="start">
<column style="background: rgb(0, 255, 0)">
<hbox />
<hbox />
<hbox />
</column>
<column>
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
</column>
<column>
<hbox />
<hbox />
<hbox />
</column>
</columns>
<rows align="start">
<row style="background: rgba(0, 0, 255, 0.6)">
<hbox />
<hbox />
<hbox />
</row>
<row>
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
</row>
<row>
<hbox />
<hbox />
<hbox />
</row>
</rows>
</grid>
</window>

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XUL Grid Test</title>
<style type="text/css">
html { background: black; }
html, body { margin: 0; padding: 0; height: 100%; }
div { position: absolute; }
</style>
</head>
<body>
<div style="background: rgb(0, 102, 153);
bottom: 0px; height: 100px; right: 0px; width: 100px;" />
<div style="background: rgb(0, 0, 153);
bottom: 0px; height: 100px; left: 0px; right: 100px;" />
<div style="background: rgb(0, 0, 153);
bottom: 100px; height: 100px; left: 0px; width: 300px;" />
<div style="background: rgb(0, 255, 0);
top: 0px; bottom: 100px; right: 0px; width: 100px;" />
<div style="background: rgb(0, 255, 0);
top: 0px; height: 300px; right: 100px; width: 100px;" />
</body>
</html>

View File

@ -1,46 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
window { background: black; }
hbox { height: 100px; width: 100px; }
rows, columns { -moz-box-direction: reverse; }
]]></style>
<grid flex="1">
<columns>
<column style="background: rgb(0, 255, 0)">
<hbox />
<hbox />
<hbox />
</column>
<column>
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
</column>
<column>
<hbox />
<hbox />
<hbox />
</column>
</columns>
<rows>
<row style="background: rgba(0, 0, 255, 0.6)">
<hbox />
<hbox />
<hbox />
</row>
<row>
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
</row>
<row>
<hbox />
<hbox />
<hbox />
</row>
</rows>
</grid>
</window>

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XUL Grid Test</title>
<style type="text/css">
html { background: black; }
html, body { margin: 0; padding: 0; height: 100%; }
div { position: absolute; }
</style>
</head>
<body>
<div style="background: rgb(0, 102, 153);
bottom: 200px; height: 100px; right: 200px; width: 100px;" />
<div style="background: rgb(0, 0, 153);
bottom: 200px; height: 100px; left: 0px; right: 300px;" />
<div style="background: rgb(0, 0, 153);
bottom: 100px; height: 100px; left: 0px; width: 300px;" />
<div style="background: rgb(0, 0, 153);
bottom: 200px; height: 100px; right: 0px; width: 200px;" />
<div style="background: rgb(0, 255, 0);
top: 0px; bottom: 300px; right: 200px; width: 100px;" />
<div style="background: rgb(0, 255, 0);
top: 0px; height: 300px; right: 100px; width: 100px;" />
<div style="background: rgb(0, 255, 0);
bottom: 0px; height: 200px; right: 200px; width: 100px;" />
</body>
</html>

View File

@ -1,46 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
window { background: black; }
hbox { height: 100px; width: 100px; }
rows, columns { -moz-box-pack: end; }
]]></style>
<grid flex="1">
<columns>
<column style="background: rgb(0, 255, 0)">
<hbox />
<hbox />
<hbox />
</column>
<column>
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
</column>
<column>
<hbox />
<hbox />
<hbox />
</column>
</columns>
<rows>
<row style="background: rgba(0, 0, 255, 0.6)">
<hbox />
<hbox />
<hbox />
</row>
<row>
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
</row>
<row>
<hbox />
<hbox />
<hbox />
</row>
</rows>
</grid>
</window>

View File

@ -1,46 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
window { background: black; }
hbox { height: 100px; width: 100px; }
row, column { -moz-box-align: start; }
]]></style>
<grid flex="1">
<columns>
<column style="background: rgb(0, 255, 0)">
<hbox />
<hbox />
<hbox />
</column>
<column>
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
</column>
<column>
<hbox />
<hbox />
<hbox />
</column>
</columns>
<rows>
<row style="background: rgba(0, 0, 255, 0.6)">
<hbox />
<hbox />
<hbox />
</row>
<row>
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
</row>
<row>
<hbox />
<hbox />
<hbox />
</row>
</rows>
</grid>
</window>

View File

@ -1,46 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
window { background: black; }
hbox { height: 100px; width: 100px; }
row, column { -moz-box-direction: reverse; }
]]></style>
<grid flex="1">
<columns>
<column style="background: rgb(0, 255, 0)">
<hbox />
<hbox />
<hbox />
</column>
<column>
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
</column>
<column>
<hbox />
<hbox />
<hbox />
</column>
</columns>
<rows>
<row style="background: rgba(0, 0, 255, 0.6)">
<hbox />
<hbox />
<hbox />
</row>
<row>
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
</row>
<row>
<hbox />
<hbox />
<hbox />
</row>
</rows>
</grid>
</window>

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XUL Grid Test</title>
<style type="text/css">
html { background: black; }
html, body { margin: 0; padding: 0; height: 100%; }
div { position: absolute; }
</style>
</head>
<body>
<div style="background: rgb(0, 102, 153);
top: 0px; height: 100px; left: 0px; width: 100px;" />
<div style="background: rgb(0, 255, 0);
top: 100px; bottom: 0px; left: 0px; width: 100px;" />
<div style="background: rgb(0, 255, 0);
bottom: 0px; height: 300px; left: 100px; width: 100px;" />
<div style="background: rgb(0, 0, 153);
top: 0px; height: 100px; left: 100px; right: 0px;" />
<div style="background: rgb(0, 0, 153);
top: 100px; height: 100px; right: 0px; width: 300px;" />
</body>
</html>

View File

@ -1,46 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
window { background: black; }
hbox { height: 100px; width: 100px; }
row, column { -moz-box-pack: end; }
]]></style>
<grid flex="1">
<columns>
<column style="background: rgb(0, 255, 0)">
<hbox />
<hbox />
<hbox />
</column>
<column>
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
</column>
<column>
<hbox />
<hbox />
<hbox />
</column>
</columns>
<rows>
<row style="background: rgba(0, 0, 255, 0.6)">
<hbox />
<hbox />
<hbox />
</row>
<row>
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
</row>
<row>
<hbox />
<hbox />
<hbox />
</row>
</rows>
</grid>
</window>

View File

@ -1,18 +0,0 @@
== chrome://reftest/content/grid/row-sizing-1.xhtml chrome://reftest/content/grid/row-sizing-1-ref.xhtml
== chrome://reftest/content/grid/column-sizing-1.xhtml chrome://reftest/content/grid/column-sizing-1-ref.xhtml
== chrome://reftest/content/grid/row-or-column-sizing-1.xhtml chrome://reftest/content/grid/row-or-column-sizing-2.xhtml
== chrome://reftest/content/grid/row-or-column-sizing-1.xhtml chrome://reftest/content/grid/row-or-column-sizing-3.xhtml
== chrome://reftest/content/grid/row-or-column-sizing-1.xhtml chrome://reftest/content/grid/row-or-column-sizing-4.xhtml
fuzzy-if(skiaContent,0-1,0-60000) == chrome://reftest/content/grid/z-order-1.xhtml chrome://reftest/content/grid/z-order-1-ref.xhtml
fuzzy-if(skiaContent,0-1,0-60000) == chrome://reftest/content/grid/z-order-2.xhtml chrome://reftest/content/grid/z-order-2-ref.xhtml
fuzzy-if(skiaContent,0-1,0-60000) == chrome://reftest/content/grid/not-full-basic.xhtml not-full-basic-ref.xhtml
fuzzy-if(skiaContent,0-1,0-110000) == chrome://reftest/content/grid/not-full-grid-pack-align.xhtml not-full-basic-ref.xhtml
fuzzy-if(skiaContent,0-1,0-30000) == chrome://reftest/content/grid/not-full-row-group-align.xhtml not-full-row-group-align-ref.xhtml # does anyone want/need this behavior?
fuzzy-if(skiaContent,0-1,0-10000) == chrome://reftest/content/grid/not-full-row-group-pack.xhtml not-full-row-group-pack-ref.xhtml
fuzzy-if(skiaContent,0-1,0-50000) == chrome://reftest/content/grid/not-full-row-group-direction.xhtml not-full-row-group-direction-ref.xhtml
fuzzy-if(skiaContent,0-1,0-60000) == chrome://reftest/content/grid/not-full-row-leaf-align.xhtml not-full-basic-ref.xhtml
fuzzy-if(skiaContent,0-1,0-50000) == chrome://reftest/content/grid/not-full-row-leaf-pack.xhtml not-full-row-leaf-pack-ref.xhtml
fuzzy-if(skiaContent,0-1,0-80000) == chrome://reftest/content/grid/not-full-row-leaf-direction.xhtml not-full-row-leaf-pack-ref.xhtml
random-if(transparentScrollbars) fuzzy-if(OSX==1010,0-1,0-565) == chrome://reftest/content/grid/scrollable-columns.xhtml scrollable-columns-ref.xhtml # bug 650597
fails == chrome://reftest/content/grid/scrollable-rows.xhtml scrollable-rows-ref.xhtml
== chrome://reftest/content/grid/sizing-2d.xhtml chrome://reftest/content/grid/sizing-2d-ref.xhtml

View File

@ -1,21 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<grid>
<columns>
<column />
<column />
</columns>
<rows>
<row>
<hbox />
<label value="Upper right" />
</row>
<row>
<input xmlns="http://www.w3.org/1999/xhtml" value="Lower left" />
<hbox />
</row>
</rows>
</grid>
</window>

View File

@ -1,21 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<grid>
<columns>
<column>
<hbox />
<input xmlns="http://www.w3.org/1999/xhtml" value="Lower left" />
</column>
<column>
<label value="Upper right" />
<hbox />
</column>
</columns>
<rows>
<row />
<row />
</rows>
</grid>
</window>

View File

@ -1,27 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<grid>
<columns>
<column>
<hbox />
<hbox />
</column>
<column>
<label value="Upper right" />
<hbox />
</column>
</columns>
<rows>
<row>
<hbox />
<hbox />
</row>
<row>
<input xmlns="http://www.w3.org/1999/xhtml" value="Lower left" />
<hbox />
</row>
</rows>
</grid>
</window>

View File

@ -1,27 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<grid>
<columns>
<column>
<hbox />
<input xmlns="http://www.w3.org/1999/xhtml" value="Lower left" />
</column>
<column>
<hbox />
<hbox />
</column>
</columns>
<rows>
<row>
<hbox />
<label value="Upper right" />
</row>
<row>
<hbox />
<hbox />
</row>
</rows>
</grid>
</window>

View File

@ -1,14 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
orient="horizontal"
title="XUL Grid Test">
<vbox>
<hbox style="background:aqua">
<label value="Top" />
</hbox>
<hbox style="background:yellow">
<input xmlns="http://www.w3.org/1999/xhtml" value="Bottom" />
</hbox>
</vbox>
</window>

View File

@ -1,16 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
orient="horizontal"
title="XUL Grid Test">
<grid>
<rows>
<row style="background:aqua">
<label value="Top" />
</row>
<row style="background:yellow">
<input xmlns="http://www.w3.org/1999/xhtml" value="Bottom" />
</row>
</rows>
</grid>
</window>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XUL Grid Test</title>
<style type="text/css">
html { background: black; }
html, body { margin: 0; padding: 0; height: 100%; }
div { position: absolute; }
</style>
</head>
<body>
<div style="background: rgb(0, 102, 153);
top: 0px; height: 200px; left: 0px; width: 200px;" />
<div style="background: rgb(0, 255, 0); overflow: auto;
top: 200px; height: 100px; left: 0px; width: 200px;">
<div style="width: 300px; height: 50px" />
</div>
<div style="background: rgb(0, 0, 153);
top: 100px; height: 100px; left: 200px; width: 100px;" />
</body>
</html>

View File

@ -1,49 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
window { background: black; }
hbox { height: 100px; width: 100px; }
grid { width: 200px; height: 200px; }
columns { overflow: auto; }
]]></style>
<hbox>
<grid>
<columns>
<column style="background: rgb(0, 255, 0)">
<hbox />
<hbox />
<hbox />
</column>
<column>
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
</column>
<column>
<hbox />
<hbox />
<hbox />
</column>
</columns>
<rows>
<row style="background: rgba(0, 0, 255, 0.6)">
<hbox />
<hbox />
<hbox />
</row>
<row>
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
</row>
<row>
<hbox />
<hbox />
<hbox />
</row>
</rows>
</grid>
</hbox>
</window>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XUL Grid Test</title>
<style type="text/css">
html { background: black; }
html, body { margin: 0; padding: 0; height: 100%; }
div { position: absolute; }
</style>
</head>
<body>
<div style="background: rgb(0, 102, 153);
top: 0px; height: 200px; left: 0px; width: 200px;" />
<div style="background: rgb(0, 0, 153); overflow: auto;
top: 0px; height: 200px; left: 200px; width: 100px;">
<div style="width: 50px; height: 300px" />
</div>
<div style="background: rgb(0, 255, 0);
top: 200px; height: 100px; left: 100px; width: 100px;" />
</body>
</html>

View File

@ -1,49 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
window { background: black; }
hbox { height: 100px; width: 100px; }
grid { width: 200px; height: 200px; }
rows { overflow: auto; }
]]></style>
<hbox>
<grid>
<columns>
<column style="background: rgb(0, 255, 0)">
<hbox />
<hbox />
<hbox />
</column>
<column>
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
</column>
<column>
<hbox />
<hbox />
<hbox />
</column>
</columns>
<rows>
<row style="background: rgba(0, 0, 255, 0.6)">
<hbox />
<hbox />
<hbox />
</row>
<row>
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
</row>
<row>
<hbox />
<hbox />
<hbox />
</row>
</rows>
</grid>
</hbox>
</window>

View File

@ -1,12 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" align="start">
<hbox>
<box style="background:aqua; width: 50px; height: 100px" />
<box style="background:fuchsia; width: 100px; height: 100px" />
</hbox>
<hbox>
<box style="background:yellow; width: 50px; height: 75px" />
<box style="background:blue; width: 100px; height: 75px" />
</hbox>
</window>

View File

@ -1,26 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" align="start">
<grid>
<rows>
<row>
<box style="width: 25px; height: 25px" />
<box />
</row>
<row>
<box />
<box style="width: 75px; height: 75px" />
</row>
</rows>
<columns>
<column>
<box style="background: aqua" />
<box style="background: yellow; width: 50px; height: 50px" />
</column>
<column>
<box style="background: fuchsia; width: 100px; height: 100px" />
<box style="background: blue" />
</column>
</columns>
</grid>
</window>

View File

@ -1,30 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
window { background: black; }
hbox { height: 100px; width: 100px; }
]]></style>
<hbox>
<grid>
<rows>
<row>
<hbox style="background: rgb(0, 102, 153)" />
<hbox style="background: rgb(0, 102, 153)" />
<hbox style="background: rgb(0, 0, 153)" />
</row>
<row>
<hbox style="background: rgb(0, 102, 153)" />
<hbox style="background: rgb(0, 102, 153)" />
<hbox style="background: rgb(0, 0, 153)" />
</row>
<row>
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 0, 0)" />
</row>
</rows>
</grid>
</hbox>
</window>

View File

@ -1,47 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
window { background: black; }
hbox { height: 100px; width: 100px; }
]]></style>
<hbox>
<grid>
<columns>
<column style="background: rgb(0, 255, 0)">
<hbox />
<hbox />
<hbox />
</column>
<column>
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
</column>
<column>
<hbox />
<hbox />
<hbox />
</column>
</columns>
<rows>
<row style="background: rgba(0, 0, 255, 0.6)">
<hbox />
<hbox />
<hbox />
</row>
<row>
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
</row>
<row>
<hbox />
<hbox />
<hbox />
</row>
</rows>
</grid>
</hbox>
</window>

View File

@ -1,30 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
window { background: black; }
hbox { height: 100px; width: 100px; }
]]></style>
<hbox>
<grid>
<rows>
<row>
<hbox style="background: rgb(0, 102, 153)" />
<hbox style="background: rgb(0, 102, 153)" />
<hbox style="background: rgb(0, 255, 0)" />
</row>
<row>
<hbox style="background: rgb(0, 102, 153)" />
<hbox style="background: rgb(0, 102, 153)" />
<hbox style="background: rgb(0, 255, 0)" />
</row>
<row>
<hbox style="background: rgb(0, 0, 153)" />
<hbox style="background: rgb(0, 0, 153)" />
<hbox style="background: rgb(0, 0, 0)" />
</row>
</rows>
</grid>
</hbox>
</window>

View File

@ -1,47 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE window>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL Grid Test">
<style xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
window { background: black; }
hbox { height: 100px; width: 100px; }
]]></style>
<hbox>
<grid>
<rows>
<row style="background: rgb(0, 255, 0)">
<hbox />
<hbox />
<hbox />
</row>
<row>
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
<hbox style="background: rgb(0, 255, 0)" />
</row>
<row>
<hbox />
<hbox />
<hbox />
</row>
</rows>
<columns>
<column style="background: rgba(0, 0, 255, 0.6)">
<hbox />
<hbox />
<hbox />
</column>
<column>
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
<hbox style="background: rgba(0, 0, 255, 0.6)" />
</column>
<column>
<hbox />
<hbox />
<hbox />
</column>
</columns>
</grid>
</hbox>
</window>

View File

@ -58,7 +58,7 @@ if CONFIG["MOZ_XUL"]:
]
if CONFIG["MOZ_XUL"]:
DIRS += ["tree", "grid"]
DIRS += ["tree"]
CFLAGS += CONFIG["TK_CFLAGS"]
CXXFLAGS += CONFIG["TK_CFLAGS"]

View File

@ -23,8 +23,6 @@ struct nsMargin;
} \
}
class nsIGridPart;
class nsBoxLayout : public nsISupports {
protected:
virtual ~nsBoxLayout() = default;
@ -60,8 +58,6 @@ class nsBoxLayout : public nsISupports {
virtual void AddXULMargin(nsIFrame* aChild, nsSize& aSize);
virtual void AddXULMargin(nsSize& aSize, const nsMargin& aMargin);
virtual nsIGridPart* AsGridPart() { return nullptr; }
static void AddLargestSize(nsSize& aSize, const nsSize& aToAdd);
static void AddSmallestSize(nsSize& aSize, const nsSize& aToAdd);
};

View File

@ -59,7 +59,6 @@ include ../../layout/style/crashtests/crashtests.list
include ../../layout/svg/crashtests/crashtests.list
include ../../layout/tables/crashtests/crashtests.list
include ../../layout/xul/crashtests/crashtests.list
include ../../layout/xul/grid/crashtests/crashtests.list
include ../../layout/xul/tree/crashtests/crashtests.list
include ../../media/libpng/crashtests/crashtests.list

View File

@ -102,7 +102,6 @@ file-whitespace:
- layout/tables/test/test_bug337124.html
- layout/tables/crashtests
- layout/xul/crashtests
- layout/xul/grid/crashtests
- layout/xul/reftest
- layout/xul/test
- layout/xul/tree