зеркало из https://github.com/mozilla/gecko-dev.git
Bug 685901 - Remove the nsTableOuterFrame::mInnerTableFrame and mCaptionFrame members in favor of accessing the child frame lists directly. r=roc
This commit is contained in:
Родитель
15fc2f321d
Коммит
c2d66bf09f
|
@ -239,7 +239,6 @@ nsTableOuterFrame::SetInitialChildList(ChildListID aListID,
|
|||
if (kCaptionList == aListID) {
|
||||
// the frame constructor already checked for table-caption display type
|
||||
mCaptionFrames.SetFrames(aChildList);
|
||||
mCaptionFrame = mCaptionFrames.FirstChild();
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(aListID == kPrincipalList, "wrong childlist");
|
||||
|
@ -247,7 +246,6 @@ nsTableOuterFrame::SetInitialChildList(ChildListID aListID,
|
|||
NS_ASSERTION(aChildList.FirstChild() &&
|
||||
nsGkAtoms::tableFrame == aChildList.FirstChild()->GetType(),
|
||||
"expected a table frame");
|
||||
mInnerTableFrame = static_cast<nsTableFrame*>(aChildList.FirstChild());
|
||||
mFrames.SetFrames(aChildList);
|
||||
}
|
||||
|
||||
|
@ -267,7 +265,6 @@ nsTableOuterFrame::AppendFrames(ChildListID aListID,
|
|||
aFrameList.FirstChild()->GetType() == nsGkAtoms::tableCaptionFrame,
|
||||
"appending non-caption frame to captionList");
|
||||
mCaptionFrames.AppendFrames(this, aFrameList);
|
||||
mCaptionFrame = mCaptionFrames.FirstChild();
|
||||
rv = NS_OK;
|
||||
|
||||
// Reflow the new caption frame. It's already marked dirty, so
|
||||
|
@ -296,7 +293,6 @@ nsTableOuterFrame::InsertFrames(ChildListID aListID,
|
|||
aFrameList.FirstChild()->GetType() == nsGkAtoms::tableCaptionFrame,
|
||||
"inserting non-caption frame into captionList");
|
||||
mCaptionFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
|
||||
mCaptionFrame = mCaptionFrames.FirstChild();
|
||||
|
||||
// Reflow the new caption frame. It's already marked dirty, so
|
||||
// just tell the pres shell.
|
||||
|
@ -322,12 +318,11 @@ nsTableOuterFrame::RemoveFrame(ChildListID aListID,
|
|||
if (HasSideCaption()) {
|
||||
// The old caption width had an effect on the inner table width so
|
||||
// we're going to need to reflow it. Mark it dirty
|
||||
mInnerTableFrame->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||
InnerTableFrame()->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||
}
|
||||
|
||||
// Remove the frame and destroy it
|
||||
mCaptionFrames.DestroyFrame(aOldFrame);
|
||||
mCaptionFrame = mCaptionFrames.FirstChild();
|
||||
|
||||
PresContext()->PresShell()->
|
||||
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
|
||||
|
@ -348,7 +343,7 @@ nsTableOuterFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
// If there's no caption, take a short cut to avoid having to create
|
||||
// the special display list set and then sort it.
|
||||
if (!mCaptionFrame)
|
||||
if (mCaptionFrames.IsEmpty())
|
||||
return BuildDisplayListForInnerTable(aBuilder, aDirtyRect, aLists);
|
||||
|
||||
nsDisplayListCollection set;
|
||||
|
@ -356,7 +351,8 @@ nsTableOuterFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsDisplayListSet captionSet(set, set.BlockBorderBackgrounds());
|
||||
rv = BuildDisplayListForChild(aBuilder, mCaptionFrame, aDirtyRect, captionSet);
|
||||
rv = BuildDisplayListForChild(aBuilder, mCaptionFrames.FirstChild(),
|
||||
aDirtyRect, captionSet);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Now we have to sort everything by content order, since the caption
|
||||
|
@ -388,7 +384,7 @@ nsTableOuterFrame::SetSelected(PRBool aSelected,
|
|||
SelectionType aType)
|
||||
{
|
||||
nsFrame::SetSelected(aSelected, aType);
|
||||
mInnerTableFrame->SetSelected(aSelected, aType);
|
||||
InnerTableFrame()->SetSelected(aSelected, aType);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
|
@ -404,7 +400,7 @@ nsTableOuterFrame::GetParentStyleContextFrame()
|
|||
// children of the table inherit directly from the inner table, and
|
||||
// the outer table's style context is a leaf.
|
||||
|
||||
return mInnerTableFrame;
|
||||
return InnerTableFrame();
|
||||
}
|
||||
|
||||
// INCREMENTAL REFLOW HELPER FUNCTIONS
|
||||
|
@ -418,9 +414,9 @@ nsTableOuterFrame::InitChildReflowState(nsPresContext& aPresContext,
|
|||
nsMargin collapsePadding(0,0,0,0);
|
||||
nsMargin* pCollapseBorder = nsnull;
|
||||
nsMargin* pCollapsePadding = nsnull;
|
||||
if (aReflowState.frame == mInnerTableFrame &&
|
||||
mInnerTableFrame->IsBorderCollapse()) {
|
||||
collapseBorder = mInnerTableFrame->GetIncludedOuterBCBorder();
|
||||
if (aReflowState.frame == InnerTableFrame() &&
|
||||
InnerTableFrame()->IsBorderCollapse()) {
|
||||
collapseBorder = InnerTableFrame()->GetIncludedOuterBCBorder();
|
||||
pCollapseBorder = &collapseBorder;
|
||||
pCollapsePadding = &collapsePadding;
|
||||
}
|
||||
|
@ -473,11 +469,12 @@ GetContainingBlockSize(const nsHTMLReflowState& aOuterRS)
|
|||
nsTableOuterFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
|
||||
{
|
||||
nscoord width = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
||||
mInnerTableFrame, nsLayoutUtils::MIN_WIDTH);
|
||||
InnerTableFrame(), nsLayoutUtils::MIN_WIDTH);
|
||||
DISPLAY_MIN_WIDTH(this, width);
|
||||
if (mCaptionFrame) {
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
nscoord capWidth =
|
||||
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, mCaptionFrame,
|
||||
nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
||||
mCaptionFrames.FirstChild(),
|
||||
nsLayoutUtils::MIN_WIDTH);
|
||||
if (HasSideCaption()) {
|
||||
width += capWidth;
|
||||
|
@ -497,15 +494,16 @@ nsTableOuterFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
|
|||
DISPLAY_PREF_WIDTH(this, maxWidth);
|
||||
|
||||
maxWidth = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
||||
mInnerTableFrame, nsLayoutUtils::PREF_WIDTH);
|
||||
if (mCaptionFrame) {
|
||||
InnerTableFrame(), nsLayoutUtils::PREF_WIDTH);
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
PRUint8 captionSide = GetCaptionSide();
|
||||
switch(captionSide) {
|
||||
case NS_STYLE_CAPTION_SIDE_LEFT:
|
||||
case NS_STYLE_CAPTION_SIDE_RIGHT:
|
||||
{
|
||||
nscoord capMin =
|
||||
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, mCaptionFrame,
|
||||
nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
||||
mCaptionFrames.FirstChild(),
|
||||
nsLayoutUtils::MIN_WIDTH);
|
||||
maxWidth += capMin;
|
||||
}
|
||||
|
@ -525,7 +523,8 @@ nsTableOuterFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
|
|||
iwt = nsLayoutUtils::PREF_WIDTH;
|
||||
}
|
||||
nscoord capPref =
|
||||
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, mCaptionFrame,
|
||||
nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
||||
mCaptionFrames.FirstChild(),
|
||||
iwt);
|
||||
maxWidth = NS_MAX(maxWidth, capPref);
|
||||
}
|
||||
|
@ -582,22 +581,23 @@ nsTableOuterFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
|||
PRUint8 captionSide = GetCaptionSide();
|
||||
nscoord width;
|
||||
if (captionSide == NO_SIDE) {
|
||||
width = ChildShrinkWrapWidth(aRenderingContext, mInnerTableFrame,
|
||||
width = ChildShrinkWrapWidth(aRenderingContext, InnerTableFrame(),
|
||||
aCBSize, aAvailableWidth);
|
||||
} else if (captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_RIGHT) {
|
||||
nscoord capWidth = ChildShrinkWrapWidth(aRenderingContext, mCaptionFrame,
|
||||
nscoord capWidth = ChildShrinkWrapWidth(aRenderingContext,
|
||||
mCaptionFrames.FirstChild(),
|
||||
aCBSize, aAvailableWidth);
|
||||
width = capWidth + ChildShrinkWrapWidth(aRenderingContext,
|
||||
mInnerTableFrame, aCBSize,
|
||||
InnerTableFrame(), aCBSize,
|
||||
aAvailableWidth - capWidth);
|
||||
} else if (captionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM) {
|
||||
nscoord margin;
|
||||
width = ChildShrinkWrapWidth(aRenderingContext, mInnerTableFrame,
|
||||
width = ChildShrinkWrapWidth(aRenderingContext, InnerTableFrame(),
|
||||
aCBSize, aAvailableWidth, &margin);
|
||||
nscoord capWidth = ChildShrinkWrapWidth(aRenderingContext,
|
||||
mCaptionFrame, aCBSize,
|
||||
mCaptionFrames.FirstChild(), aCBSize,
|
||||
width - margin);
|
||||
if (capWidth > width)
|
||||
width = capWidth;
|
||||
|
@ -605,11 +605,11 @@ nsTableOuterFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
|||
NS_ASSERTION(captionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE,
|
||||
"unexpected caption-side");
|
||||
width = ChildShrinkWrapWidth(aRenderingContext, mInnerTableFrame,
|
||||
width = ChildShrinkWrapWidth(aRenderingContext, InnerTableFrame(),
|
||||
aCBSize, aAvailableWidth);
|
||||
nscoord capWidth = ChildShrinkWrapWidth(aRenderingContext,
|
||||
mCaptionFrame, aCBSize,
|
||||
aAvailableWidth);
|
||||
mCaptionFrames.FirstChild(),
|
||||
aCBSize, aAvailableWidth);
|
||||
if (capWidth > width)
|
||||
width = capWidth;
|
||||
}
|
||||
|
@ -620,8 +620,8 @@ nsTableOuterFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
|||
PRUint8
|
||||
nsTableOuterFrame::GetCaptionSide()
|
||||
{
|
||||
if (mCaptionFrame) {
|
||||
return mCaptionFrame->GetStyleTableBorder()->mCaptionSide;
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
return mCaptionFrames.FirstChild()->GetStyleTableBorder()->mCaptionSide;
|
||||
}
|
||||
else {
|
||||
return NO_SIDE; // no caption
|
||||
|
@ -631,7 +631,8 @@ nsTableOuterFrame::GetCaptionSide()
|
|||
PRUint8
|
||||
nsTableOuterFrame::GetCaptionVerticalAlign()
|
||||
{
|
||||
const nsStyleCoord& va = mCaptionFrame->GetStyleTextReset()->mVerticalAlign;
|
||||
const nsStyleCoord& va =
|
||||
mCaptionFrames.FirstChild()->GetStyleTextReset()->mVerticalAlign;
|
||||
return (va.GetUnit() == eStyleUnit_Enumerated)
|
||||
? va.GetIntValue()
|
||||
: NS_STYLE_VERTICAL_ALIGN_TOP;
|
||||
|
@ -646,13 +647,13 @@ nsTableOuterFrame::SetDesiredSize(PRUint8 aCaptionSide,
|
|||
{
|
||||
aWidth = aHeight = 0;
|
||||
|
||||
nsRect innerRect = mInnerTableFrame->GetRect();
|
||||
nsRect innerRect = InnerTableFrame()->GetRect();
|
||||
nscoord innerWidth = innerRect.width;
|
||||
|
||||
nsRect captionRect(0,0,0,0);
|
||||
nscoord captionWidth = 0;
|
||||
if (mCaptionFrame) {
|
||||
captionRect = mCaptionFrame->GetRect();
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
captionRect = mCaptionFrames.FirstChild()->GetRect();
|
||||
captionWidth = captionRect.width;
|
||||
}
|
||||
switch(aCaptionSide) {
|
||||
|
@ -693,7 +694,7 @@ nsTableOuterFrame::GetCaptionOrigin(PRUint32 aCaptionSide,
|
|||
(NS_UNCONSTRAINEDSIZE == aCaptionSize.width) || (NS_UNCONSTRAINEDSIZE == aCaptionSize.height)) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (!mCaptionFrame) return NS_OK;
|
||||
if (mCaptionFrames.IsEmpty()) return NS_OK;
|
||||
|
||||
NS_ASSERTION(NS_AUTOMARGIN != aCaptionMargin.left, "The computed caption margin is auto?");
|
||||
NS_ASSERTION(NS_AUTOMARGIN != aCaptionMargin.top, "The computed caption margin is auto?");
|
||||
|
@ -872,7 +873,7 @@ nsTableOuterFrame::OuterBeginReflowChild(nsPresContext* aPresContext,
|
|||
// work around pixel rounding errors, round down to ensure we don't exceed the avail height in
|
||||
nscoord availHeight = aOuterRS.availableHeight;
|
||||
if (NS_UNCONSTRAINEDSIZE != availHeight) {
|
||||
if (mCaptionFrame == aChildFrame) {
|
||||
if (mCaptionFrames.FirstChild() == aChildFrame) {
|
||||
availHeight = NS_UNCONSTRAINEDSIZE;
|
||||
} else {
|
||||
nsMargin margin;
|
||||
|
@ -896,14 +897,14 @@ nsTableOuterFrame::OuterBeginReflowChild(nsPresContext* aPresContext,
|
|||
InitChildReflowState(*aPresContext, childRS);
|
||||
|
||||
// see if we need to reset top of page due to a caption
|
||||
if (mCaptionFrame) {
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
PRUint8 captionSide = GetCaptionSide();
|
||||
if (((captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE) &&
|
||||
mCaptionFrame == aChildFrame) ||
|
||||
mCaptionFrames.FirstChild() == aChildFrame) ||
|
||||
((captionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE) &&
|
||||
mInnerTableFrame == aChildFrame)) {
|
||||
InnerTableFrame() == aChildFrame)) {
|
||||
childRS.mFlags.mIsTopOfPage = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -933,9 +934,9 @@ nsTableOuterFrame::UpdateReflowMetrics(PRUint8 aCaptionSide,
|
|||
aMet.width, aMet.height);
|
||||
|
||||
aMet.SetOverflowAreasToDesiredBounds();
|
||||
ConsiderChildOverflow(aMet.mOverflowAreas, mInnerTableFrame);
|
||||
if (mCaptionFrame) {
|
||||
ConsiderChildOverflow(aMet.mOverflowAreas, mCaptionFrame);
|
||||
ConsiderChildOverflow(aMet.mOverflowAreas, InnerTableFrame());
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
ConsiderChildOverflow(aMet.mOverflowAreas, mCaptionFrames.FirstChild());
|
||||
}
|
||||
FinishAndStoreOverflow(&aMet);
|
||||
}
|
||||
|
@ -971,36 +972,37 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
nsHTMLReflowState *innerRS =
|
||||
static_cast<nsHTMLReflowState*>((void*) innerRSSpace);
|
||||
|
||||
nsRect origInnerRect = mInnerTableFrame->GetRect();
|
||||
nsRect origInnerVisualOverflow = mInnerTableFrame->GetVisualOverflowRect();
|
||||
nsRect origInnerRect = InnerTableFrame()->GetRect();
|
||||
nsRect origInnerVisualOverflow = InnerTableFrame()->GetVisualOverflowRect();
|
||||
PRBool innerFirstReflow =
|
||||
(mInnerTableFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
|
||||
(InnerTableFrame()->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
|
||||
nsRect origCaptionRect;
|
||||
nsRect origCaptionVisualOverflow;
|
||||
PRBool captionFirstReflow;
|
||||
if (mCaptionFrame) {
|
||||
origCaptionRect = mCaptionFrame->GetRect();
|
||||
origCaptionVisualOverflow = mCaptionFrame->GetVisualOverflowRect();
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
origCaptionRect = mCaptionFrames.FirstChild()->GetRect();
|
||||
origCaptionVisualOverflow =
|
||||
mCaptionFrames.FirstChild()->GetVisualOverflowRect();
|
||||
captionFirstReflow =
|
||||
(mCaptionFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
|
||||
(mCaptionFrames.FirstChild()->GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
|
||||
}
|
||||
|
||||
// ComputeAutoSize has to match this logic.
|
||||
if (captionSide == NO_SIDE) {
|
||||
// We don't have a caption.
|
||||
OuterBeginReflowChild(aPresContext, mInnerTableFrame, aOuterRS,
|
||||
OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,
|
||||
innerRSSpace, aOuterRS.ComputedWidth());
|
||||
} else if (captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_RIGHT) {
|
||||
// nsTableCaptionFrame::ComputeAutoSize takes care of making side
|
||||
// captions small. Compute the caption's size first, and tell the
|
||||
// table to fit in what's left.
|
||||
OuterBeginReflowChild(aPresContext, mCaptionFrame, aOuterRS,
|
||||
OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS,
|
||||
captionRSSpace, aOuterRS.ComputedWidth());
|
||||
nscoord innerAvailWidth = aOuterRS.ComputedWidth() -
|
||||
(captionRS->ComputedWidth() + captionRS->mComputedMargin.LeftRight() +
|
||||
captionRS->mComputedBorderPadding.LeftRight());
|
||||
OuterBeginReflowChild(aPresContext, mInnerTableFrame, aOuterRS,
|
||||
OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,
|
||||
innerRSSpace, innerAvailWidth);
|
||||
|
||||
} else if (captionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
||||
|
@ -1013,7 +1015,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
// table box inside it
|
||||
// We don't actually make our anonymous box that width (if we did,
|
||||
// it would break 'auto' margins), but this effectively does that.
|
||||
OuterBeginReflowChild(aPresContext, mInnerTableFrame, aOuterRS,
|
||||
OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,
|
||||
innerRSSpace, aOuterRS.ComputedWidth());
|
||||
// It's good that CSS 2.1 says not to include margins, since we
|
||||
// can't, since they already been converted so they exactly
|
||||
|
@ -1022,16 +1024,16 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
// GetCaptionOrigin, though.)
|
||||
nscoord innerBorderWidth = innerRS->ComputedWidth() +
|
||||
innerRS->mComputedBorderPadding.LeftRight();
|
||||
OuterBeginReflowChild(aPresContext, mCaptionFrame, aOuterRS,
|
||||
OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS,
|
||||
captionRSSpace, innerBorderWidth);
|
||||
} else {
|
||||
NS_ASSERTION(captionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE,
|
||||
"unexpected caption-side");
|
||||
// Size the table and the caption independently.
|
||||
OuterBeginReflowChild(aPresContext, mCaptionFrame, aOuterRS,
|
||||
OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS,
|
||||
captionRSSpace, aOuterRS.ComputedWidth());
|
||||
OuterBeginReflowChild(aPresContext, mInnerTableFrame, aOuterRS,
|
||||
OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,
|
||||
innerRSSpace, aOuterRS.ComputedWidth());
|
||||
}
|
||||
|
||||
|
@ -1039,10 +1041,10 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
nsHTMLReflowMetrics captionMet;
|
||||
nsSize captionSize;
|
||||
nsMargin captionMargin;
|
||||
if (mCaptionFrame) {
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
nsReflowStatus capStatus; // don't let the caption cause incomplete
|
||||
rv = OuterDoReflowChild(aPresContext, mCaptionFrame, *captionRS,
|
||||
captionMet, capStatus);
|
||||
rv = OuterDoReflowChild(aPresContext, mCaptionFrames.FirstChild(),
|
||||
*captionRS, captionMet, capStatus);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
captionSize.width = captionMet.width;
|
||||
captionSize.height = captionMet.height;
|
||||
|
@ -1086,7 +1088,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
// Then, now that we know how much to reduce the width of the inner
|
||||
// table to account for side captions, reflow the inner table.
|
||||
nsHTMLReflowMetrics innerMet;
|
||||
rv = OuterDoReflowChild(aPresContext, mInnerTableFrame, *innerRS,
|
||||
rv = OuterDoReflowChild(aPresContext, InnerTableFrame(), *innerRS,
|
||||
innerMet, aStatus);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsSize innerSize;
|
||||
|
@ -1102,12 +1104,12 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
// XXX Need to recompute inner table's auto margins for the case of side
|
||||
// captions. (Caption's are broken too, but that should be fixed earlier.)
|
||||
|
||||
if (mCaptionFrame) {
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
nsPoint captionOrigin;
|
||||
GetCaptionOrigin(captionSide, containSize, innerSize,
|
||||
innerMargin, captionSize, captionMargin, captionOrigin);
|
||||
FinishReflowChild(mCaptionFrame, aPresContext, captionRS, captionMet,
|
||||
captionOrigin.x, captionOrigin.y, 0);
|
||||
FinishReflowChild(mCaptionFrames.FirstChild(), aPresContext, captionRS,
|
||||
captionMet, captionOrigin.x, captionOrigin.y, 0);
|
||||
captionRS->~nsHTMLReflowState();
|
||||
}
|
||||
// XXX If the height is constrained then we need to check whether
|
||||
|
@ -1116,14 +1118,14 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
nsPoint innerOrigin;
|
||||
GetInnerOrigin(captionSide, containSize, captionSize,
|
||||
captionMargin, innerSize, innerMargin, innerOrigin);
|
||||
FinishReflowChild(mInnerTableFrame, aPresContext, innerRS, innerMet,
|
||||
FinishReflowChild(InnerTableFrame(), aPresContext, innerRS, innerMet,
|
||||
innerOrigin.x, innerOrigin.y, 0);
|
||||
innerRS->~nsHTMLReflowState();
|
||||
|
||||
nsTableFrame::InvalidateFrame(mInnerTableFrame, origInnerRect,
|
||||
nsTableFrame::InvalidateFrame(InnerTableFrame(), origInnerRect,
|
||||
origInnerVisualOverflow, innerFirstReflow);
|
||||
if (mCaptionFrame) {
|
||||
nsTableFrame::InvalidateFrame(mCaptionFrame, origCaptionRect,
|
||||
if (mCaptionFrames.NotEmpty()) {
|
||||
nsTableFrame::InvalidateFrame(mCaptionFrames.FirstChild(), origCaptionRect,
|
||||
origCaptionVisualOverflow,
|
||||
captionFirstReflow);
|
||||
}
|
||||
|
@ -1153,7 +1155,7 @@ nsTableOuterFrame::GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
|
|||
PRInt32& aActualRowSpan, PRInt32& aActualColSpan,
|
||||
PRBool& aIsSelected)
|
||||
{
|
||||
return mInnerTableFrame->GetCellDataAt(aRowIndex, aColIndex, aCell,
|
||||
return InnerTableFrame()->GetCellDataAt(aRowIndex, aColIndex, aCell,
|
||||
aStartRowIndex, aStartColIndex,
|
||||
aRowSpan, aColSpan, aActualRowSpan,
|
||||
aActualColSpan, aIsSelected);
|
||||
|
@ -1162,7 +1164,7 @@ nsTableOuterFrame::GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
|
|||
NS_IMETHODIMP
|
||||
nsTableOuterFrame::GetTableSize(PRInt32& aRowCount, PRInt32& aColCount)
|
||||
{
|
||||
return mInnerTableFrame->GetTableSize(aRowCount, aColCount);
|
||||
return InnerTableFrame()->GetTableSize(aRowCount, aColCount);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1170,7 +1172,7 @@ nsTableOuterFrame::GetIndexByRowAndColumn(PRInt32 aRow, PRInt32 aColumn,
|
|||
PRInt32 *aIndex)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIndex);
|
||||
return mInnerTableFrame->GetIndexByRowAndColumn(aRow, aColumn, aIndex);
|
||||
return InnerTableFrame()->GetIndexByRowAndColumn(aRow, aColumn, aIndex);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1179,7 +1181,7 @@ nsTableOuterFrame::GetRowAndColumnByIndex(PRInt32 aIndex,
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aRow);
|
||||
NS_ENSURE_ARG_POINTER(aColumn);
|
||||
return mInnerTableFrame->GetRowAndColumnByIndex(aIndex, aRow, aColumn);
|
||||
return InnerTableFrame()->GetRowAndColumnByIndex(aIndex, aRow, aColumn);
|
||||
}
|
||||
|
||||
/*---------------- end of nsITableLayout implementation ------------------*/
|
||||
|
|
|
@ -41,9 +41,7 @@
|
|||
#include "nsHTMLContainerFrame.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsITableLayout.h"
|
||||
|
||||
struct nsStyleTable;
|
||||
class nsTableFrame;
|
||||
#include "nsTableFrame.h"
|
||||
|
||||
class nsTableCaptionFrame : public nsBlockFrame
|
||||
{
|
||||
|
@ -259,17 +257,15 @@ protected:
|
|||
nscoord aAvailableWidth,
|
||||
nsMargin& aMargin);
|
||||
|
||||
nsTableFrame* InnerTableFrame() {
|
||||
return static_cast<nsTableFrame*>(mFrames.FirstChild());
|
||||
}
|
||||
|
||||
private:
|
||||
// used to keep track of this frame's children. They are redundant with mFrames, but more convient
|
||||
nsTableFrame* mInnerTableFrame;
|
||||
nsFrameList mCaptionFrames;
|
||||
nsIFrame* mCaptionFrame;
|
||||
};
|
||||
|
||||
inline PRIntn nsTableOuterFrame::GetSkipSides() const
|
||||
{ return 0; }
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче