Fixed a problem with placeholder frame's clearing the child list and

causing the previous frames to disappear
This commit is contained in:
troy%netscape.com 1999-01-26 05:05:19 +00:00
Родитель f533bfaaf0
Коммит 85b271d4dd
3 изменённых файлов: 132 добавлений и 156 удалений

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

@ -229,20 +229,15 @@ struct nsFrameItems {
nsIFrame* lastChild;
nsFrameItems();
// Appends the frame to the end of the list
void AddChild(nsIFrame* aChild);
void Clear();
};
nsFrameItems::nsFrameItems()
:childList(nsnull), lastChild(nsnull)
{}
void
nsFrameItems::Clear()
{
childList = lastChild = nsnull;
}
void
nsFrameItems::AddChild(nsIFrame* aChild)
{
@ -2000,7 +1995,6 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame);
// Add the placeholder frame to the flow
aFrameItems.Clear();
aFrameItems.AddChild(placeholderFrame);
}
}
@ -2196,7 +2190,6 @@ HTMLStyleSheetImpl::ConstructXULFrame(nsIPresContext* aPresContext,
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame);
// Add the placeholder frame to the flow
aFrameItems.Clear();
aFrameItems.AddChild(placeholderFrame);
}
}
@ -2509,12 +2502,14 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
nsAbsoluteItems& aAbsoluteItems,
nsFrameItems& aFrameItems)
{
const nsStylePosition* position = (const nsStylePosition*)
aStyleContext->GetStyleData(eStyleStruct_Position);
PRBool isAbsolutelyPositioned = PR_FALSE;
PRBool isBlock = aDisplay->IsBlockLevel();
nsresult rv = NS_OK;
// Get the position syle info
const nsStylePosition* position = (const nsStylePosition*)
aStyleContext->GetStyleData(eStyleStruct_Position);
// Initialize frame
nsIFrame* aNewFrame = nsnull;
@ -2714,7 +2709,6 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame);
// Add the placeholder frame to the flow
aFrameItems.Clear();
aFrameItems.AddChild(placeholderFrame);
}
return rv;
@ -2820,7 +2814,6 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame);
// Add the placeholder frame to the flow
aFrameItems.Clear();
aFrameItems.AddChild(placeholderFrame);
}
@ -2952,7 +2945,6 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
styleContext->GetStyleData(eStyleStruct_Display);
if (NS_STYLE_DISPLAY_NONE != display->mDisplay) {
nsIFrame* lastChild = aFrameItems.lastChild;
// Handle specific frame types
@ -2960,16 +2952,15 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
styleContext, aAbsoluteItems, aFrameItems);
#ifdef INCLUDE_XUL
// failing to find a matching HTML frame, try creating a specialized
// XUL frame. this is temporary, pending planned factoring of this
// Failing to find a matching HTML frame, try creating a specialized
// XUL frame. This is temporary, pending planned factoring of this
// whole process into separate, pluggable steps.
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) || (lastChild == aFrameItems.lastChild)))
{
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) ||
(lastChild == aFrameItems.lastChild))) {
PRBool haltProcessing = PR_FALSE;
rv = ConstructXULFrame(aPresContext, aContent, aParentFrame, tag,
styleContext, aAbsoluteItems, aFrameItems, haltProcessing);
if (haltProcessing)
{
if (haltProcessing) {
NS_RELEASE(styleContext);
NS_IF_RELEASE(tag);
return rv;
@ -2977,13 +2968,15 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
}
#endif
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) || (lastChild == aFrameItems.lastChild))) {
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) ||
(lastChild == aFrameItems.lastChild))) {
// When there is no explicit frame to create, assume it's a
// container and let display style dictate the rest
rv = ConstructFrameByDisplayType(aPresContext, display, aContent, aParentFrame,
styleContext, aAbsoluteItems, aFrameItems);
}
}
NS_RELEASE(styleContext);
}
@ -3151,8 +3144,7 @@ HTMLStyleSheetImpl::ContentAppended(nsIPresContext* aPresContext,
nsresult result = NS_OK;
nsIFrame *adjustedParentFrame=parentFrame;
firstAppendedFrame = frameItems.childList;
if (nsnull!=firstAppendedFrame)
{
if (nsnull != firstAppendedFrame) {
const nsStyleDisplay* firstAppendedFrameDisplay;
firstAppendedFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)firstAppendedFrameDisplay);
result = GetAdjustedParentFrame(parentFrame, firstAppendedFrameDisplay->mDisplay, adjustedParentFrame);

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

@ -229,20 +229,15 @@ struct nsFrameItems {
nsIFrame* lastChild;
nsFrameItems();
// Appends the frame to the end of the list
void AddChild(nsIFrame* aChild);
void Clear();
};
nsFrameItems::nsFrameItems()
:childList(nsnull), lastChild(nsnull)
{}
void
nsFrameItems::Clear()
{
childList = lastChild = nsnull;
}
void
nsFrameItems::AddChild(nsIFrame* aChild)
{
@ -2000,7 +1995,6 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame);
// Add the placeholder frame to the flow
aFrameItems.Clear();
aFrameItems.AddChild(placeholderFrame);
}
}
@ -2196,7 +2190,6 @@ HTMLStyleSheetImpl::ConstructXULFrame(nsIPresContext* aPresContext,
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame);
// Add the placeholder frame to the flow
aFrameItems.Clear();
aFrameItems.AddChild(placeholderFrame);
}
}
@ -2509,12 +2502,14 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
nsAbsoluteItems& aAbsoluteItems,
nsFrameItems& aFrameItems)
{
const nsStylePosition* position = (const nsStylePosition*)
aStyleContext->GetStyleData(eStyleStruct_Position);
PRBool isAbsolutelyPositioned = PR_FALSE;
PRBool isBlock = aDisplay->IsBlockLevel();
nsresult rv = NS_OK;
// Get the position syle info
const nsStylePosition* position = (const nsStylePosition*)
aStyleContext->GetStyleData(eStyleStruct_Position);
// Initialize frame
nsIFrame* aNewFrame = nsnull;
@ -2714,7 +2709,6 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame);
// Add the placeholder frame to the flow
aFrameItems.Clear();
aFrameItems.AddChild(placeholderFrame);
}
return rv;
@ -2820,7 +2814,6 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame);
// Add the placeholder frame to the flow
aFrameItems.Clear();
aFrameItems.AddChild(placeholderFrame);
}
@ -2952,7 +2945,6 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
styleContext->GetStyleData(eStyleStruct_Display);
if (NS_STYLE_DISPLAY_NONE != display->mDisplay) {
nsIFrame* lastChild = aFrameItems.lastChild;
// Handle specific frame types
@ -2960,16 +2952,15 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
styleContext, aAbsoluteItems, aFrameItems);
#ifdef INCLUDE_XUL
// failing to find a matching HTML frame, try creating a specialized
// XUL frame. this is temporary, pending planned factoring of this
// Failing to find a matching HTML frame, try creating a specialized
// XUL frame. This is temporary, pending planned factoring of this
// whole process into separate, pluggable steps.
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) || (lastChild == aFrameItems.lastChild)))
{
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) ||
(lastChild == aFrameItems.lastChild))) {
PRBool haltProcessing = PR_FALSE;
rv = ConstructXULFrame(aPresContext, aContent, aParentFrame, tag,
styleContext, aAbsoluteItems, aFrameItems, haltProcessing);
if (haltProcessing)
{
if (haltProcessing) {
NS_RELEASE(styleContext);
NS_IF_RELEASE(tag);
return rv;
@ -2977,13 +2968,15 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
}
#endif
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) || (lastChild == aFrameItems.lastChild))) {
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) ||
(lastChild == aFrameItems.lastChild))) {
// When there is no explicit frame to create, assume it's a
// container and let display style dictate the rest
rv = ConstructFrameByDisplayType(aPresContext, display, aContent, aParentFrame,
styleContext, aAbsoluteItems, aFrameItems);
}
}
NS_RELEASE(styleContext);
}
@ -3151,8 +3144,7 @@ HTMLStyleSheetImpl::ContentAppended(nsIPresContext* aPresContext,
nsresult result = NS_OK;
nsIFrame *adjustedParentFrame=parentFrame;
firstAppendedFrame = frameItems.childList;
if (nsnull!=firstAppendedFrame)
{
if (nsnull != firstAppendedFrame) {
const nsStyleDisplay* firstAppendedFrameDisplay;
firstAppendedFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)firstAppendedFrameDisplay);
result = GetAdjustedParentFrame(parentFrame, firstAppendedFrameDisplay->mDisplay, adjustedParentFrame);

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

@ -229,20 +229,15 @@ struct nsFrameItems {
nsIFrame* lastChild;
nsFrameItems();
// Appends the frame to the end of the list
void AddChild(nsIFrame* aChild);
void Clear();
};
nsFrameItems::nsFrameItems()
:childList(nsnull), lastChild(nsnull)
{}
void
nsFrameItems::Clear()
{
childList = lastChild = nsnull;
}
void
nsFrameItems::AddChild(nsIFrame* aChild)
{
@ -2000,7 +1995,6 @@ HTMLStyleSheetImpl::ConstructFrameByTag(nsIPresContext* aPresContext,
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame);
// Add the placeholder frame to the flow
aFrameItems.Clear();
aFrameItems.AddChild(placeholderFrame);
}
}
@ -2196,7 +2190,6 @@ HTMLStyleSheetImpl::ConstructXULFrame(nsIPresContext* aPresContext,
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame);
// Add the placeholder frame to the flow
aFrameItems.Clear();
aFrameItems.AddChild(placeholderFrame);
}
}
@ -2509,12 +2502,14 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
nsAbsoluteItems& aAbsoluteItems,
nsFrameItems& aFrameItems)
{
const nsStylePosition* position = (const nsStylePosition*)
aStyleContext->GetStyleData(eStyleStruct_Position);
PRBool isAbsolutelyPositioned = PR_FALSE;
PRBool isBlock = aDisplay->IsBlockLevel();
nsresult rv = NS_OK;
// Get the position syle info
const nsStylePosition* position = (const nsStylePosition*)
aStyleContext->GetStyleData(eStyleStruct_Position);
// Initialize frame
nsIFrame* aNewFrame = nsnull;
@ -2714,7 +2709,6 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame);
// Add the placeholder frame to the flow
aFrameItems.Clear();
aFrameItems.AddChild(placeholderFrame);
}
return rv;
@ -2820,7 +2814,6 @@ HTMLStyleSheetImpl::ConstructFrameByDisplayType(nsIPresContext* aPresConte
aAbsoluteItems.AddAbsolutelyPositionedChild(aNewFrame);
// Add the placeholder frame to the flow
aFrameItems.Clear();
aFrameItems.AddChild(placeholderFrame);
}
@ -2952,7 +2945,6 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
styleContext->GetStyleData(eStyleStruct_Display);
if (NS_STYLE_DISPLAY_NONE != display->mDisplay) {
nsIFrame* lastChild = aFrameItems.lastChild;
// Handle specific frame types
@ -2960,16 +2952,15 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
styleContext, aAbsoluteItems, aFrameItems);
#ifdef INCLUDE_XUL
// failing to find a matching HTML frame, try creating a specialized
// XUL frame. this is temporary, pending planned factoring of this
// Failing to find a matching HTML frame, try creating a specialized
// XUL frame. This is temporary, pending planned factoring of this
// whole process into separate, pluggable steps.
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) || (lastChild == aFrameItems.lastChild)))
{
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) ||
(lastChild == aFrameItems.lastChild))) {
PRBool haltProcessing = PR_FALSE;
rv = ConstructXULFrame(aPresContext, aContent, aParentFrame, tag,
styleContext, aAbsoluteItems, aFrameItems, haltProcessing);
if (haltProcessing)
{
if (haltProcessing) {
NS_RELEASE(styleContext);
NS_IF_RELEASE(tag);
return rv;
@ -2977,13 +2968,15 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext,
}
#endif
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) || (lastChild == aFrameItems.lastChild))) {
if (NS_SUCCEEDED(rv) && ((nsnull == aFrameItems.childList) ||
(lastChild == aFrameItems.lastChild))) {
// When there is no explicit frame to create, assume it's a
// container and let display style dictate the rest
rv = ConstructFrameByDisplayType(aPresContext, display, aContent, aParentFrame,
styleContext, aAbsoluteItems, aFrameItems);
}
}
NS_RELEASE(styleContext);
}
@ -3151,8 +3144,7 @@ HTMLStyleSheetImpl::ContentAppended(nsIPresContext* aPresContext,
nsresult result = NS_OK;
nsIFrame *adjustedParentFrame=parentFrame;
firstAppendedFrame = frameItems.childList;
if (nsnull!=firstAppendedFrame)
{
if (nsnull != firstAppendedFrame) {
const nsStyleDisplay* firstAppendedFrameDisplay;
firstAppendedFrame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct *&)firstAppendedFrameDisplay);
result = GetAdjustedParentFrame(parentFrame, firstAppendedFrameDisplay->mDisplay, adjustedParentFrame);