This commit is contained in:
kipp%netscape.com 1998-10-14 20:10:36 +00:00
Родитель 727f7cef52
Коммит 1dfacf973c
4 изменённых файлов: 82 добавлений и 8 удалений

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

@ -247,6 +247,7 @@ nsHTMLContainerFrame::CreateWrapperFrame(nsIPresContext& aPresContext,
return isContainer;
}
// XXX pass in aFrame's style context instead
PRBool
nsHTMLContainerFrame::MoveFrameOutOfFlow(nsIPresContext& aPresContext,
nsIFrame* aFrame,
@ -269,6 +270,7 @@ nsHTMLContainerFrame::MoveFrameOutOfFlow(nsIPresContext& aPresContext,
aFrame->GetNextSibling(nextSibling);
aFrame->SetNextSibling(nsnull);
nsIFrame* frameToWrapWithAView = aFrame;
if (isFloated) {
// Create a placeholder frame that will serve as the anchor point.
nsPlaceholderFrame* placeholder =
@ -279,6 +281,7 @@ nsHTMLContainerFrame::MoveFrameOutOfFlow(nsIPresContext& aPresContext,
if (CreateWrapperFrame(aPresContext, aFrame, wrapperFrame)) {
// Bind the wrapper frame to the placeholder
placeholder->SetAnchoredItem(wrapperFrame);
frameToWrapWithAView = wrapperFrame;
}
aPlaceholderFrame = placeholder;
@ -293,11 +296,22 @@ nsHTMLContainerFrame::MoveFrameOutOfFlow(nsIPresContext& aPresContext,
if (CreateWrapperFrame(aPresContext, aFrame, wrapperFrame)) {
// Bind the wrapper frame to the placeholder
placeholder->SetAbsoluteFrame(wrapperFrame);
frameToWrapWithAView = wrapperFrame;
}
aPlaceholderFrame = placeholder;
}
// Wrap the frame in a view if necessary
nsIStyleContext* kidSC;
aFrame->GetStyleContext(&aPresContext, kidSC);
nsresult rv = CreateViewForFrame(aPresContext, frameToWrapWithAView,
kidSC, PR_FALSE);
NS_RELEASE(kidSC);
if (NS_OK != rv) {
return rv;
}
// Set the placeholder's next sibling to what aFrame's next sibling was
aPlaceholderFrame->SetNextSibling(nextSibling);
return PR_TRUE;

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

@ -126,9 +126,9 @@ public:
nsresult AppendNewFrames(nsIPresContext& aPresContext, nsIFrame*);
void InsertNewFrame(nsIPresContext& aPresContext,
nsIFrame* aNewFrame,
nsIFrame* aPrevSibling);
nsresult InsertNewFrame(nsIPresContext& aPresContext,
nsIFrame* aNewFrame,
nsIFrame* aPrevSibling);
PRBool SafeToPull(nsIFrame* aFrame);
@ -184,6 +184,7 @@ nsInlineFrame::AppendNewFrames(nsIPresContext& aPresContext,
frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)kidDisplay);
frame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&) kidPosition);
// XXX encapsulte the move-out-of-flow and CreateViewForFrame
nsIFrame* placeholder;
if (MoveFrameOutOfFlow(aPresContext, frame, kidDisplay, kidPosition, placeholder)) {
// Reset the previous frame's next sibling pointer
@ -194,6 +195,16 @@ nsInlineFrame::AppendNewFrames(nsIPresContext& aPresContext,
}
frame = placeholder;
}
else {
// Wrap the frame in a view if necessary
nsIStyleContext* kidSC;
frame->GetStyleContext(&aPresContext, kidSC);
nsresult rv = CreateViewForFrame(aPresContext, frame, kidSC, PR_FALSE);
NS_RELEASE(kidSC);
if (NS_OK != rv) {
return rv;
}
}
prevFrame = frame;
}
@ -271,7 +282,7 @@ nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout)
return rv;
}
void
nsresult
nsInlineFrame::InsertNewFrame(nsIPresContext& aPresContext,
nsIFrame* aNewFrame,
nsIFrame* aPrevSibling)
@ -288,6 +299,16 @@ nsInlineFrame::InsertNewFrame(nsIPresContext& aPresContext,
// Add the placeholder frame to the flow
aNewFrame = placeholder;
}
else {
// Wrap the frame in a view if necessary
nsIStyleContext* kidSC;
aNewFrame->GetStyleContext(&aPresContext, kidSC);
nsresult rv = CreateViewForFrame(aPresContext, aNewFrame, kidSC, PR_FALSE);
NS_RELEASE(kidSC);
if (NS_OK != rv) {
return rv;
}
}
// Add the new frame to the child list
nsIFrame* nextSibling;
@ -299,6 +320,8 @@ nsInlineFrame::InsertNewFrame(nsIPresContext& aPresContext,
aPrevSibling->SetNextSibling(aNewFrame);
}
aNewFrame->SetNextSibling(nextSibling);
return NS_OK;
}
NS_IMETHODIMP

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

@ -247,6 +247,7 @@ nsHTMLContainerFrame::CreateWrapperFrame(nsIPresContext& aPresContext,
return isContainer;
}
// XXX pass in aFrame's style context instead
PRBool
nsHTMLContainerFrame::MoveFrameOutOfFlow(nsIPresContext& aPresContext,
nsIFrame* aFrame,
@ -269,6 +270,7 @@ nsHTMLContainerFrame::MoveFrameOutOfFlow(nsIPresContext& aPresContext,
aFrame->GetNextSibling(nextSibling);
aFrame->SetNextSibling(nsnull);
nsIFrame* frameToWrapWithAView = aFrame;
if (isFloated) {
// Create a placeholder frame that will serve as the anchor point.
nsPlaceholderFrame* placeholder =
@ -279,6 +281,7 @@ nsHTMLContainerFrame::MoveFrameOutOfFlow(nsIPresContext& aPresContext,
if (CreateWrapperFrame(aPresContext, aFrame, wrapperFrame)) {
// Bind the wrapper frame to the placeholder
placeholder->SetAnchoredItem(wrapperFrame);
frameToWrapWithAView = wrapperFrame;
}
aPlaceholderFrame = placeholder;
@ -293,11 +296,22 @@ nsHTMLContainerFrame::MoveFrameOutOfFlow(nsIPresContext& aPresContext,
if (CreateWrapperFrame(aPresContext, aFrame, wrapperFrame)) {
// Bind the wrapper frame to the placeholder
placeholder->SetAbsoluteFrame(wrapperFrame);
frameToWrapWithAView = wrapperFrame;
}
aPlaceholderFrame = placeholder;
}
// Wrap the frame in a view if necessary
nsIStyleContext* kidSC;
aFrame->GetStyleContext(&aPresContext, kidSC);
nsresult rv = CreateViewForFrame(aPresContext, frameToWrapWithAView,
kidSC, PR_FALSE);
NS_RELEASE(kidSC);
if (NS_OK != rv) {
return rv;
}
// Set the placeholder's next sibling to what aFrame's next sibling was
aPlaceholderFrame->SetNextSibling(nextSibling);
return PR_TRUE;

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

@ -126,9 +126,9 @@ public:
nsresult AppendNewFrames(nsIPresContext& aPresContext, nsIFrame*);
void InsertNewFrame(nsIPresContext& aPresContext,
nsIFrame* aNewFrame,
nsIFrame* aPrevSibling);
nsresult InsertNewFrame(nsIPresContext& aPresContext,
nsIFrame* aNewFrame,
nsIFrame* aPrevSibling);
PRBool SafeToPull(nsIFrame* aFrame);
@ -184,6 +184,7 @@ nsInlineFrame::AppendNewFrames(nsIPresContext& aPresContext,
frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)kidDisplay);
frame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&) kidPosition);
// XXX encapsulte the move-out-of-flow and CreateViewForFrame
nsIFrame* placeholder;
if (MoveFrameOutOfFlow(aPresContext, frame, kidDisplay, kidPosition, placeholder)) {
// Reset the previous frame's next sibling pointer
@ -194,6 +195,16 @@ nsInlineFrame::AppendNewFrames(nsIPresContext& aPresContext,
}
frame = placeholder;
}
else {
// Wrap the frame in a view if necessary
nsIStyleContext* kidSC;
frame->GetStyleContext(&aPresContext, kidSC);
nsresult rv = CreateViewForFrame(aPresContext, frame, kidSC, PR_FALSE);
NS_RELEASE(kidSC);
if (NS_OK != rv) {
return rv;
}
}
prevFrame = frame;
}
@ -271,7 +282,7 @@ nsInlineFrame::FindTextRuns(nsLineLayout& aLineLayout)
return rv;
}
void
nsresult
nsInlineFrame::InsertNewFrame(nsIPresContext& aPresContext,
nsIFrame* aNewFrame,
nsIFrame* aPrevSibling)
@ -288,6 +299,16 @@ nsInlineFrame::InsertNewFrame(nsIPresContext& aPresContext,
// Add the placeholder frame to the flow
aNewFrame = placeholder;
}
else {
// Wrap the frame in a view if necessary
nsIStyleContext* kidSC;
aNewFrame->GetStyleContext(&aPresContext, kidSC);
nsresult rv = CreateViewForFrame(aPresContext, aNewFrame, kidSC, PR_FALSE);
NS_RELEASE(kidSC);
if (NS_OK != rv) {
return rv;
}
}
// Add the new frame to the child list
nsIFrame* nextSibling;
@ -299,6 +320,8 @@ nsInlineFrame::InsertNewFrame(nsIPresContext& aPresContext,
aPrevSibling->SetNextSibling(aNewFrame);
}
aNewFrame->SetNextSibling(nextSibling);
return NS_OK;
}
NS_IMETHODIMP