Implement ReflowInlineChild to check for nsIInlineFrame and use it when available

This commit is contained in:
kipp
1998-06-09 17:32:52 +00:00
parent a4978b1098
commit 0519c1c307
6 changed files with 192 additions and 18 deletions

View File

@@ -458,13 +458,42 @@ nsBlockFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow)
} }
nsresult nsresult
nsBlockFrame::ReflowInlineChild(nsIFrame* aKidFrame, nsBlockFrame::ReflowInlineChild(nsLineLayout& aLineLayout,
nsIPresContext* aPresContext, nsIFrame* aKidFrame,
nsReflowMetrics& aDesiredSize, nsReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState, const nsReflowState& aReflowState,
nsReflowStatus& aStatus) nsReflowStatus& aStatus)
{ {
aStatus = ReflowChild(aKidFrame, aPresContext, aDesiredSize, aReflowState); NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
#ifdef NS_DEBUG
nsFrameState kidFrameState;
aKidFrame->GetFrameState(kidFrameState);
NS_ASSERTION(kidFrameState & NS_FRAME_IN_REFLOW, "kid frame is not in reflow");
#endif
nsIInlineFrame* iif;
if (NS_OK == aKidFrame->QueryInterface(kIInlineFrameIID, (void**)&iif)) {
iif->ReflowInline(aLineLayout, aDesiredSize, aReflowState, aStatus);
}
else {
aKidFrame->Reflow(aLineLayout.mPresContext, aDesiredSize, aReflowState,
aStatus);
}
if (NS_FRAME_IS_COMPLETE(aStatus)) {
nsIFrame* kidNextInFlow;
aKidFrame->GetNextInFlow(kidNextInFlow);
if (nsnull != kidNextInFlow) {
// Remove all of the childs next-in-flows. Make sure that we ask
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
nsIFrame* parent;
aKidFrame->GetGeometricParent(parent);
DeleteNextInFlowsFor((nsContainerFrame*)parent, aKidFrame);
}
}
return NS_OK; return NS_OK;
} }

View File

@@ -458,13 +458,42 @@ nsBlockFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow)
} }
nsresult nsresult
nsBlockFrame::ReflowInlineChild(nsIFrame* aKidFrame, nsBlockFrame::ReflowInlineChild(nsLineLayout& aLineLayout,
nsIPresContext* aPresContext, nsIFrame* aKidFrame,
nsReflowMetrics& aDesiredSize, nsReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState, const nsReflowState& aReflowState,
nsReflowStatus& aStatus) nsReflowStatus& aStatus)
{ {
aStatus = ReflowChild(aKidFrame, aPresContext, aDesiredSize, aReflowState); NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
#ifdef NS_DEBUG
nsFrameState kidFrameState;
aKidFrame->GetFrameState(kidFrameState);
NS_ASSERTION(kidFrameState & NS_FRAME_IN_REFLOW, "kid frame is not in reflow");
#endif
nsIInlineFrame* iif;
if (NS_OK == aKidFrame->QueryInterface(kIInlineFrameIID, (void**)&iif)) {
iif->ReflowInline(aLineLayout, aDesiredSize, aReflowState, aStatus);
}
else {
aKidFrame->Reflow(aLineLayout.mPresContext, aDesiredSize, aReflowState,
aStatus);
}
if (NS_FRAME_IS_COMPLETE(aStatus)) {
nsIFrame* kidNextInFlow;
aKidFrame->GetNextInFlow(kidNextInFlow);
if (nsnull != kidNextInFlow) {
// Remove all of the childs next-in-flows. Make sure that we ask
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
nsIFrame* parent;
aKidFrame->GetGeometricParent(parent);
DeleteNextInFlowsFor((nsContainerFrame*)parent, aKidFrame);
}
}
return NS_OK; return NS_OK;
} }

View File

@@ -458,13 +458,42 @@ nsBlockFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow)
} }
nsresult nsresult
nsBlockFrame::ReflowInlineChild(nsIFrame* aKidFrame, nsBlockFrame::ReflowInlineChild(nsLineLayout& aLineLayout,
nsIPresContext* aPresContext, nsIFrame* aKidFrame,
nsReflowMetrics& aDesiredSize, nsReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState, const nsReflowState& aReflowState,
nsReflowStatus& aStatus) nsReflowStatus& aStatus)
{ {
aStatus = ReflowChild(aKidFrame, aPresContext, aDesiredSize, aReflowState); NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
#ifdef NS_DEBUG
nsFrameState kidFrameState;
aKidFrame->GetFrameState(kidFrameState);
NS_ASSERTION(kidFrameState & NS_FRAME_IN_REFLOW, "kid frame is not in reflow");
#endif
nsIInlineFrame* iif;
if (NS_OK == aKidFrame->QueryInterface(kIInlineFrameIID, (void**)&iif)) {
iif->ReflowInline(aLineLayout, aDesiredSize, aReflowState, aStatus);
}
else {
aKidFrame->Reflow(aLineLayout.mPresContext, aDesiredSize, aReflowState,
aStatus);
}
if (NS_FRAME_IS_COMPLETE(aStatus)) {
nsIFrame* kidNextInFlow;
aKidFrame->GetNextInFlow(kidNextInFlow);
if (nsnull != kidNextInFlow) {
// Remove all of the childs next-in-flows. Make sure that we ask
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
nsIFrame* parent;
aKidFrame->GetGeometricParent(parent);
DeleteNextInFlowsFor((nsContainerFrame*)parent, aKidFrame);
}
}
return NS_OK; return NS_OK;
} }

View File

@@ -458,13 +458,42 @@ nsBlockFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow)
} }
nsresult nsresult
nsBlockFrame::ReflowInlineChild(nsIFrame* aKidFrame, nsBlockFrame::ReflowInlineChild(nsLineLayout& aLineLayout,
nsIPresContext* aPresContext, nsIFrame* aKidFrame,
nsReflowMetrics& aDesiredSize, nsReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState, const nsReflowState& aReflowState,
nsReflowStatus& aStatus) nsReflowStatus& aStatus)
{ {
aStatus = ReflowChild(aKidFrame, aPresContext, aDesiredSize, aReflowState); NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
#ifdef NS_DEBUG
nsFrameState kidFrameState;
aKidFrame->GetFrameState(kidFrameState);
NS_ASSERTION(kidFrameState & NS_FRAME_IN_REFLOW, "kid frame is not in reflow");
#endif
nsIInlineFrame* iif;
if (NS_OK == aKidFrame->QueryInterface(kIInlineFrameIID, (void**)&iif)) {
iif->ReflowInline(aLineLayout, aDesiredSize, aReflowState, aStatus);
}
else {
aKidFrame->Reflow(aLineLayout.mPresContext, aDesiredSize, aReflowState,
aStatus);
}
if (NS_FRAME_IS_COMPLETE(aStatus)) {
nsIFrame* kidNextInFlow;
aKidFrame->GetNextInFlow(kidNextInFlow);
if (nsnull != kidNextInFlow) {
// Remove all of the childs next-in-flows. Make sure that we ask
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
nsIFrame* parent;
aKidFrame->GetGeometricParent(parent);
DeleteNextInFlowsFor((nsContainerFrame*)parent, aKidFrame);
}
}
return NS_OK; return NS_OK;
} }

View File

@@ -458,13 +458,42 @@ nsBlockFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow)
} }
nsresult nsresult
nsBlockFrame::ReflowInlineChild(nsIFrame* aKidFrame, nsBlockFrame::ReflowInlineChild(nsLineLayout& aLineLayout,
nsIPresContext* aPresContext, nsIFrame* aKidFrame,
nsReflowMetrics& aDesiredSize, nsReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState, const nsReflowState& aReflowState,
nsReflowStatus& aStatus) nsReflowStatus& aStatus)
{ {
aStatus = ReflowChild(aKidFrame, aPresContext, aDesiredSize, aReflowState); NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
#ifdef NS_DEBUG
nsFrameState kidFrameState;
aKidFrame->GetFrameState(kidFrameState);
NS_ASSERTION(kidFrameState & NS_FRAME_IN_REFLOW, "kid frame is not in reflow");
#endif
nsIInlineFrame* iif;
if (NS_OK == aKidFrame->QueryInterface(kIInlineFrameIID, (void**)&iif)) {
iif->ReflowInline(aLineLayout, aDesiredSize, aReflowState, aStatus);
}
else {
aKidFrame->Reflow(aLineLayout.mPresContext, aDesiredSize, aReflowState,
aStatus);
}
if (NS_FRAME_IS_COMPLETE(aStatus)) {
nsIFrame* kidNextInFlow;
aKidFrame->GetNextInFlow(kidNextInFlow);
if (nsnull != kidNextInFlow) {
// Remove all of the childs next-in-flows. Make sure that we ask
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
nsIFrame* parent;
aKidFrame->GetGeometricParent(parent);
DeleteNextInFlowsFor((nsContainerFrame*)parent, aKidFrame);
}
}
return NS_OK; return NS_OK;
} }

View File

@@ -458,13 +458,42 @@ nsBlockFrame::WillDeleteNextInFlowFrame(nsIFrame* aNextInFlow)
} }
nsresult nsresult
nsBlockFrame::ReflowInlineChild(nsIFrame* aKidFrame, nsBlockFrame::ReflowInlineChild(nsLineLayout& aLineLayout,
nsIPresContext* aPresContext, nsIFrame* aKidFrame,
nsReflowMetrics& aDesiredSize, nsReflowMetrics& aDesiredSize,
const nsReflowState& aReflowState, const nsReflowState& aReflowState,
nsReflowStatus& aStatus) nsReflowStatus& aStatus)
{ {
aStatus = ReflowChild(aKidFrame, aPresContext, aDesiredSize, aReflowState); NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
#ifdef NS_DEBUG
nsFrameState kidFrameState;
aKidFrame->GetFrameState(kidFrameState);
NS_ASSERTION(kidFrameState & NS_FRAME_IN_REFLOW, "kid frame is not in reflow");
#endif
nsIInlineFrame* iif;
if (NS_OK == aKidFrame->QueryInterface(kIInlineFrameIID, (void**)&iif)) {
iif->ReflowInline(aLineLayout, aDesiredSize, aReflowState, aStatus);
}
else {
aKidFrame->Reflow(aLineLayout.mPresContext, aDesiredSize, aReflowState,
aStatus);
}
if (NS_FRAME_IS_COMPLETE(aStatus)) {
nsIFrame* kidNextInFlow;
aKidFrame->GetNextInFlow(kidNextInFlow);
if (nsnull != kidNextInFlow) {
// Remove all of the childs next-in-flows. Make sure that we ask
// the right parent to do the removal (it's possible that the
// parent is not this because we are executing pullup code)
nsIFrame* parent;
aKidFrame->GetGeometricParent(parent);
DeleteNextInFlowsFor((nsContainerFrame*)parent, aKidFrame);
}
}
return NS_OK; return NS_OK;
} }