Restored some code that I can't remove until tables are changed to work

with the new frane construction code
This commit is contained in:
troy%netscape.com 1998-09-13 19:18:39 +00:00
Родитель a298828e34
Коммит 92cebd43a8
2 изменённых файлов: 110 добавлений и 0 удалений

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

@ -257,6 +257,32 @@ nsCSSInlineFrame::FindTextRuns(nsCSSLineLayout& aLineLayout,
// Gather up children from the overflow lists
DrainOverflowLists();
// XXX CONSTRUCTION
// Create new frames if necessary
if (NS_FRAME_FIRST_REFLOW & mState) {
if ((nsnull == mPrevInFlow) && (nsnull == mNextInFlow) &&
(0 == mChildCount)) {
rv = CreateNewFrames(aLineLayout.mPresContext);
if (NS_OK != rv) {
goto done;
}
}
}
else if (nsnull != aReflowCommand) {
nsIFrame* target;
aReflowCommand->GetTarget(target);
if (this == target) {
nsIReflowCommand::ReflowType type;
aReflowCommand->GetType(type);
if (nsIReflowCommand::FrameAppended == type) {
rv = CreateNewFrames(aLineLayout.mPresContext);
if (NS_OK != rv) {
goto done;
}
}
}
}
// Ask each child frame for its text runs
frame = mFirstChild;
n = mChildCount;
@ -277,6 +303,7 @@ nsCSSInlineFrame::FindTextRuns(nsCSSLineLayout& aLineLayout,
frame->GetNextSibling(frame);
}
done:;
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("exit nsCSSInlineFrame::FindTextRuns rv=%x [%d,%d,%c]",
rv, mFirstContentOffset, mLastContentOffset,
@ -484,6 +511,87 @@ nsCSSInlineFrame::FrameAppendedReflow(nsCSSInlineReflowState& aState)
return rs;
}
// XXX CONSTRUCTION
nsresult
nsCSSInlineFrame::CreateNewFrames(nsIPresContext* aPresContext)
{
// reason: initial: (a) null nif, pif: create frames
// (b) pullup: don't create frames
// reason: incremental: (a) append targetted at us => create frames
// Get the childPrevInFlow for our eventual first child if we are a
// continuation and we have no children and the last child in our
// prev-in-flow is incomplete. While we are at it, we also compute
// our kidContentIndex.
PRInt32 kidContentIndex;
nsIFrame* childPrevInFlow = nsnull;
nsIFrame* prevChild = nsnull;
if ((nsnull == mFirstChild) && (nsnull != mPrevInFlow)) {
nsCSSInlineFrame* prev = (nsCSSInlineFrame*)mPrevInFlow;
NS_ASSERTION(prev->mLastContentOffset >= prev->mFirstContentOffset,
"bad prevInFlow");
kidContentIndex = prev->NextChildOffset();
if (!prev->mLastContentIsComplete) {
// Our prev-in-flow's last child is not complete
prev->LastChild(childPrevInFlow);
}
}
else {
kidContentIndex = NextChildOffset();
LastChild(prevChild);
}
nsresult rv;
PRInt32 lastContentIndex;
mContent->ChildCount(lastContentIndex);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsCSSInlineFrame::CreateNewFrames: kidContentIndex=%d lastContentIndex=%d childPrevInFlow=%p",
kidContentIndex, lastContentIndex, childPrevInFlow));
while (kidContentIndex < lastContentIndex) {
nsIContent* kid;
mContent->ChildAt(kidContentIndex, kid);
if (nsnull == kid) {
// Our content container is bad
break;
}
// Create child
nsIFrame* child;
rv = nsHTMLBase::CreateFrame(aPresContext, this, kid, childPrevInFlow,
child);
NS_RELEASE(kid);
if (NS_OK != rv) {
return rv;
}
if (nsnull == prevChild) {
mFirstChild = child;
mFirstContentOffset = kidContentIndex;
}
else {
prevChild->SetNextSibling(child);
}
mChildCount++;
kidContentIndex++;
childPrevInFlow = nsnull;
prevChild = child;
NS_FRAME_TRACE(NS_FRAME_TRACE_NEW_FRAMES,
("nsCSSInlineFrame::CreateNewFrames: new-frame=%p prev-in-flow=%p",
child, childPrevInFlow));
}
if (kidContentIndex == 0) {
NS_ASSERTION(lastContentIndex == 0, "bad kid content index");
mLastContentOffset = 0;
} else {
mLastContentOffset = kidContentIndex - 1;
}
NS_ASSERTION(mFirstContentOffset <= mLastContentOffset, "bad fco/lco");
mLastContentIsComplete = PR_TRUE;
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("exit nsCSSInlineFrame::CreateNewFrames"));
return NS_OK;
}
nsInlineReflowStatus
nsCSSInlineFrame::ChildIncrementalReflow(nsCSSInlineReflowState& aState)
{

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

@ -123,6 +123,8 @@ protected:
nsPlaceholderFrame* CreatePlaceholderFrame(nsIPresContext* aPresContext,
nsIFrame* aFloatedFrame);
// XXX CONSTRUCTION
nsresult CreateNewFrames(nsIPresContext* aPresContext);
nsresult AppendNewFrames(nsIPresContext* aPresContext, nsIFrame*);
friend nsresult NS_NewCSSInlineFrame(nsIFrame** aInstancePtrResult,