captions now work properly with new frame layout strategy.

nsTableOuterFrame->mFirstChild==nsTableOuterFrame->mInnerTableFrame, always.
This commit is contained in:
buster%netscape.com 1998-09-20 04:50:08 +00:00
Родитель 13c7230b4c
Коммит 8c93860f3d
5 изменённых файлов: 27 добавлений и 37 удалений

Просмотреть файл

@ -1036,15 +1036,13 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
if (nsnull == captionFrame) {
NS_NewBodyFrame(childContent, aNewFrame, captionFrame);
captionFrame->SetStyleContext(aPresContext, childStyleContext);
// Process the caption's child content and initialize it
nsIFrame* captionChildList;
ProcessChildren(aPresContext, captionFrame, childContent, captionChildList);
captionFrame->Init(*aPresContext, captionChildList);
// Prepend the caption frame to the outer frame's child list
captionFrame->SetNextSibling(innerFrame);
childList = captionFrame;
innerFrame->SetNextSibling(captionFrame);
}
break;

Просмотреть файл

@ -1036,15 +1036,13 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
if (nsnull == captionFrame) {
NS_NewBodyFrame(childContent, aNewFrame, captionFrame);
captionFrame->SetStyleContext(aPresContext, childStyleContext);
// Process the caption's child content and initialize it
nsIFrame* captionChildList;
ProcessChildren(aPresContext, captionFrame, childContent, captionChildList);
captionFrame->Init(*aPresContext, captionChildList);
// Prepend the caption frame to the outer frame's child list
captionFrame->SetNextSibling(innerFrame);
childList = captionFrame;
innerFrame->SetNextSibling(captionFrame);
}
break;

Просмотреть файл

@ -111,14 +111,9 @@ NS_IMETHODIMP nsTableOuterFrame::Init(nsIPresContext& aPresContext, nsIFrame* aC
NS_ASSERTION(mChildCount > 0, "bad child list");
// Set our internal member data
if (1 == mChildCount) {
mInnerTableFrame = (nsTableFrame*)mFirstChild;
} else {
mCaptionFrame = mFirstChild;
nsIFrame* f;
mFirstChild->GetNextSibling(f);
mInnerTableFrame = (nsTableFrame*)f;
mInnerTableFrame = (nsTableFrame*)mFirstChild;
if (2 == mChildCount) {
mFirstChild->GetNextSibling(mCaptionFrame);
}
return NS_OK;
@ -444,8 +439,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext,
}
}
// At this point, we must have at least one child frame, and we must have an
// inner table frame
// At this point, we must have an inner table frame, and we might have a caption
NS_ASSERTION(nsnull != mFirstChild, "no children");
NS_ASSERTION(nsnull != mInnerTableFrame, "no mInnerTableFrame");
@ -488,7 +482,10 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext,
// Compute the caption's y-origin
nscoord captionY = captionMargin.top;
if (mFirstChild == mInnerTableFrame) {
const nsStyleText* captionTextStyle;
mCaptionFrame->GetStyleData(eStyleStruct_Text, ((nsStyleStruct *&)captionTextStyle));
if ((captionTextStyle->mVerticalAlign.GetUnit()==eStyleUnit_Enumerated) &&
(captionTextStyle->mVerticalAlign.GetIntValue()==NS_STYLE_VERTICAL_ALIGN_BOTTOM)) {
captionY += innerSize.height;
}
@ -514,12 +511,13 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext,
// Place the inner table
nscoord innerY;
if (mFirstChild == mCaptionFrame) {
// Inner table is below the caption
if ((captionTextStyle->mVerticalAlign.GetUnit()!=eStyleUnit_Enumerated) ||
(captionTextStyle->mVerticalAlign.GetIntValue()!=NS_STYLE_VERTICAL_ALIGN_BOTTOM)) {
// top caption
innerY = captionRect.YMost() + captionMargin.bottom;
state.y = innerY + innerSize.height;
} else {
// Caption is below the inner table
// bottom caption
innerY = 0;
state.y = captionRect.YMost() + captionMargin.bottom;
}

Просмотреть файл

@ -1036,15 +1036,13 @@ HTMLStyleSheetImpl::ConstructTableFrame(nsIPresContext* aPresContext,
if (nsnull == captionFrame) {
NS_NewBodyFrame(childContent, aNewFrame, captionFrame);
captionFrame->SetStyleContext(aPresContext, childStyleContext);
// Process the caption's child content and initialize it
nsIFrame* captionChildList;
ProcessChildren(aPresContext, captionFrame, childContent, captionChildList);
captionFrame->Init(*aPresContext, captionChildList);
// Prepend the caption frame to the outer frame's child list
captionFrame->SetNextSibling(innerFrame);
childList = captionFrame;
innerFrame->SetNextSibling(captionFrame);
}
break;

Просмотреть файл

@ -111,14 +111,9 @@ NS_IMETHODIMP nsTableOuterFrame::Init(nsIPresContext& aPresContext, nsIFrame* aC
NS_ASSERTION(mChildCount > 0, "bad child list");
// Set our internal member data
if (1 == mChildCount) {
mInnerTableFrame = (nsTableFrame*)mFirstChild;
} else {
mCaptionFrame = mFirstChild;
nsIFrame* f;
mFirstChild->GetNextSibling(f);
mInnerTableFrame = (nsTableFrame*)f;
mInnerTableFrame = (nsTableFrame*)mFirstChild;
if (2 == mChildCount) {
mFirstChild->GetNextSibling(mCaptionFrame);
}
return NS_OK;
@ -444,8 +439,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext,
}
}
// At this point, we must have at least one child frame, and we must have an
// inner table frame
// At this point, we must have an inner table frame, and we might have a caption
NS_ASSERTION(nsnull != mFirstChild, "no children");
NS_ASSERTION(nsnull != mInnerTableFrame, "no mInnerTableFrame");
@ -488,7 +482,10 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext,
// Compute the caption's y-origin
nscoord captionY = captionMargin.top;
if (mFirstChild == mInnerTableFrame) {
const nsStyleText* captionTextStyle;
mCaptionFrame->GetStyleData(eStyleStruct_Text, ((nsStyleStruct *&)captionTextStyle));
if ((captionTextStyle->mVerticalAlign.GetUnit()==eStyleUnit_Enumerated) &&
(captionTextStyle->mVerticalAlign.GetIntValue()==NS_STYLE_VERTICAL_ALIGN_BOTTOM)) {
captionY += innerSize.height;
}
@ -514,12 +511,13 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext,
// Place the inner table
nscoord innerY;
if (mFirstChild == mCaptionFrame) {
// Inner table is below the caption
if ((captionTextStyle->mVerticalAlign.GetUnit()!=eStyleUnit_Enumerated) ||
(captionTextStyle->mVerticalAlign.GetIntValue()!=NS_STYLE_VERTICAL_ALIGN_BOTTOM)) {
// top caption
innerY = captionRect.YMost() + captionMargin.bottom;
state.y = innerY + innerSize.height;
} else {
// Caption is below the inner table
// bottom caption
innerY = 0;
state.y = captionRect.YMost() + captionMargin.bottom;
}