Make sure to properly delegate all framelist updates to our anonymous div. Bug

226016/98239, r+sr=dbaron
This commit is contained in:
bzbarsky%mit.edu 2003-11-18 02:12:24 +00:00
Родитель 4567068ce8
Коммит acf7c89bca
4 изменённых файлов: 172 добавлений и 62 удалений

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

@ -218,6 +218,22 @@ nsHTMLButtonControlFrame::GetValue(nsAString* aResult)
return nsFormControlHelper::GetValueAttr(mContent, aResult);
}
void
nsHTMLButtonControlFrame::ReParentFrameList(nsIFrameManager* aFrameManager,
nsIFrame* aFrameList)
{
// get the new parent context from the first child: that is the
// frame that the subsequent children will be made children of
nsStyleContext* newParentContext = mFrames.FirstChild()->GetStyleContext();
// Set the parent for each of the child frames
for (nsIFrame* frame = aFrameList; frame; frame = frame->GetNextSibling()) {
frame->SetParent(mFrames.FirstChild());
// now reparent the contexts for the reparented frame too
aFrameManager->ReParentStyleContext(frame, newParentContext);
}
}
PRBool
nsHTMLButtonControlFrame::IsReset(PRInt32 type)
{
@ -317,31 +333,9 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{
// get the frame manager and the style context of the new parent frame
// this is used whent he children are reparented below
// NOTE: the whole reparenting should not need to happen: see bugzilla bug 51767
//
nsCOMPtr<nsIPresShell> shell;
nsCOMPtr<nsIFrameManager> frameManager;
nsStyleContext* newParentContext;
aPresContext->GetShell(getter_AddRefs(shell));
if (shell) {
shell->GetFrameManager(getter_AddRefs(frameManager));
}
// get the new parent context from the first child: that is the frame that the
// subsequent children will be made children of
newParentContext = mFrames.FirstChild()->GetStyleContext();
// Set the parent for each of the child frames
for (nsIFrame* frame = aChildList; frame; frame = frame->GetNextSibling()) {
frame->SetParent(mFrames.FirstChild());
// now reparent the contexts for the reparented frame too
if (frameManager) {
frameManager->ReParentStyleContext(frame, newParentContext);
}
}
// Queue up the frames for the inline frame
ReParentFrameList(aPresContext->GetFrameManager(), aChildList);
return mFrames.FirstChild()->SetInitialChildList(aPresContext, nsnull, aChildList);
}
@ -722,10 +716,53 @@ nsHTMLButtonControlFrame::AppendFrames(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aFrameList)
{
ReParentFrameList(aPresContext->GetFrameManager(), aFrameList);
return mFrames.FirstChild()->AppendFrames(aPresContext,
aPresShell,
aListName,
aFrameList);
aPresShell,
aListName,
aFrameList);
}
NS_IMETHODIMP
nsHTMLButtonControlFrame::InsertFrames(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList)
{
ReParentFrameList(aPresContext->GetFrameManager(), aFrameList);
return mFrames.FirstChild()->InsertFrames(aPresContext,
aPresShell,
aListName,
aPrevFrame,
aFrameList);
}
NS_IMETHODIMP
nsHTMLButtonControlFrame::RemoveFrame(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aOldFrame)
{
return mFrames.FirstChild()->RemoveFrame(aPresContext,
aPresShell,
aListName,
aOldFrame);
}
NS_IMETHODIMP
nsHTMLButtonControlFrame::ReplaceFrame(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame)
{
ReParentFrameList(aPresContext->GetFrameManager(), aNewFrame);
return mFrames.FirstChild()->ReplaceFrame(aPresContext,
aPresShell,
aListName,
aOldFrame,
aNewFrame);
}
NS_IMETHODIMP

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

@ -109,10 +109,27 @@ public:
virtual void SetAdditionalStyleContext(PRInt32 aIndex,
nsStyleContext* aStyleContext);
NS_IMETHOD AppendFrames(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aFrameList);
NS_IMETHOD AppendFrames(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aFrameList);
NS_IMETHOD InsertFrames(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList);
NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aOldFrame);
NS_IMETHOD ReplaceFrame(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame);
#ifdef ACCESSIBILITY
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
@ -154,6 +171,7 @@ public:
NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight);
protected:
void ReParentFrameList(nsIFrameManager* aFrameManager, nsIFrame* aFrameList);
virtual PRBool IsReset(PRInt32 type);
virtual PRBool IsSubmit(PRInt32 type);
void ReflowButtonContents(nsIPresContext* aPresContext,

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

@ -218,6 +218,22 @@ nsHTMLButtonControlFrame::GetValue(nsAString* aResult)
return nsFormControlHelper::GetValueAttr(mContent, aResult);
}
void
nsHTMLButtonControlFrame::ReParentFrameList(nsIFrameManager* aFrameManager,
nsIFrame* aFrameList)
{
// get the new parent context from the first child: that is the
// frame that the subsequent children will be made children of
nsStyleContext* newParentContext = mFrames.FirstChild()->GetStyleContext();
// Set the parent for each of the child frames
for (nsIFrame* frame = aFrameList; frame; frame = frame->GetNextSibling()) {
frame->SetParent(mFrames.FirstChild());
// now reparent the contexts for the reparented frame too
aFrameManager->ReParentStyleContext(frame, newParentContext);
}
}
PRBool
nsHTMLButtonControlFrame::IsReset(PRInt32 type)
{
@ -317,31 +333,9 @@ nsHTMLButtonControlFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList)
{
// get the frame manager and the style context of the new parent frame
// this is used whent he children are reparented below
// NOTE: the whole reparenting should not need to happen: see bugzilla bug 51767
//
nsCOMPtr<nsIPresShell> shell;
nsCOMPtr<nsIFrameManager> frameManager;
nsStyleContext* newParentContext;
aPresContext->GetShell(getter_AddRefs(shell));
if (shell) {
shell->GetFrameManager(getter_AddRefs(frameManager));
}
// get the new parent context from the first child: that is the frame that the
// subsequent children will be made children of
newParentContext = mFrames.FirstChild()->GetStyleContext();
// Set the parent for each of the child frames
for (nsIFrame* frame = aChildList; frame; frame = frame->GetNextSibling()) {
frame->SetParent(mFrames.FirstChild());
// now reparent the contexts for the reparented frame too
if (frameManager) {
frameManager->ReParentStyleContext(frame, newParentContext);
}
}
// Queue up the frames for the inline frame
ReParentFrameList(aPresContext->GetFrameManager(), aChildList);
return mFrames.FirstChild()->SetInitialChildList(aPresContext, nsnull, aChildList);
}
@ -722,10 +716,53 @@ nsHTMLButtonControlFrame::AppendFrames(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aFrameList)
{
ReParentFrameList(aPresContext->GetFrameManager(), aFrameList);
return mFrames.FirstChild()->AppendFrames(aPresContext,
aPresShell,
aListName,
aFrameList);
aPresShell,
aListName,
aFrameList);
}
NS_IMETHODIMP
nsHTMLButtonControlFrame::InsertFrames(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList)
{
ReParentFrameList(aPresContext->GetFrameManager(), aFrameList);
return mFrames.FirstChild()->InsertFrames(aPresContext,
aPresShell,
aListName,
aPrevFrame,
aFrameList);
}
NS_IMETHODIMP
nsHTMLButtonControlFrame::RemoveFrame(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aOldFrame)
{
return mFrames.FirstChild()->RemoveFrame(aPresContext,
aPresShell,
aListName,
aOldFrame);
}
NS_IMETHODIMP
nsHTMLButtonControlFrame::ReplaceFrame(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame)
{
ReParentFrameList(aPresContext->GetFrameManager(), aNewFrame);
return mFrames.FirstChild()->ReplaceFrame(aPresContext,
aPresShell,
aListName,
aOldFrame,
aNewFrame);
}
NS_IMETHODIMP

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

@ -109,10 +109,27 @@ public:
virtual void SetAdditionalStyleContext(PRInt32 aIndex,
nsStyleContext* aStyleContext);
NS_IMETHOD AppendFrames(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aFrameList);
NS_IMETHOD AppendFrames(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aFrameList);
NS_IMETHOD InsertFrames(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aPrevFrame,
nsIFrame* aFrameList);
NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aOldFrame);
NS_IMETHOD ReplaceFrame(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,
nsIAtom* aListName,
nsIFrame* aOldFrame,
nsIFrame* aNewFrame);
#ifdef ACCESSIBILITY
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
@ -154,6 +171,7 @@ public:
NS_IMETHOD SetSuggestedSize(nscoord aWidth, nscoord aHeight);
protected:
void ReParentFrameList(nsIFrameManager* aFrameManager, nsIFrame* aFrameList);
virtual PRBool IsReset(PRInt32 type);
virtual PRBool IsSubmit(PRInt32 type);
void ReflowButtonContents(nsIPresContext* aPresContext,