mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 481932 - use do_QueryFrame instead of IS_TABLE_CELL + cast; r+sr=roc
This commit is contained in:
parent
b8ff8885f8
commit
420adcef91
@ -1619,17 +1619,17 @@ PRBool nsCellMap::CellsSpanOut(nsTArray<nsTableRowFrame*>& aRows) const
|
||||
PRInt32 numNewRows = aRows.Length();
|
||||
for (PRInt32 rowX = 0; rowX < numNewRows; rowX++) {
|
||||
nsIFrame* rowFrame = (nsIFrame *) aRows.ElementAt(rowX);
|
||||
nsIFrame* cellFrame = rowFrame->GetFirstChild(nsnull);
|
||||
while (cellFrame) {
|
||||
if (IS_TABLE_CELL(cellFrame->GetType())) {
|
||||
nsIFrame* childFrame = rowFrame->GetFirstChild(nsnull);
|
||||
while (childFrame) {
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
|
||||
if (cellFrame) {
|
||||
PRBool zeroSpan;
|
||||
PRInt32 rowSpan = GetRowSpanForNewCell((nsTableCellFrame*) cellFrame,
|
||||
rowX, zeroSpan);
|
||||
PRInt32 rowSpan = GetRowSpanForNewCell(cellFrame, rowX, zeroSpan);
|
||||
if (rowX + rowSpan > numNewRows) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
cellFrame = cellFrame->GetNextSibling();
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
@ -1796,8 +1796,9 @@ nsCellMap::ExpandWithRows(nsTableCellMap& aMap,
|
||||
nsIFrame* cFrame = rFrame->GetFirstChild(nsnull);
|
||||
PRInt32 colIndex = 0;
|
||||
while (cFrame) {
|
||||
if (IS_TABLE_CELL(cFrame->GetType())) {
|
||||
AppendCell(aMap, (nsTableCellFrame *)cFrame, rowX, PR_FALSE, aDamageArea, &colIndex);
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(cFrame);
|
||||
if (cellFrame) {
|
||||
AppendCell(aMap, cellFrame, rowX, PR_FALSE, aDamageArea, &colIndex);
|
||||
}
|
||||
cFrame = cFrame->GetNextSibling();
|
||||
}
|
||||
@ -2257,8 +2258,9 @@ nsCellMap::RebuildConsideringRows(nsTableCellMap& aMap,
|
||||
nsTableRowFrame* rFrame = aRowsToInsert->ElementAt(newRowX);
|
||||
nsIFrame* cFrame = rFrame->GetFirstChild(nsnull);
|
||||
while (cFrame) {
|
||||
if (IS_TABLE_CELL(cFrame->GetType())) {
|
||||
AppendCell(aMap, (nsTableCellFrame *)cFrame, rowX, PR_FALSE, aDamageArea);
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(cFrame);
|
||||
if (cellFrame) {
|
||||
AppendCell(aMap, cellFrame, rowX, PR_FALSE, aDamageArea);
|
||||
}
|
||||
cFrame = cFrame->GetNextSibling();
|
||||
}
|
||||
|
@ -87,8 +87,9 @@ nsTableCellFrame::GetNextCell() const
|
||||
{
|
||||
nsIFrame* childFrame = GetNextSibling();
|
||||
while (childFrame) {
|
||||
if (IS_TABLE_CELL(childFrame->GetType())) {
|
||||
return (nsTableCellFrame*)childFrame;
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
|
||||
if (cellFrame) {
|
||||
return cellFrame;
|
||||
}
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
}
|
||||
@ -1022,6 +1023,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
|
||||
/* ----- global methods ----- */
|
||||
|
||||
NS_QUERYFRAME_HEAD(nsTableCellFrame)
|
||||
NS_QUERYFRAME_ENTRY(nsTableCellFrame)
|
||||
NS_QUERYFRAME_ENTRY(nsITableCellLayout)
|
||||
NS_QUERYFRAME_ENTRY(nsIPercentHeightObserver)
|
||||
NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame)
|
||||
|
@ -73,6 +73,7 @@ class nsTableCellFrame : public nsHTMLContainerFrame,
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECLARE_FRAME_ACCESSOR(nsTableCellFrame)
|
||||
NS_DECL_QUERYFRAME
|
||||
|
||||
// default constructor supplied by the compiler
|
||||
|
@ -390,13 +390,13 @@ void nsTableFrame::AttributeChangedFor(nsIFrame* aFrame,
|
||||
nsIContent* aContent,
|
||||
nsIAtom* aAttribute)
|
||||
{
|
||||
if (IS_TABLE_CELL(aFrame->GetType())) {
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(aFrame);
|
||||
if (cellFrame) {
|
||||
if ((nsGkAtoms::rowspan == aAttribute) ||
|
||||
(nsGkAtoms::colspan == aAttribute)) {
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (cellMap) {
|
||||
// for now just remove the cell from the map and reinsert it
|
||||
nsTableCellFrame* cellFrame = (nsTableCellFrame*)aFrame;
|
||||
PRInt32 rowIndex, colIndex;
|
||||
cellFrame->GetRowIndex(rowIndex);
|
||||
cellFrame->GetColIndex(colIndex);
|
||||
@ -1052,8 +1052,8 @@ void nsTableFrame::RemoveRows(nsTableRowFrame& aFirstRowFrame,
|
||||
PRBool stopTelling = PR_FALSE;
|
||||
for (nsIFrame* kidFrame = aFirstFrame.FirstChild(); (kidFrame && !stopAsking);
|
||||
kidFrame = kidFrame->GetNextSibling()) {
|
||||
if (IS_TABLE_CELL(kidFrame->GetType())) {
|
||||
nsTableCellFrame* cellFrame = (nsTableCellFrame*)kidFrame;
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
|
||||
if (cellFrame) {
|
||||
stopTelling = tableFrame->CellChangedWidth(*cellFrame, cellFrame->GetPass1MaxElementWidth(),
|
||||
cellFrame->GetMaximumWidth(), PR_TRUE);
|
||||
}
|
||||
@ -1131,8 +1131,9 @@ nsTableFrame::CollectRows(nsIFrame* aFrame,
|
||||
if (rgFrame) {
|
||||
nsIFrame* childFrame = rgFrame->GetFirstChild(nsnull);
|
||||
while (childFrame) {
|
||||
if (nsGkAtoms::tableRowFrame == childFrame->GetType()) {
|
||||
aCollection.AppendElement(static_cast<nsTableRowFrame*>(childFrame));
|
||||
nsTableRowFrame *rowFrame = do_QueryFrame(childFrame);
|
||||
if (rowFrame) {
|
||||
aCollection.AppendElement(rowFrame);
|
||||
numRows++;
|
||||
}
|
||||
else {
|
||||
@ -1600,8 +1601,8 @@ nsTableFrame::ProcessRowInserted(nscoord aNewHeight)
|
||||
nsIFrame* childFrame = rgFrame->GetFirstChild(nsnull);
|
||||
// find the row that was inserted first
|
||||
while (childFrame) {
|
||||
if (nsGkAtoms::tableRowFrame == childFrame->GetType()) {
|
||||
nsTableRowFrame* rowFrame = (nsTableRowFrame*)childFrame;
|
||||
nsTableRowFrame *rowFrame = do_QueryFrame(childFrame);
|
||||
if (rowFrame) {
|
||||
if (rowFrame->IsFirstInserted()) {
|
||||
rowFrame->SetFirstInserted(PR_FALSE);
|
||||
// damage the table from the 1st row inserted to the end of the table
|
||||
@ -3756,25 +3757,27 @@ nsTableFrame::DumpRowGroup(nsIFrame* aKidFrame)
|
||||
{
|
||||
nsTableRowGroupFrame* rgFrame = GetRowGroupFrame(aKidFrame);
|
||||
if (rgFrame) {
|
||||
nsIFrame* rowFrame = rgFrame->GetFirstChild(nsnull);
|
||||
while (rowFrame) {
|
||||
if (nsGkAtoms::tableRowFrame == rowFrame->GetType()) {
|
||||
printf("row(%d)=%p ", ((nsTableRowFrame*)rowFrame)->GetRowIndex(), rowFrame);
|
||||
nsIFrame* cellFrame = rowFrame->GetFirstChild(nsnull);
|
||||
while (cellFrame) {
|
||||
if (IS_TABLE_CELL(cellFrame->GetType())) {
|
||||
nsIFrame* cFrame = rgFrame->GetFirstChild(nsnull);
|
||||
while (cFrame) {
|
||||
nsTableRowFrame *rowFrame = do_QueryFrame(cFrame);
|
||||
if (rowFrame) {
|
||||
printf("row(%d)=%p ", rowFrame->GetRowIndex(), rowFrame);
|
||||
nsIFrame* childFrame = cFrame->GetFirstChild(nsnull);
|
||||
while (childFrame) {
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
|
||||
if (cellFrame) {
|
||||
PRInt32 colIndex;
|
||||
((nsTableCellFrame*)cellFrame)->GetColIndex(colIndex);
|
||||
printf("cell(%d)=%p ", colIndex, cellFrame);
|
||||
cellFrame->GetColIndex(colIndex);
|
||||
printf("cell(%d)=%p ", colIndex, childFrame);
|
||||
}
|
||||
cellFrame = cellFrame->GetNextSibling();
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
else {
|
||||
DumpRowGroup(rowFrame);
|
||||
}
|
||||
rowFrame = rowFrame->GetNextSibling();
|
||||
cFrame = cFrame->GetNextSibling();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -143,6 +143,10 @@ nsTableRowFrame::SetPctHeight(float aPctValue,
|
||||
|
||||
/* ----------- nsTableRowFrame ---------- */
|
||||
|
||||
NS_QUERYFRAME_HEAD(nsTableRowFrame)
|
||||
NS_QUERYFRAME_ENTRY(nsTableRowFrame)
|
||||
NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame)
|
||||
|
||||
nsTableRowFrame::nsTableRowFrame(nsStyleContext* aContext)
|
||||
: nsHTMLContainerFrame(aContext)
|
||||
{
|
||||
@ -206,9 +210,10 @@ nsTableRowFrame::AppendFrames(nsIAtom* aListName,
|
||||
nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
|
||||
for (nsIFrame* childFrame = aFrameList; childFrame;
|
||||
childFrame = childFrame->GetNextSibling()) {
|
||||
if (IS_TABLE_CELL(childFrame->GetType())) {
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
|
||||
if (cellFrame) {
|
||||
// Add the cell to the cell map
|
||||
tableFrame->AppendCell((nsTableCellFrame&)*childFrame, GetRowIndex());
|
||||
tableFrame->AppendCell(*cellFrame, GetRowIndex());
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,8 +243,9 @@ nsTableRowFrame::InsertFrames(nsIAtom* aListName,
|
||||
nsTArray<nsTableCellFrame*> cellChildren;
|
||||
for (nsIFrame* childFrame = aFrameList; childFrame;
|
||||
childFrame = childFrame->GetNextSibling()) {
|
||||
if (IS_TABLE_CELL(childFrame->GetType())) {
|
||||
cellChildren.AppendElement(static_cast<nsTableCellFrame*>(childFrame));
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
|
||||
if (cellFrame) {
|
||||
cellChildren.AppendElement(cellFrame);
|
||||
}
|
||||
}
|
||||
// insert the cells into the cell map
|
||||
@ -267,8 +273,8 @@ nsTableRowFrame::RemoveFrame(nsIAtom* aListName,
|
||||
|
||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||
if (tableFrame) {
|
||||
if (IS_TABLE_CELL(aOldFrame->GetType())) {
|
||||
nsTableCellFrame* cellFrame = (nsTableCellFrame*)aOldFrame;
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(aOldFrame);
|
||||
if (cellFrame) {
|
||||
PRInt32 colIndex;
|
||||
cellFrame->GetColIndex(colIndex);
|
||||
// remove the cell from the cell map
|
||||
@ -334,8 +340,9 @@ nsTableRowFrame::GetFirstCell()
|
||||
{
|
||||
nsIFrame* childFrame = mFrames.FirstChild();
|
||||
while (childFrame) {
|
||||
if (IS_TABLE_CELL(childFrame->GetType())) {
|
||||
return (nsTableCellFrame*)childFrame;
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
|
||||
if (cellFrame) {
|
||||
return cellFrame;
|
||||
}
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
}
|
||||
@ -363,8 +370,8 @@ nsTableRowFrame::DidResize()
|
||||
desiredSize.height);
|
||||
|
||||
while (childFrame) {
|
||||
if (IS_TABLE_CELL(childFrame->GetType())) {
|
||||
nsTableCellFrame* cellFrame = (nsTableCellFrame*)childFrame;
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
|
||||
if (cellFrame) {
|
||||
nscoord cellHeight = mRect.height + GetHeightOfRowsSpannedBelowFirst(*cellFrame, *tableFrame);
|
||||
|
||||
// resize the cell's height
|
||||
@ -535,9 +542,10 @@ nsTableRowFrame::CalcHeight(const nsHTMLReflowState& aReflowState)
|
||||
|
||||
for (nsIFrame* kidFrame = mFrames.FirstChild(); kidFrame;
|
||||
kidFrame = kidFrame->GetNextSibling()) {
|
||||
if (IS_TABLE_CELL(kidFrame->GetType())) {
|
||||
nscoord availWidth = ((nsTableCellFrame *)kidFrame)->GetPriorAvailWidth();
|
||||
nsSize desSize = ((nsTableCellFrame *)kidFrame)->GetDesiredSize();
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
|
||||
if (cellFrame) {
|
||||
nscoord availWidth = cellFrame->GetPriorAvailWidth();
|
||||
nsSize desSize = cellFrame->GetDesiredSize();
|
||||
if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) && !GetPrevInFlow()) {
|
||||
CalculateCellActualSize(kidFrame, desSize.width, desSize.height, availWidth);
|
||||
}
|
||||
@ -546,9 +554,9 @@ nsTableRowFrame::CalcHeight(const nsHTMLReflowState& aReflowState)
|
||||
if (!kidFrame->GetFirstChild(nsnull)->GetFirstChild(nsnull))
|
||||
ascent = desSize.height;
|
||||
else
|
||||
ascent = ((nsTableCellFrame *)kidFrame)->GetCellBaseline();
|
||||
ascent = cellFrame->GetCellBaseline();
|
||||
nscoord descent = desSize.height - ascent;
|
||||
UpdateHeight(desSize.height, ascent, descent, tableFrame, (nsTableCellFrame*)kidFrame);
|
||||
UpdateHeight(desSize.height, ascent, descent, tableFrame, cellFrame);
|
||||
}
|
||||
}
|
||||
return GetHeight();
|
||||
@ -808,8 +816,8 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
|
||||
|
||||
// Reflow each of our existing cell frames
|
||||
for (nsIFrame* kidFrame = iter.First(); kidFrame; kidFrame = iter.Next()) {
|
||||
nsIAtom* frameType = kidFrame->GetType();
|
||||
if (!IS_TABLE_CELL(frameType)) {
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
|
||||
if (!cellFrame) {
|
||||
// XXXldb nsCSSFrameConstructor needs to enforce this!
|
||||
NS_NOTREACHED("yikes, a non-row child");
|
||||
|
||||
@ -825,8 +833,6 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
|
||||
continue;
|
||||
}
|
||||
|
||||
nsTableCellFrame* cellFrame = static_cast<nsTableCellFrame*>(kidFrame);
|
||||
|
||||
// See if we should only reflow the dirty child frames
|
||||
PRBool doReflowChild = PR_TRUE;
|
||||
if (!aReflowState.ShouldReflowAllKids() &&
|
||||
@ -1193,9 +1199,8 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
|
||||
|
||||
nsIFrame* kidFrame = iter.First();
|
||||
while (kidFrame) {
|
||||
nsIAtom* frameType = kidFrame->GetType();
|
||||
if (IS_TABLE_CELL(frameType)) {
|
||||
nsTableCellFrame* cellFrame = (nsTableCellFrame*)kidFrame;
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
|
||||
if (cellFrame) {
|
||||
PRInt32 cellColIndex;
|
||||
cellFrame->GetColIndex(cellColIndex);
|
||||
PRInt32 cellColSpan = tableFrame->GetEffectiveColSpan(*cellFrame);
|
||||
@ -1324,8 +1329,8 @@ nsTableRowFrame::InsertCellFrame(nsTableCellFrame* aFrame,
|
||||
nsTableCellFrame* priorCell = nsnull;
|
||||
for (nsIFrame* child = mFrames.FirstChild(); child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (!IS_TABLE_CELL(child->GetType())) {
|
||||
nsTableCellFrame* cellFrame = (nsTableCellFrame*)child;
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(child);
|
||||
if (cellFrame) {
|
||||
PRInt32 colIndex;
|
||||
cellFrame->GetColIndex(colIndex);
|
||||
if (colIndex < aColIndex) {
|
||||
@ -1355,9 +1360,10 @@ nsTableRowFrame::GetNextRow() const
|
||||
{
|
||||
nsIFrame* childFrame = GetNextSibling();
|
||||
while (childFrame) {
|
||||
if (nsGkAtoms::tableRowFrame == childFrame->GetType()) {
|
||||
nsTableRowFrame *rowFrame = do_QueryFrame(childFrame);
|
||||
if (rowFrame) {
|
||||
NS_ASSERTION(NS_STYLE_DISPLAY_TABLE_ROW == childFrame->GetStyleDisplay()->mDisplay, "wrong display type on rowframe");
|
||||
return (nsTableRowFrame*)childFrame;
|
||||
return rowFrame;
|
||||
}
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
}
|
||||
@ -1415,12 +1421,11 @@ void nsTableRowFrame::InitHasCellWithStyleHeight(nsTableFrame* aTableFrame)
|
||||
nsTableIterator iter(*this);
|
||||
|
||||
for (nsIFrame* kidFrame = iter.First(); kidFrame; kidFrame = iter.Next()) {
|
||||
nsIAtom* frameType = kidFrame->GetType();
|
||||
if (!IS_TABLE_CELL(frameType)) {
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
|
||||
if (!cellFrame) {
|
||||
NS_NOTREACHED("Table row has a non-cell child.");
|
||||
continue;
|
||||
}
|
||||
nsTableCellFrame* cellFrame = static_cast<nsTableCellFrame*>(kidFrame);
|
||||
// Ignore row-spanning cells
|
||||
if (aTableFrame->GetEffectiveRowSpan(*cellFrame) == 1 &&
|
||||
cellFrame->GetStylePosition()->mHeight.GetUnit() != eStyleUnit_Auto) {
|
||||
|
@ -67,6 +67,10 @@ struct nsTableCellReflowState;
|
||||
class nsTableRowFrame : public nsHTMLContainerFrame
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECLARE_FRAME_ACCESSOR(nsTableRowFrame)
|
||||
NS_DECL_QUERYFRAME
|
||||
|
||||
virtual ~nsTableRowFrame();
|
||||
|
||||
NS_IMETHOD Init(nsIContent* aContent,
|
||||
|
@ -325,8 +325,8 @@ nsTableRowGroupFrame::InitChildReflowState(nsPresContext& aPresContext,
|
||||
nsMargin* pCollapseBorder = nsnull;
|
||||
if (aBorderCollapse) {
|
||||
if (aReflowState.frame) {
|
||||
if (nsGkAtoms::tableRowFrame == aReflowState.frame->GetType()) {
|
||||
nsTableRowFrame* rowFrame = (nsTableRowFrame*)aReflowState.frame;
|
||||
nsTableRowFrame *rowFrame = do_QueryFrame(aReflowState.frame);
|
||||
if (rowFrame) {
|
||||
pCollapseBorder = rowFrame->GetBCBorderWidth(collapseBorder);
|
||||
}
|
||||
}
|
||||
@ -378,7 +378,8 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
|
||||
nsIFrame *prevKidFrame = nsnull;
|
||||
for (nsIFrame* kidFrame = GetFirstFrame(); kidFrame;
|
||||
prevKidFrame = kidFrame, kidFrame = kidFrame->GetNextSibling()) {
|
||||
if (kidFrame->GetType() != nsGkAtoms::tableRowFrame) {
|
||||
nsTableRowFrame *rowFrame = do_QueryFrame(kidFrame);
|
||||
if (!rowFrame) {
|
||||
// XXXldb nsCSSFrameConstructor needs to enforce this!
|
||||
NS_NOTREACHED("yikes, a non-row child");
|
||||
continue;
|
||||
@ -433,7 +434,7 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
|
||||
if (!reflowAllKids) {
|
||||
if (IsSimpleRowFrame(aReflowState.tableFrame, kidFrame)) {
|
||||
// Inform the row of its new height.
|
||||
((nsTableRowFrame*)kidFrame)->DidResize();
|
||||
rowFrame->DidResize();
|
||||
// the overflow area may have changed inflate the overflow area
|
||||
const nsStylePosition *stylePos = GetStylePosition();
|
||||
nsStyleUnit unit = stylePos->mHeight.GetUnit();
|
||||
@ -461,7 +462,7 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
if (isPaginated && aPageBreakBeforeEnd && !*aPageBreakBeforeEnd) {
|
||||
nsTableRowFrame* nextRow = ((nsTableRowFrame*)kidFrame)->GetNextRow();
|
||||
nsTableRowFrame* nextRow = rowFrame->GetNextRow();
|
||||
if (nextRow) {
|
||||
*aPageBreakBeforeEnd = nsTableFrame::PageBreakAfter(*kidFrame, nextRow);
|
||||
}
|
||||
@ -512,8 +513,9 @@ nsTableRowGroupFrame::GetFirstRow()
|
||||
{
|
||||
for (nsIFrame* childFrame = GetFirstFrame(); childFrame;
|
||||
childFrame = childFrame->GetNextSibling()) {
|
||||
if (nsGkAtoms::tableRowFrame == childFrame->GetType()) {
|
||||
return (nsTableRowFrame*)childFrame;
|
||||
nsTableRowFrame *rowFrame = do_QueryFrame(childFrame);
|
||||
if (rowFrame) {
|
||||
return rowFrame;
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
@ -1393,13 +1395,14 @@ nsTableRowGroupFrame::AppendFrames(nsIAtom* aListName,
|
||||
|
||||
// collect the new row frames in an array
|
||||
nsAutoTArray<nsTableRowFrame*, 8> rows;
|
||||
for (nsIFrame* rowFrame = aFrameList; rowFrame;
|
||||
rowFrame = rowFrame->GetNextSibling()) {
|
||||
if (nsGkAtoms::tableRowFrame == rowFrame->GetType()) {
|
||||
for (nsIFrame* childFrame = aFrameList; childFrame;
|
||||
childFrame = childFrame->GetNextSibling()) {
|
||||
nsTableRowFrame *rowFrame = do_QueryFrame(childFrame);
|
||||
if (rowFrame) {
|
||||
NS_ASSERTION(NS_STYLE_DISPLAY_TABLE_ROW ==
|
||||
rowFrame->GetStyleDisplay()->mDisplay,
|
||||
childFrame->GetStyleDisplay()->mDisplay,
|
||||
"wrong display type on rowframe");
|
||||
rows.AppendElement(static_cast<nsTableRowFrame*>(rowFrame));
|
||||
rows.AppendElement(rowFrame);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1439,15 +1442,16 @@ nsTableRowGroupFrame::InsertFrames(nsIAtom* aListName,
|
||||
// collect the new row frames in an array
|
||||
nsTArray<nsTableRowFrame*> rows;
|
||||
PRBool gotFirstRow = PR_FALSE;
|
||||
for (nsIFrame* rowFrame = aFrameList; rowFrame;
|
||||
rowFrame = rowFrame->GetNextSibling()) {
|
||||
if (nsGkAtoms::tableRowFrame == rowFrame->GetType()) {
|
||||
for (nsIFrame* childFrame = aFrameList; childFrame;
|
||||
childFrame = childFrame->GetNextSibling()) {
|
||||
nsTableRowFrame *rowFrame = do_QueryFrame(childFrame);
|
||||
if (rowFrame) {
|
||||
NS_ASSERTION(NS_STYLE_DISPLAY_TABLE_ROW ==
|
||||
rowFrame->GetStyleDisplay()->mDisplay,
|
||||
childFrame->GetStyleDisplay()->mDisplay,
|
||||
"wrong display type on rowframe");
|
||||
rows.AppendElement(static_cast<nsTableRowFrame*>(rowFrame));
|
||||
rows.AppendElement(rowFrame);
|
||||
if (!gotFirstRow) {
|
||||
((nsTableRowFrame*)rowFrame)->SetFirstInserted(PR_TRUE);
|
||||
rowFrame->SetFirstInserted(PR_TRUE);
|
||||
gotFirstRow = PR_TRUE;
|
||||
tableFrame->SetRowInserted(PR_TRUE);
|
||||
}
|
||||
@ -1482,9 +1486,10 @@ nsTableRowGroupFrame::RemoveFrame(nsIAtom* aListName,
|
||||
|
||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||
if (tableFrame) {
|
||||
if (nsGkAtoms::tableRowFrame == aOldFrame->GetType()) {
|
||||
nsTableRowFrame *rowFrame = do_QueryFrame(aOldFrame);
|
||||
if (rowFrame) {
|
||||
// remove the rows from the table (and flag a rebalance)
|
||||
tableFrame->RemoveRows((nsTableRowFrame &)*aOldFrame, 1, PR_TRUE);
|
||||
tableFrame->RemoveRows(*rowFrame, 1, PR_TRUE);
|
||||
|
||||
PresContext()->PresShell()->
|
||||
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
||||
@ -1546,8 +1551,9 @@ nsTableRowGroupFrame::IsSimpleRowFrame(nsTableFrame* aTableFrame,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
// Make sure it's a row frame and not a row group frame
|
||||
if (aFrame->GetType() == nsGkAtoms::tableRowFrame) {
|
||||
PRInt32 rowIndex = ((nsTableRowFrame*)aFrame)->GetRowIndex();
|
||||
nsTableRowFrame *rowFrame = do_QueryFrame(aFrame);
|
||||
if (rowFrame) {
|
||||
PRInt32 rowIndex = rowFrame->GetRowIndex();
|
||||
|
||||
// It's a simple row frame if there are no cells that span into or
|
||||
// across the row
|
||||
@ -1685,10 +1691,9 @@ nsTableRowGroupFrame::FindLineContaining(nsIFrame* aFrame)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aFrame);
|
||||
|
||||
NS_ASSERTION((aFrame->GetType() == nsGkAtoms::tableRowFrame),
|
||||
"RowGroup contains a frame that is not a row");
|
||||
nsTableRowFrame *rowFrame = do_QueryFrame(aFrame);
|
||||
NS_ASSERTION(rowFrame, "RowGroup contains a frame that is not a row");
|
||||
|
||||
nsTableRowFrame* rowFrame = (nsTableRowFrame*)aFrame;
|
||||
return rowFrame->GetRowIndex() - GetStartRowIndex();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user