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