Added UpdateStyleContexts for support change-out of style contexts

This commit is contained in:
kipp%netscape.com 1998-11-05 19:31:39 +00:00
parent 4957b3f0d6
commit c9dcd9009c
4 changed files with 42 additions and 2 deletions

View File

@ -515,4 +515,19 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext,
return NS_OK;
}
void
nsHTMLContainerFrame::UpdateStyleContexts(nsIPresContext& aPresContext,
nsIFrame* aFrame,
nsIFrame* aOldParent,
nsIFrame* aNewParent)
{
nsIStyleContext* oldParentSC;
aOldParent->GetStyleContext(oldParentSC);
nsIStyleContext* newParentSC;
aNewParent->GetStyleContext(newParentSC);
if (oldParentSC != newParentSC) {
aFrame->ReResolveStyleContext(&aPresContext, newParentSC);
}
NS_RELEASE(oldParentSC);
NS_RELEASE(newParentSC);
}

View File

@ -84,6 +84,11 @@ public:
nsIStyleContext* aStyleContext,
PRBool aForce);
static void UpdateStyleContexts(nsIPresContext& aPresContext,
nsIFrame* aFrame,
nsIFrame* aOldParent,
nsIFrame* aNewParent);
protected:
virtual ~nsHTMLContainerFrame();

View File

@ -515,4 +515,19 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIPresContext& aPresContext,
return NS_OK;
}
void
nsHTMLContainerFrame::UpdateStyleContexts(nsIPresContext& aPresContext,
nsIFrame* aFrame,
nsIFrame* aOldParent,
nsIFrame* aNewParent)
{
nsIStyleContext* oldParentSC;
aOldParent->GetStyleContext(oldParentSC);
nsIStyleContext* newParentSC;
aNewParent->GetStyleContext(newParentSC);
if (oldParentSC != newParentSC) {
aFrame->ReResolveStyleContext(&aPresContext, newParentSC);
}
NS_RELEASE(oldParentSC);
NS_RELEASE(newParentSC);
}

View File

@ -84,6 +84,11 @@ public:
nsIStyleContext* aStyleContext,
PRBool aForce);
static void UpdateStyleContexts(nsIPresContext& aPresContext,
nsIFrame* aFrame,
nsIFrame* aOldParent,
nsIFrame* aNewParent);
protected:
virtual ~nsHTMLContainerFrame();