Bug 153907. Give IFRAMEs their correct content-parent even though they construct their views in the wrong order. r=jkeiser,sr=kin

This commit is contained in:
roc+%cs.cmu.edu 2002-09-18 01:17:02 +00:00
Родитель 1b433c0802
Коммит aa2fc24f2e
4 изменённых файлов: 76 добавлений и 2 удалений

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

@ -4861,6 +4861,15 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsIPresShell* aPresShell,
}
if (allowSubframes) {
rv = NS_NewHTMLFrameOuterFrame(aPresShell, &newFrame);
if (newFrame) {
// the nsFrameOuterFrame needs to know about its content parent during ::Init.
// there is no reasonable way to get the value there.
// so we store it as a frame property.
nsCOMPtr<nsIAtom> contentParentAtom = do_GetAtom("contentParent");
aState.mFrameManager->SetFrameProperty(newFrame,
contentParentAtom,
aParentFrame, nsnull);
}
}
}
else if (nsHTMLAtoms::noframes == aTag) {

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

@ -53,6 +53,7 @@
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIComponentManager.h"
#include "nsIFrameManager.h"
#include "nsIStreamListener.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
@ -363,7 +364,34 @@ nsHTMLFrameOuterFrame::Init(nsIPresContext* aPresContext,
nsIView* view = nsnull;
GetView(aPresContext, &view);
if (!view) {
nsHTMLContainerFrame::CreateViewForFrame(aPresContext,this,mStyleContext,nsnull,PR_TRUE);
// To properly initialize the view we need to know the frame for the content
// that is the parent of content for this frame. This might not be our actual
// frame parent if we are out of flow (e.g., positioned) so our parent frame
// may have been set to some other ancestor.
// We look for a content parent frame in the frame property list, where it
// will have been set by nsCSSFrameConstructor if necessary.
nsCOMPtr<nsIAtom> contentParentAtom = do_GetAtom("contentParent");
nsIFrame* contentParent = nsnull;
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
void* value;
rv = frameManager->GetFrameProperty(this,
contentParentAtom,
NS_IFRAME_MGR_REMOVE_PROP,
&value);
if (NS_SUCCEEDED(rv)) {
contentParent = (nsIFrame*)value;
}
}
}
nsHTMLContainerFrame::CreateViewForFrame(aPresContext,this,mStyleContext,contentParent,PR_TRUE);
GetView(aPresContext, &view);
}

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

@ -53,6 +53,7 @@
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIComponentManager.h"
#include "nsIFrameManager.h"
#include "nsIStreamListener.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
@ -363,7 +364,34 @@ nsHTMLFrameOuterFrame::Init(nsIPresContext* aPresContext,
nsIView* view = nsnull;
GetView(aPresContext, &view);
if (!view) {
nsHTMLContainerFrame::CreateViewForFrame(aPresContext,this,mStyleContext,nsnull,PR_TRUE);
// To properly initialize the view we need to know the frame for the content
// that is the parent of content for this frame. This might not be our actual
// frame parent if we are out of flow (e.g., positioned) so our parent frame
// may have been set to some other ancestor.
// We look for a content parent frame in the frame property list, where it
// will have been set by nsCSSFrameConstructor if necessary.
nsCOMPtr<nsIAtom> contentParentAtom = do_GetAtom("contentParent");
nsIFrame* contentParent = nsnull;
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
if (presShell) {
nsCOMPtr<nsIFrameManager> frameManager;
presShell->GetFrameManager(getter_AddRefs(frameManager));
if (frameManager) {
void* value;
rv = frameManager->GetFrameProperty(this,
contentParentAtom,
NS_IFRAME_MGR_REMOVE_PROP,
&value);
if (NS_SUCCEEDED(rv)) {
contentParent = (nsIFrame*)value;
}
}
}
nsHTMLContainerFrame::CreateViewForFrame(aPresContext,this,mStyleContext,contentParent,PR_TRUE);
GetView(aPresContext, &view);
}

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

@ -4861,6 +4861,15 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsIPresShell* aPresShell,
}
if (allowSubframes) {
rv = NS_NewHTMLFrameOuterFrame(aPresShell, &newFrame);
if (newFrame) {
// the nsFrameOuterFrame needs to know about its content parent during ::Init.
// there is no reasonable way to get the value there.
// so we store it as a frame property.
nsCOMPtr<nsIAtom> contentParentAtom = do_GetAtom("contentParent");
aState.mFrameManager->SetFrameProperty(newFrame,
contentParentAtom,
aParentFrame, nsnull);
}
}
}
else if (nsHTMLAtoms::noframes == aTag) {