зеркало из https://github.com/mozilla/pjs.git
Clarify when ReParentStyleContext should be called and remove more bogus style
parentage warnings. Bug 217225, r+sr=dbaron
This commit is contained in:
Родитель
c9061a1c2a
Коммит
8b1b76c827
|
@ -2802,9 +2802,8 @@ nsCSSFrameConstructor::ConstructTableColFrame(nsIPresShell* aPresShel
|
||||||
rv = aTableCreator.CreateTableColFrame(&aNewFrame); if (NS_FAILED(rv)) return rv;
|
rv = aTableCreator.CreateTableColFrame(&aNewFrame); if (NS_FAILED(rv)) return rv;
|
||||||
InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame, aStyleContext, nsnull, aNewFrame);
|
InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame, aStyleContext, nsnull, aNewFrame);
|
||||||
// if the parent frame was anonymous then reparent the style context
|
// if the parent frame was anonymous then reparent the style context
|
||||||
nsStyleContext* parentStyleContext = parentFrame->GetStyleContext();
|
|
||||||
if (aIsPseudoParent) {
|
if (aIsPseudoParent) {
|
||||||
aPresContext->ReParentStyleContext(aNewFrame, parentStyleContext);
|
aPresContext->ReParentStyleContext(aNewFrame, parentFrame->GetStyleContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
// construct additional col frames if the col frame has a span > 1
|
// construct additional col frames if the col frame has a span > 1
|
||||||
|
@ -11678,8 +11677,8 @@ ReparentFrame(nsIPresContext* aPresContext,
|
||||||
nsStyleContext* aParentStyleContext,
|
nsStyleContext* aParentStyleContext,
|
||||||
nsIFrame* aFrame)
|
nsIFrame* aFrame)
|
||||||
{
|
{
|
||||||
aPresContext->ReParentStyleContext(aFrame, aParentStyleContext);
|
|
||||||
aFrame->SetParent(aNewParentFrame);
|
aFrame->SetParent(aNewParentFrame);
|
||||||
|
aPresContext->ReParentStyleContext(aFrame, aParentStyleContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special routine to handle placing a list of frames into a block
|
// Special routine to handle placing a list of frames into a block
|
||||||
|
|
|
@ -1463,10 +1463,8 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame,
|
||||||
NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_AVAILABLE);
|
NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_AVAILABLE);
|
||||||
nsresult result = NS_ERROR_NULL_POINTER;
|
nsresult result = NS_ERROR_NULL_POINTER;
|
||||||
if (aFrame) {
|
if (aFrame) {
|
||||||
#ifdef NS_DEBUG
|
// DO NOT verify the style tree before reparenting. The frame
|
||||||
DebugVerifyStyleTree(aFrame);
|
// tree has already been changed, so this check would just fail.
|
||||||
#endif
|
|
||||||
|
|
||||||
nsStyleContext* oldContext = aFrame->GetStyleContext();
|
nsStyleContext* oldContext = aFrame->GetStyleContext();
|
||||||
if (oldContext) {
|
if (oldContext) {
|
||||||
nsIPresContext *presContext = GetPresContext();
|
nsIPresContext *presContext = GetPresContext();
|
||||||
|
@ -1529,7 +1527,7 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef NS_DEBUG
|
#ifdef DEBUG
|
||||||
VerifyStyleTree(GetPresContext(), aFrame, aNewParentContext);
|
VerifyStyleTree(GetPresContext(), aFrame, aNewParentContext);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,9 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For a given frame tree, get a new style context that is the equivalent
|
* For a given frame tree, get a new style context that is the equivalent
|
||||||
* but within a new parent
|
* but within a new parent. The StyleContextParent of aFrame should be
|
||||||
|
* changed _before_ this method is called, so that style tree verification
|
||||||
|
* can take place correctly.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD ReParentStyleContext(nsIFrame* aFrame,
|
NS_IMETHOD ReParentStyleContext(nsIFrame* aFrame,
|
||||||
nsStyleContext* aNewParentContext) = 0;
|
nsStyleContext* aNewParentContext) = 0;
|
||||||
|
|
|
@ -140,7 +140,9 @@ public:
|
||||||
NS_IMETHOD NotifyDestroyingFrame(nsIFrame* aFrame) = 0;
|
NS_IMETHOD NotifyDestroyingFrame(nsIFrame* aFrame) = 0;
|
||||||
|
|
||||||
// reparent the style contexts of this frame sub tree to live under the
|
// reparent the style contexts of this frame sub tree to live under the
|
||||||
// new given parent style context
|
// new given parent style context. The StyleContextParent of aFrame
|
||||||
|
// should be changed _before_ this method is called, so that style tree
|
||||||
|
// verification can take place correctly.
|
||||||
NS_IMETHOD ReParentStyleContext(nsIFrame* aFrame,
|
NS_IMETHOD ReParentStyleContext(nsIFrame* aFrame,
|
||||||
nsStyleContext* aNewParentContext) = 0;
|
nsStyleContext* aNewParentContext) = 0;
|
||||||
|
|
||||||
|
|
|
@ -253,7 +253,9 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For a given frame tree, get a new style context that is the equivalent
|
* For a given frame tree, get a new style context that is the equivalent
|
||||||
* but within a new parent
|
* but within a new parent. The StyleContextParent of aFrame should be
|
||||||
|
* changed _before_ this method is called, so that style tree verification
|
||||||
|
* can take place correctly.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD ReParentStyleContext(nsIFrame* aFrame,
|
NS_IMETHOD ReParentStyleContext(nsIFrame* aFrame,
|
||||||
nsStyleContext* aNewParentContext) = 0;
|
nsStyleContext* aNewParentContext) = 0;
|
||||||
|
|
|
@ -253,7 +253,9 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For a given frame tree, get a new style context that is the equivalent
|
* For a given frame tree, get a new style context that is the equivalent
|
||||||
* but within a new parent
|
* but within a new parent. The StyleContextParent of aFrame should be
|
||||||
|
* changed _before_ this method is called, so that style tree verification
|
||||||
|
* can take place correctly.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD ReParentStyleContext(nsIFrame* aFrame,
|
NS_IMETHOD ReParentStyleContext(nsIFrame* aFrame,
|
||||||
nsStyleContext* aNewParentContext) = 0;
|
nsStyleContext* aNewParentContext) = 0;
|
||||||
|
|
|
@ -158,8 +158,8 @@ nsFirstLetterFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||||
nsIFrame* aChildList)
|
nsIFrame* aChildList)
|
||||||
{
|
{
|
||||||
mFrames.SetFrames(aChildList);
|
mFrames.SetFrames(aChildList);
|
||||||
if (aChildList) {
|
for (nsIFrame* frame = aChildList; frame; frame = frame->GetNextSibling()) {
|
||||||
aPresContext->ReParentStyleContext(aChildList, mStyleContext);
|
aPresContext->ReParentStyleContext(frame, mStyleContext);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -993,8 +993,8 @@ nsFirstLineFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
if (prevOverflowFrames) {
|
if (prevOverflowFrames) {
|
||||||
nsFrameList frames(prevOverflowFrames);
|
nsFrameList frames(prevOverflowFrames);
|
||||||
|
|
||||||
ReParentChildListStyle(aPresContext, mStyleContext, frames);
|
|
||||||
mFrames.InsertFrames(this, nsnull, prevOverflowFrames);
|
mFrames.InsertFrames(this, nsnull, prevOverflowFrames);
|
||||||
|
ReParentChildListStyle(aPresContext, mStyleContext, frames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1004,8 +1004,8 @@ nsFirstLineFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
NS_ASSERTION(mFrames.NotEmpty(), "overflow list w/o frames");
|
NS_ASSERTION(mFrames.NotEmpty(), "overflow list w/o frames");
|
||||||
nsFrameList frames(overflowFrames);
|
nsFrameList frames(overflowFrames);
|
||||||
|
|
||||||
ReParentChildListStyle(aPresContext, mStyleContext, frames);
|
|
||||||
mFrames.AppendFrames(nsnull, overflowFrames);
|
mFrames.AppendFrames(nsnull, overflowFrames);
|
||||||
|
ReParentChildListStyle(aPresContext, mStyleContext, frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set our own reflow state (additional state above and beyond
|
// Set our own reflow state (additional state above and beyond
|
||||||
|
|
|
@ -158,8 +158,8 @@ nsFirstLetterFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
||||||
nsIFrame* aChildList)
|
nsIFrame* aChildList)
|
||||||
{
|
{
|
||||||
mFrames.SetFrames(aChildList);
|
mFrames.SetFrames(aChildList);
|
||||||
if (aChildList) {
|
for (nsIFrame* frame = aChildList; frame; frame = frame->GetNextSibling()) {
|
||||||
aPresContext->ReParentStyleContext(aChildList, mStyleContext);
|
aPresContext->ReParentStyleContext(frame, mStyleContext);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1463,10 +1463,8 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame,
|
||||||
NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_AVAILABLE);
|
NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_AVAILABLE);
|
||||||
nsresult result = NS_ERROR_NULL_POINTER;
|
nsresult result = NS_ERROR_NULL_POINTER;
|
||||||
if (aFrame) {
|
if (aFrame) {
|
||||||
#ifdef NS_DEBUG
|
// DO NOT verify the style tree before reparenting. The frame
|
||||||
DebugVerifyStyleTree(aFrame);
|
// tree has already been changed, so this check would just fail.
|
||||||
#endif
|
|
||||||
|
|
||||||
nsStyleContext* oldContext = aFrame->GetStyleContext();
|
nsStyleContext* oldContext = aFrame->GetStyleContext();
|
||||||
if (oldContext) {
|
if (oldContext) {
|
||||||
nsIPresContext *presContext = GetPresContext();
|
nsIPresContext *presContext = GetPresContext();
|
||||||
|
@ -1529,7 +1527,7 @@ FrameManager::ReParentStyleContext(nsIFrame* aFrame,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef NS_DEBUG
|
#ifdef DEBUG
|
||||||
VerifyStyleTree(GetPresContext(), aFrame, aNewParentContext);
|
VerifyStyleTree(GetPresContext(), aFrame, aNewParentContext);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -993,8 +993,8 @@ nsFirstLineFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
if (prevOverflowFrames) {
|
if (prevOverflowFrames) {
|
||||||
nsFrameList frames(prevOverflowFrames);
|
nsFrameList frames(prevOverflowFrames);
|
||||||
|
|
||||||
ReParentChildListStyle(aPresContext, mStyleContext, frames);
|
|
||||||
mFrames.InsertFrames(this, nsnull, prevOverflowFrames);
|
mFrames.InsertFrames(this, nsnull, prevOverflowFrames);
|
||||||
|
ReParentChildListStyle(aPresContext, mStyleContext, frames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1004,8 +1004,8 @@ nsFirstLineFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
NS_ASSERTION(mFrames.NotEmpty(), "overflow list w/o frames");
|
NS_ASSERTION(mFrames.NotEmpty(), "overflow list w/o frames");
|
||||||
nsFrameList frames(overflowFrames);
|
nsFrameList frames(overflowFrames);
|
||||||
|
|
||||||
ReParentChildListStyle(aPresContext, mStyleContext, frames);
|
|
||||||
mFrames.AppendFrames(nsnull, overflowFrames);
|
mFrames.AppendFrames(nsnull, overflowFrames);
|
||||||
|
ReParentChildListStyle(aPresContext, mStyleContext, frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set our own reflow state (additional state above and beyond
|
// Set our own reflow state (additional state above and beyond
|
||||||
|
|
|
@ -2802,9 +2802,8 @@ nsCSSFrameConstructor::ConstructTableColFrame(nsIPresShell* aPresShel
|
||||||
rv = aTableCreator.CreateTableColFrame(&aNewFrame); if (NS_FAILED(rv)) return rv;
|
rv = aTableCreator.CreateTableColFrame(&aNewFrame); if (NS_FAILED(rv)) return rv;
|
||||||
InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame, aStyleContext, nsnull, aNewFrame);
|
InitAndRestoreFrame(aPresContext, aState, aContent, parentFrame, aStyleContext, nsnull, aNewFrame);
|
||||||
// if the parent frame was anonymous then reparent the style context
|
// if the parent frame was anonymous then reparent the style context
|
||||||
nsStyleContext* parentStyleContext = parentFrame->GetStyleContext();
|
|
||||||
if (aIsPseudoParent) {
|
if (aIsPseudoParent) {
|
||||||
aPresContext->ReParentStyleContext(aNewFrame, parentStyleContext);
|
aPresContext->ReParentStyleContext(aNewFrame, parentFrame->GetStyleContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
// construct additional col frames if the col frame has a span > 1
|
// construct additional col frames if the col frame has a span > 1
|
||||||
|
@ -11678,8 +11677,8 @@ ReparentFrame(nsIPresContext* aPresContext,
|
||||||
nsStyleContext* aParentStyleContext,
|
nsStyleContext* aParentStyleContext,
|
||||||
nsIFrame* aFrame)
|
nsIFrame* aFrame)
|
||||||
{
|
{
|
||||||
aPresContext->ReParentStyleContext(aFrame, aParentStyleContext);
|
|
||||||
aFrame->SetParent(aNewParentFrame);
|
aFrame->SetParent(aNewParentFrame);
|
||||||
|
aPresContext->ReParentStyleContext(aFrame, aParentStyleContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special routine to handle placing a list of frames into a block
|
// Special routine to handle placing a list of frames into a block
|
||||||
|
|
Загрузка…
Ссылка в новой задаче